* [PATCH v3] KVM: X86: Filter out the broadcast dest for IPI fastpath
@ 2020-04-02 8:20 Wanpeng Li
2020-04-07 12:34 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Wanpeng Li @ 2020-04-02 8:20 UTC (permalink / raw)
To: linux-kernel, kvm
Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel
From: Wanpeng Li <wanpengli@tencent.com>
Except destination shorthand, a destination value 0xffffffff is used to
broadcast interrupts, let's also filter out this for single target IPI
fastpath.
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
v1 -> v2:
* update subject and patch description
arch/x86/kvm/lapic.c | 3 ---
arch/x86/kvm/lapic.h | 3 +++
arch/x86/kvm/x86.c | 3 ++-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index e24d405..d528bed 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -59,9 +59,6 @@
#define MAX_APIC_VECTOR 256
#define APIC_VECTORS_PER_REG 32
-#define APIC_BROADCAST 0xFF
-#define X2APIC_BROADCAST 0xFFFFFFFFul
-
static bool lapic_timer_advance_dynamic __read_mostly;
#define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 /* clock cycles */
#define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000 /* clock cycles */
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
index bc76860..25b77a6 100644
--- a/arch/x86/kvm/lapic.h
+++ b/arch/x86/kvm/lapic.h
@@ -17,6 +17,9 @@
#define APIC_BUS_CYCLE_NS 1
#define APIC_BUS_FREQUENCY (1000000000ULL / APIC_BUS_CYCLE_NS)
+#define APIC_BROADCAST 0xFF
+#define X2APIC_BROADCAST 0xFFFFFFFFul
+
enum lapic_mode {
LAPIC_MODE_DISABLED = 0,
LAPIC_MODE_INVALID = X2APIC_ENABLE,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5e95950..5a645df 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1559,7 +1559,8 @@ static int handle_fastpath_set_x2apic_icr_irqoff(struct kvm_vcpu *vcpu, u64 data
if (((data & APIC_SHORT_MASK) == APIC_DEST_NOSHORT) &&
((data & APIC_DEST_MASK) == APIC_DEST_PHYSICAL) &&
- ((data & APIC_MODE_MASK) == APIC_DM_FIXED)) {
+ ((data & APIC_MODE_MASK) == APIC_DM_FIXED) &&
+ ((u32)(data >> 32) != X2APIC_BROADCAST)) {
data &= ~(1 << 12);
kvm_apic_send_ipi(vcpu->arch.apic, (u32)data, (u32)(data >> 32));
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] KVM: X86: Filter out the broadcast dest for IPI fastpath
2020-04-02 8:20 [PATCH v3] KVM: X86: Filter out the broadcast dest for IPI fastpath Wanpeng Li
@ 2020-04-07 12:34 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-04-07 12:34 UTC (permalink / raw)
To: Wanpeng Li, linux-kernel, kvm
Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
Joerg Roedel
On 02/04/20 10:20, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> Except destination shorthand, a destination value 0xffffffff is used to
> broadcast interrupts, let's also filter out this for single target IPI
> fastpath.
>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
> v1 -> v2:
> * update subject and patch description
>
> arch/x86/kvm/lapic.c | 3 ---
> arch/x86/kvm/lapic.h | 3 +++
> arch/x86/kvm/x86.c | 3 ++-
> 3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index e24d405..d528bed 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -59,9 +59,6 @@
> #define MAX_APIC_VECTOR 256
> #define APIC_VECTORS_PER_REG 32
>
> -#define APIC_BROADCAST 0xFF
> -#define X2APIC_BROADCAST 0xFFFFFFFFul
> -
> static bool lapic_timer_advance_dynamic __read_mostly;
> #define LAPIC_TIMER_ADVANCE_ADJUST_MIN 100 /* clock cycles */
> #define LAPIC_TIMER_ADVANCE_ADJUST_MAX 10000 /* clock cycles */
> diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
> index bc76860..25b77a6 100644
> --- a/arch/x86/kvm/lapic.h
> +++ b/arch/x86/kvm/lapic.h
> @@ -17,6 +17,9 @@
> #define APIC_BUS_CYCLE_NS 1
> #define APIC_BUS_FREQUENCY (1000000000ULL / APIC_BUS_CYCLE_NS)
>
> +#define APIC_BROADCAST 0xFF
> +#define X2APIC_BROADCAST 0xFFFFFFFFul
> +
> enum lapic_mode {
> LAPIC_MODE_DISABLED = 0,
> LAPIC_MODE_INVALID = X2APIC_ENABLE,
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 5e95950..5a645df 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1559,7 +1559,8 @@ static int handle_fastpath_set_x2apic_icr_irqoff(struct kvm_vcpu *vcpu, u64 data
>
> if (((data & APIC_SHORT_MASK) == APIC_DEST_NOSHORT) &&
> ((data & APIC_DEST_MASK) == APIC_DEST_PHYSICAL) &&
> - ((data & APIC_MODE_MASK) == APIC_DM_FIXED)) {
> + ((data & APIC_MODE_MASK) == APIC_DM_FIXED) &&
> + ((u32)(data >> 32) != X2APIC_BROADCAST)) {
>
> data &= ~(1 << 12);
> kvm_apic_send_ipi(vcpu->arch.apic, (u32)data, (u32)(data >> 32));
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-07 12:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-02 8:20 [PATCH v3] KVM: X86: Filter out the broadcast dest for IPI fastpath Wanpeng Li
2020-04-07 12:34 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).