[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z62YNrvnJ9Dzw7GE@intel.com>
Date: Thu, 13 Feb 2025 14:59:02 +0800
From: Chao Gao <chao.gao@...el.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
CC: <pbonzini@...hat.com>, <seanjc@...gle.com>, <kvm@...r.kernel.org>,
<rick.p.edgecombe@...el.com>, <kai.huang@...el.com>,
<adrian.hunter@...el.com>, <reinette.chatre@...el.com>,
<xiaoyao.li@...el.com>, <tony.lindgren@...el.com>,
<isaku.yamahata@...el.com>, <yan.y.zhao@...el.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 03/17] KVM: VMX: Move posted interrupt delivery code
to common header
>+/*
>+ * Send interrupt to vcpu via posted interrupt way.
>+ * 1. If target vcpu is running(non-root mode), send posted interrupt
>+ * notification to vcpu and hardware will sync PIR to vIRR atomically.
This comment primarily describes what kvm_vcpu_trigger_posted_interrupt() does.
And, it is not entirely accurate, as it is not necessarily the "hardware" that
syncs PIR to vIRR (see case 2 & 3 in the comment in
kvm_vcpu_trigger_posted_interrupt()).
How about:
/*
* Post an interrupt to a vCPU's PIR and trigger the vCPU to process the
* interrupt if necessary.
*/
Other than that, the patch looks good to me
Reviewed-by: Chao Gao <chao.gao@...el.com>
>+ * 2. If target vcpu isn't running(root mode), kick it to pick up the
>+ * interrupt from PIR in next vmentry.
>+ */
>+static inline void __vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu,
>+ struct pi_desc *pi_desc, int vector)
>+{
>+ if (pi_test_and_set_pir(vector, pi_desc))
>+ return;
>+
>+ /* If a previous notification has sent the IPI, nothing to do. */
>+ if (pi_test_and_set_on(pi_desc))
>+ return;
>+
>+ /*
>+ * The implied barrier in pi_test_and_set_on() pairs with the smp_mb_*()
>+ * after setting vcpu->mode in vcpu_enter_guest(), thus the vCPU is
>+ * guaranteed to see PID.ON=1 and sync the PIR to IRR if triggering a
>+ * posted interrupt "fails" because vcpu->mode != IN_GUEST_MODE.
>+ */
>+ kvm_vcpu_trigger_posted_interrupt(vcpu, POSTED_INTR_VECTOR);
>+}
>+
Powered by blists - more mailing lists