From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v3 2/2] kvm: x86: Deliver MSI IRQ to only lowest prio cpu if msi_redir_hint is true Date: Tue, 17 Mar 2015 15:18:35 +0100 Message-ID: <20150317141835.GA2103@potion.brq.redhat.com> References: <1426555822-3280-1-git-send-email-sullivan.james.f@gmail.com> <1426555822-3280-3-git-send-email-sullivan.james.f@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, gleb@kernel.org, pbonzini@redhat.com To: James Sullivan Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54398 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932442AbbCQOSl (ORCPT ); Tue, 17 Mar 2015 10:18:41 -0400 Content-Disposition: inline In-Reply-To: <1426555822-3280-3-git-send-email-sullivan.james.f@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 2015-03-16 19:30-0600, James Sullivan: > An MSI interrupt should only be delivered to the lowest priority CPU > when it has RH=3D1, regardless of the delivery mode. Modified > kvm_is_dm_lowest_prio() to check for either irq->delivery_mode =3D=3D= APIC_DM_LOWPRI > or irq->msi_redir_hint. >=20 > Moved kvm_is_dm_lowest_prio() into lapic.h and renamed to > kvm_lowest_prio_delivery(). >=20 > Changed a check in kvm_irq_delivery_to_apic_fast() from > irq->delivery_mode =3D=3D APIC_DM_LOWPRI to kvm_is_dm_lowest_prio(). >=20 > Signed-off-by: James Sullivan > --- Reviewed-by: Radim Kr=C4=8Dm=C3=A1=C5=99 > diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c > @@ -31,6 +31,8 @@ > #include "ioapic.h" > =20 > +#include "lapic.h" > + (No need for the empty line between them.) > diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c > @@ -701,8 +701,7 @@ bool kvm_irq_delivery_to_apic_fast(struct kvm *kv= m, struct kvm_lapic *src, > dst =3D map->logical_map[cid]; > =20 > bitmap =3D apic_logical_id(map, mda); > - (It's polite to preserve blank lines.) > - if (irq->delivery_mode =3D=3D APIC_DM_LOWEST) { > + if (kvm_lowest_prio_delivery(irq)) { lapic.c does not directly include lapic.h, (gets pulled via irq.h) it would be nicer to fix it here, but can also be done later ... > diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h > @@ -168,6 +168,12 @@ static inline bool kvm_apic_has_events(struct kv= m_vcpu *vcpu) > +static inline bool kvm_lowest_prio_delivery(struct kvm_lapic_irq *ir= q) > +{ > + return (irq->delivery_mode =3D=3D APIC_DM_LOWEST || > + irq->msi_redir_hint); (These parentheses improve readability?)