From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 3/4] Update vcpu hotplug logic Date: Fri, 31 May 2013 17:16:10 -0400 Message-ID: <20130531211610.GC5362@phenom.dumpdata.com> References: <1370017993-13437-1-git-send-email-anthony.perard@citrix.com> <1370017993-13437-4-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1370017993-13437-4-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anthony PERARD Cc: "Liu, Jinsong" , Stefano Stabellini , Ian Jackson , Xen Devel List-Id: xen-devel@lists.xenproject.org On Fri, May 31, 2013 at 05:33:12PM +0100, Anthony PERARD wrote: > From: Ian Jackson > > Add vcpu online/offline check to avoid redundant SCI interrupt. > > Signed-off-by: Liu, Jinsong > > Port from qemu-xen-traditionnal to qemu-xen. > Signed-off-by: Anthony PERARD Reviewed-by: Konrad Rzeszutek Wilk .. some notes below. > --- > hw/acpi_piix4.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) > > diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c > index bc7b454..49c38d3 100644 > --- a/hw/acpi_piix4.c > +++ b/hw/acpi_piix4.c > @@ -706,16 +706,24 @@ static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, > return 0; > } > > -static void enable_processor(PIIX4PMState *g, int cpu) > +static int enable_processor(PIIX4PMState *g, int cpu) > { > + if (g->cpus_sts[cpu/8] & (1 << (cpu%8))) > + return 0; Don't know if the styleguide in QEME is at this point, but I thought that it was suppose to have space between the "/" and "%", so you have: if (g->cpus_sts[cpu / 8] & (1 << (cpu % 8))) ? > + > g->ar.gpe.sts[0] |= 4; > g->cpus_sts[cpu/8] |= (1 << (cpu%8)); > + return 1; > } > > -static void disable_processor(PIIX4PMState *g, int cpu) > +static int disable_processor(PIIX4PMState *g, int cpu) > { > + if (!(g->cpus_sts[cpu/8] & (1 << (cpu%8)))) > + return 0; > + > g->ar.gpe.sts[0] |= 4; > g->cpus_sts[cpu/8] &= ~(1 << (cpu%8)); > + return 1; > } > > void qemu_cpu_add_remove(int cpu, int state) > @@ -725,10 +733,15 @@ void qemu_cpu_add_remove(int cpu, int state) > return; > } > > - if (state) > - enable_processor(acpi_state, cpu); > - else > - disable_processor(acpi_state, cpu); > + if (state) { > + if (!enable_processor(acpi_state, cpu)) { > + return; > + } > + } else { > + if (!disable_processor(acpi_state, cpu)) { > + return; > + } > + } > > pm_update_sci(acpi_state); > } > -- > Anthony PERARD > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >