From: "Jan Beulich" Subject: Re: [PATCH v2 3/4] tools/libxc: Alow controlling the max C-state sub-state Date: Fri, 20 Jun 2014 15:41:23 +0100 Message-ID: <53A46433020000780001C09E@mail.emea.novell.com> References: <1403176609-13208-1-git-send-email-ross.lagerwall@citrix.com> <1403176609-13208-4-git-send-email-ross.lagerwall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1403176609-13208-4-git-send-email-ross.lagerwall@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ross Lagerwall Cc: Keir Fraser , Ian Campbell , Stefano Stabellini , Liu Jinsong , Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 19.06.14 at 13:16, wrote: > --- a/xen/drivers/acpi/pmstat.c > +++ b/xen/drivers/acpi/pmstat.c > @@ -465,13 +465,17 @@ int do_pm_op(struct xen_sysctl_pm_op *op) > > case XEN_SYSCTL_pm_op_get_max_cstate: > { > - op->u.get_max_cstate = acpi_get_cstate_limit(); > + op->u.get_max_cstate = op->cpuid == 0 ? > + acpi_get_cstate_limit() : acpi_get_csubstate_limit(); > break; > } > > case XEN_SYSCTL_pm_op_set_max_cstate: > { > - acpi_set_cstate_limit(op->u.set_max_cstate); > + if ( op->cpuid == 0 ) > + acpi_set_cstate_limit(op->u.set_max_cstate); > + else > + acpi_set_csubstate_limit(op->u.set_max_cstate); > break; > } > Please properly distinguish ->cpuid being zero, one, or anything else (so that other values can be given a meaning later). Also with 0 and 1 now being valid, I think you need to adjust handling further up in the function, so that even when running with just a single CPU (which admittedly should be rare these days) things work correctly. And finally, I guess you ought to still add a note to the public header briefly describing the new behavior. Jan