From: Joerg Roedel <[email protected]>

These are the same across all planes for one VCPU, so make then
shared.

Signed-off-by: Joerg Roedel <[email protected]>
---
 include/linux/kvm_host.h |  4 ++--
 virt/kvm/kvm_main.c      | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 73786712495d..9220c452aa3a 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -348,6 +348,8 @@ struct kvm_vcpu_common {
 
        struct pid *pid;
        rwlock_t pid_lock;
+       int sigset_active;
+       sigset_t sigset;
 
        /* Scheduling state */
 #ifdef CONFIG_PREEMPT_NOTIFIERS
@@ -371,8 +373,6 @@ struct kvm_vcpu {
 
        struct kvm_run *run;
 
-       int sigset_active;
-       sigset_t sigset;
        unsigned int halt_poll_ns;
 
        u64 plane_requests;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index af3c4e0081b8..1858880ee3d3 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3694,7 +3694,9 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_vcpu_mark_page_dirty);
 
 void kvm_sigset_activate(struct kvm_vcpu *vcpu)
 {
-       if (!vcpu->sigset_active)
+       struct kvm_vcpu_common *common = vcpu->common;
+
+       if (!common->sigset_active)
                return;
 
        /*
@@ -3703,12 +3705,14 @@ void kvm_sigset_activate(struct kvm_vcpu *vcpu)
         * ->real_blocked don't care as long ->real_blocked is always a subset
         * of ->blocked.
         */
-       sigprocmask(SIG_SETMASK, &vcpu->sigset, &current->real_blocked);
+       sigprocmask(SIG_SETMASK, &common->sigset, &current->real_blocked);
 }
 
 void kvm_sigset_deactivate(struct kvm_vcpu *vcpu)
 {
-       if (!vcpu->sigset_active)
+       struct kvm_vcpu_common *common = vcpu->common;
+
+       if (!common->sigset_active)
                return;
 
        sigprocmask(SIG_SETMASK, &current->real_blocked, NULL);
@@ -4391,12 +4395,14 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, 
unsigned long id)
 
 static int kvm_vcpu_ioctl_set_sigmask(struct kvm_vcpu *vcpu, sigset_t *sigset)
 {
+       struct kvm_vcpu_common *common = vcpu->common;
+
        if (sigset) {
                sigdelsetmask(sigset, sigmask(SIGKILL)|sigmask(SIGSTOP));
-               vcpu->sigset_active = 1;
-               vcpu->sigset = *sigset;
+               common->sigset_active = 1;
+               common->sigset = *sigset;
        } else
-               vcpu->sigset_active = 0;
+               common->sigset_active = 0;
        return 0;
 }
 
-- 
2.53.0


Reply via email to