lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YLtRQ/uYQoVbve0v@google.com>
Date:   Sat, 5 Jun 2021 19:26:11 +0900
From:   Sergey Senozhatsky <senozhatsky@...omium.org>
To:     Marc Zyngier <maz@...nel.org>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Suleiman Souhlal <suleiman@...gle.com>, x86@...nel.org,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 2/2] kvm: x86: implement KVM PM-notifier

On (21/06/05 11:15), Marc Zyngier wrote:
> > For the time being kvm_set_guest_paused() errors out when
> > !vcpu->arch.pv_time_enabled, but this probably can change in the
> > future (who knows?).  So shall I check vcpu->arch.pv_time_enabled in
> > kvm_arch_suspend_notifier()?
> 
> That, or check for the -EINVAL return value.

I suppose this should do the trick then (hate to do `int ret = 0`,
but we can have no VCPUs with enabled pv_time)

---

+static int kvm_arch_suspend_notifier(struct kvm *kvm)
+{
+       struct kvm_vcpu *vcpu;
+       int i, ret = 0;
+
+       mutex_lock(&kvm->lock);
+       kvm_for_each_vcpu(i, vcpu, kvm) {
+               if (!vcpu->arch.pv_time_enabled)
+                       continue;
+
+               ret = kvm_set_guest_paused(vcpu);
+               if (ret) {
+                       pr_err("Failed to pause guest VCPU%d: %d\n",
+                              vcpu->vcpu_id, ret);
+                       break;
+               }
+       }
+       mutex_unlock(&kvm->lock);
+
+       return ret ? NOTIFY_BAD : NOTIFY_DONE;
+}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ