From: Marcelo Tosatti Subject: Re: [PATCH 04/12] IOAPIC timer interrupt redirect. Date: Wed, 2 Dec 2009 03:03:26 -0200 Message-ID: <20091202050326.GB21575@amt.cnet> References: <1259678201-11203-1-git-send-email-clalance@redhat.com> <1259678201-11203-5-git-send-email-clalance@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Chris Lalancette Return-path: Received: from mx1.redhat.com ([209.132.183.28]:5823 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055AbZLBFOb (ORCPT ); Wed, 2 Dec 2009 00:14:31 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB25EcUf013781 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Dec 2009 00:14:38 -0500 Content-Disposition: inline In-Reply-To: <1259678201-11203-5-git-send-email-clalance@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Dec 01, 2009 at 03:36:33PM +0100, Chris Lalancette wrote: > Only redirect IRQ 0 (i.e. timer interrupt) to the BSP if > the APIC destination is multiple vcpus. > > Signed-off-by: Chris Lalancette > --- > virt/kvm/ioapic.c | 15 +++++++++++++-- > 1 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c > index 53f3166..fd52949 100644 > --- a/virt/kvm/ioapic.c > +++ b/virt/kvm/ioapic.c > @@ -144,6 +144,15 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val) > } > } > > +static int ioapic_dest_multiple_cpus(struct kvm_lapic_irq *irqe) > +{ > + /* physical mode is always directed to 1 cpu */ > + if (irqe->dest_mode == 0 || irqe->dest_id == 0) > + return 0; > + > + return hweight_long(irqe->dest_id) != 1; > +} A single ID can have more than one bit set :( Better limit the override to delivery mode lowest priority (001).