From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] cpufreq: allow ordinary boolean options to be passed on the command line Date: Fri, 30 Oct 2015 19:22:22 +0000 Message-ID: <5633C36E.7040508@citrix.com> References: <5633BBAB02000078000B0617@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2048540198780889163==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZsFFz-0003Aa-7L for xen-devel@lists.xenproject.org; Fri, 30 Oct 2015 19:22:35 +0000 In-Reply-To: <5633BBAB02000078000B0617@prv-mh.provo.novell.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: Jan Beulich , xen-devel Cc: Jinsong Liu List-Id: xen-devel@lists.xenproject.org --===============2048540198780889163== Content-Type: multipart/alternative; boundary="------------020605040703000702020304" --------------020605040703000702020304 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit On 30/10/15 17:49, Jan Beulich wrote: > I was quite surprised to find "cpufreq=off" not doing what one would > expect it to do. Fix this. > > Signed-off-by: Jan Beulich > > --- a/docs/misc/xen-command-line.markdown > +++ b/docs/misc/xen-command-line.markdown > @@ -391,11 +391,12 @@ If set, force use of the performance cou > available support. > > ### cpufreq > -> `= dom0-kernel | none | xen[,[powersave|performance|ondemand|userspace][,][,[][,[verbose]]]]` > +> `= none | {{ | xen } [:[powersave|performance|ondemand|userspace][,][,[][,[verbose]]]]} | dom0-kernel` If I am reading the parsing correctly below, the insertion if ':' is to match the previous behaviour? (or have I missed something?) ~Andrew > > > Default: `xen` > > -Indicate where the responsibility for driving power states lies. > +Indicate where the responsibility for driving power states lies. Note that the > +choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels. > > * Default governor policy is ondemand. > * `` and `` are integers which represent max and min processor frequencies > --- a/xen/drivers/cpufreq/cpufreq.c > +++ b/xen/drivers/cpufreq/cpufreq.c > @@ -64,9 +64,14 @@ enum cpufreq_controller cpufreq_controll > > static void __init setup_cpufreq_option(char *str) > { > - char *arg; > + char *arg = strpbrk(str, ",:"); > + int choice; > > - if ( !strcmp(str, "dom0-kernel") ) > + if ( arg ) > + *arg++ = '\0'; > + choice = parse_bool(str); > + > + if ( choice < 0 && !strcmp(str, "dom0-kernel") ) > { > xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX; > cpufreq_controller = FREQCTL_dom0_kernel; > @@ -74,19 +79,20 @@ static void __init setup_cpufreq_option( > return; > } > > - if ( !strcmp(str, "none") ) > + if ( choice == 0 || !strcmp(str, "none") ) > { > xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX; > cpufreq_controller = FREQCTL_none; > return; > } > > - if ( (arg = strpbrk(str, ",:")) != NULL ) > - *arg++ = '\0'; > - > - if ( !strcmp(str, "xen") ) > + if ( choice > 0 || !strcmp(str, "xen") ) > + { > + xen_processor_pmbits |= XEN_PROCESSOR_PM_PX; > + cpufreq_controller = FREQCTL_xen; > if ( arg && *arg ) > cpufreq_cmdline_parse(arg); > + } > } > custom_param("cpufreq", setup_cpufreq_option); > > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------020605040703000702020304 Content-Type: text/html; charset="windows-1252" Content-Transfer-Encoding: 7bit
On 30/10/15 17:49, Jan Beulich wrote:
I was quite surprised to find "cpufreq=off" not doing what one would
expect it to do. Fix this.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -391,11 +391,12 @@ If set, force use of the performance cou
 available support.
 
 ### cpufreq
-> `= dom0-kernel | none | xen[,[powersave|performance|ondemand|userspace][,<maxfreq>][,[<minfreq>][,[verbose]]]]`
+> `= none | {{ <boolean> | xen } [:[powersave|performance|ondemand|userspace][,<maxfreq>][,[<minfreq>][,[verbose]]]]} | dom0-kernel`

If I am reading the parsing correctly below, the insertion if ':' is to match the previous behaviour? (or have I missed something?)

~Andrew

 
 > Default: `xen`
 
-Indicate where the responsibility for driving power states lies.
+Indicate where the responsibility for driving power states lies.  Note that the
+choice of `dom0-kernel` is deprecated and not supported by all Dom0 kernels.
 
 * Default governor policy is ondemand.
 * `<maxfreq>` and `<minfreq>` are integers which represent max and min processor frequencies
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -64,9 +64,14 @@ enum cpufreq_controller cpufreq_controll
 
 static void __init setup_cpufreq_option(char *str)
 {
-    char *arg;
+    char *arg = strpbrk(str, ",:");
+    int choice;
 
-    if ( !strcmp(str, "dom0-kernel") )
+    if ( arg )
+        *arg++ = '\0';
+    choice = parse_bool(str);
+
+    if ( choice < 0 && !strcmp(str, "dom0-kernel") )
     {
         xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX;
         cpufreq_controller = FREQCTL_dom0_kernel;
@@ -74,19 +79,20 @@ static void __init setup_cpufreq_option(
         return;
     }
 
-    if ( !strcmp(str, "none") )
+    if ( choice == 0 || !strcmp(str, "none") )
     {
         xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX;
         cpufreq_controller = FREQCTL_none;
         return;
     }
 
-    if ( (arg = strpbrk(str, ",:")) != NULL )
-        *arg++ = '\0';
-
-    if ( !strcmp(str, "xen") )
+    if ( choice > 0 || !strcmp(str, "xen") )
+    {
+        xen_processor_pmbits |= XEN_PROCESSOR_PM_PX;
+        cpufreq_controller = FREQCTL_xen;
         if ( arg && *arg )
             cpufreq_cmdline_parse(arg);
+    }
 }
 custom_param("cpufreq", setup_cpufreq_option);
 





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

--------------020605040703000702020304-- --===============2048540198780889163== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============2048540198780889163==--