* [PATCH 1/2] KVM: x86: Fix a comment inside kvm_vcpu_update_apicv()
2024-10-08 10:45 [PATCH 0/2] Fixup two comments Kai Huang
@ 2024-10-08 10:45 ` Kai Huang
2024-10-08 10:45 ` [PATCH 2/2] KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit() Kai Huang
2024-10-31 19:51 ` [PATCH 0/2] Fixup two comments Sean Christopherson
2 siblings, 0 replies; 5+ messages in thread
From: Kai Huang @ 2024-10-08 10:45 UTC (permalink / raw)
To: pbonzini, seanjc, kvm; +Cc: linux-kernel, Kai Huang
The sentence "... so that KVM can the AVIC doorbell to ..." doesn't have
a verb. Fix it.
After adding the verb 'use', that line exceeds 80 characters. Thus wrap
the 'to' to the next line.
Signed-off-by: Kai Huang <kai.huang@intel.com>
---
arch/x86/kvm/x86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 83fe0a78146f..afd70c274692 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10576,8 +10576,8 @@ static void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu)
* deleted if any vCPU has xAPIC virtualization and x2APIC enabled, but
* and hardware doesn't support x2APIC virtualization. E.g. some AMD
* CPUs support AVIC but not x2APIC. KVM still allows enabling AVIC in
- * this case so that KVM can the AVIC doorbell to inject interrupts to
- * running vCPUs, but KVM must not create SPTEs for the APIC base as
+ * this case so that KVM can use the AVIC doorbell to inject interrupts
+ * to running vCPUs, but KVM must not create SPTEs for the APIC base as
* the vCPU would incorrectly be able to access the vAPIC page via MMIO
* despite being in x2APIC mode. For simplicity, inhibiting the APIC
* access page is sticky.
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit()
2024-10-08 10:45 [PATCH 0/2] Fixup two comments Kai Huang
2024-10-08 10:45 ` [PATCH 1/2] KVM: x86: Fix a comment inside kvm_vcpu_update_apicv() Kai Huang
@ 2024-10-08 10:45 ` Kai Huang
2024-10-31 19:51 ` [PATCH 0/2] Fixup two comments Sean Christopherson
2 siblings, 0 replies; 5+ messages in thread
From: Kai Huang @ 2024-10-08 10:45 UTC (permalink / raw)
To: pbonzini, seanjc, kvm; +Cc: linux-kernel, Kai Huang
Change svm_vcpu_run() to vcpu_enter_guest() in the comment of
__kvm_set_or_clear_apicv_inhibit() to make it reflect the fact.
When one thread updates VM's APICv state due to updating the APICv
inhibit reasons, it kicks off all vCPUs and makes them wait until the
new reason has been updated and can be seen by all vCPUs.
There was one WARN() to make sure VM's APICv state is consistent with
vCPU's APICv state in the svm_vcpu_run(). Commit ee49a8932971 ("KVM:
x86: Move SVM's APICv sanity check to common x86") moved that WARN() to
x86 common code vcpu_enter_guest() due to the logic is not unique to
SVM, and added comments to both __kvm_set_or_clear_apicv_inhibit() and
vcpu_enter_guest() to explain this.
However, although the comment in __kvm_set_or_clear_apicv_inhibit()
mentioned the WARN(), it seems forgot to reflect that the WARN() had
been moved to x86 common, i.e., it still mentioned the svm_vcpu_run()
but not vcpu_enter_guest(). Fix it.
Note after the change the first line that contains vcpu_enter_guest()
exceeds 80 characters, but leave it as is to make the diff clean.
Fixes: ee49a8932971 ("KVM: x86: Move SVM's APICv sanity check to common x86")
Signed-off-by: Kai Huang <kai.huang@intel.com>
---
arch/x86/kvm/x86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index afd70c274692..7b347e564d10 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10606,11 +10606,11 @@ void __kvm_set_or_clear_apicv_inhibit(struct kvm *kvm,
if (!!old != !!new) {
/*
* Kick all vCPUs before setting apicv_inhibit_reasons to avoid
- * false positives in the sanity check WARN in svm_vcpu_run().
+ * false positives in the sanity check WARN in vcpu_enter_guest().
* This task will wait for all vCPUs to ack the kick IRQ before
* updating apicv_inhibit_reasons, and all other vCPUs will
* block on acquiring apicv_update_lock so that vCPUs can't
- * redo svm_vcpu_run() without seeing the new inhibit state.
+ * redo vcpu_enter_guest() without seeing the new inhibit state.
*
* Note, holding apicv_update_lock and taking it in the read
* side (handling the request) also prevents other vCPUs from
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] Fixup two comments
2024-10-08 10:45 [PATCH 0/2] Fixup two comments Kai Huang
2024-10-08 10:45 ` [PATCH 1/2] KVM: x86: Fix a comment inside kvm_vcpu_update_apicv() Kai Huang
2024-10-08 10:45 ` [PATCH 2/2] KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit() Kai Huang
@ 2024-10-31 19:51 ` Sean Christopherson
2024-11-01 19:25 ` Sean Christopherson
2 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2024-10-31 19:51 UTC (permalink / raw)
To: Sean Christopherson, pbonzini, kvm, Kai Huang; +Cc: linux-kernel
On Tue, 08 Oct 2024 23:45:12 +1300, Kai Huang wrote:
> Spotted two nit issues in two comments of the apicv code (if I got it
> right) which probably are worth fixing.
>
> Kai Huang (2):
> KVM: x86: Fix a comment inside kvm_vcpu_update_apicv()
> KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit()
>
> [...]
Applied to kvm-x86 misc, thanks!
[1/2] KVM: x86: Fix a comment inside kvm_vcpu_update_apicv()
https://github.com/kvm-x86/linux/commit/e9e1cb4d5502
[2/2] KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit()
https://github.com/kvm-x86/linux/commit/8eada24a8e83
--
https://github.com/kvm-x86/linux/tree/next
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] Fixup two comments
2024-10-31 19:51 ` [PATCH 0/2] Fixup two comments Sean Christopherson
@ 2024-11-01 19:25 ` Sean Christopherson
0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2024-11-01 19:25 UTC (permalink / raw)
To: pbonzini, kvm, Kai Huang; +Cc: linux-kernel
On Thu, Oct 31, 2024, Sean Christopherson wrote:
> On Tue, 08 Oct 2024 23:45:12 +1300, Kai Huang wrote:
> > Spotted two nit issues in two comments of the apicv code (if I got it
> > right) which probably are worth fixing.
> >
> > Kai Huang (2):
> > KVM: x86: Fix a comment inside kvm_vcpu_update_apicv()
> > KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit()
> >
> > [...]
>
> Applied to kvm-x86 misc, thanks!
>
> [1/2] KVM: x86: Fix a comment inside kvm_vcpu_update_apicv()
> https://github.com/kvm-x86/linux/commit/e9e1cb4d5502
> [2/2] KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit()
> https://github.com/kvm-x86/linux/commit/8eada24a8e83
FYI, I rebased misc to v6.12-rc5, as patches in another series had already been
taken through the tip tree. New hashes:
[1/2] KVM: x86: Fix a comment inside kvm_vcpu_update_apicv()
https://github.com/kvm-x86/linux/commit/ef86fe036d0a
[2/2] KVM: x86: Fix a comment inside __kvm_set_or_clear_apicv_inhibit()
https://github.com/kvm-x86/linux/commit/6e44d2427b70
^ permalink raw reply [flat|nested] 5+ messages in thread