From: "Jan Beulich" Subject: [PATCH] cpufreq: allow ordinary boolean options to be passed on the command line Date: Fri, 30 Oct 2015 11:49:15 -0600 Message-ID: <5633BBAB02000078000B0617@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part2B1C438B.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZsDni-0006vB-Ca for xen-devel@lists.xenproject.org; Fri, 30 Oct 2015 17:49:18 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Jinsong Liu List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part2B1C438B.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I was quite surprised to find "cpufreq=3Doff" 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. =20 ### cpufreq -> `=3D dom0-kernel | none | xen[,[powersave|performance|ondemand|userspace= ][,][,[][,[verbose]]]]` +> `=3D none | {{ | xen } [:[powersave|performance|ondemand|users= pace][,][,[][,[verbose]]]]} | dom0-kernel` =20 > Default: `xen` =20 -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. =20 * 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 =20 static void __init setup_cpufreq_option(char *str) { - char *arg; + char *arg =3D strpbrk(str, ",:"); + int choice; =20 - if ( !strcmp(str, "dom0-kernel") ) + if ( arg ) + *arg++ =3D '\0'; + choice =3D parse_bool(str); + + if ( choice < 0 && !strcmp(str, "dom0-kernel") ) { xen_processor_pmbits &=3D ~XEN_PROCESSOR_PM_PX; cpufreq_controller =3D FREQCTL_dom0_kernel; @@ -74,19 +79,20 @@ static void __init setup_cpufreq_option( return; } =20 - if ( !strcmp(str, "none") ) + if ( choice =3D=3D 0 || !strcmp(str, "none") ) { xen_processor_pmbits &=3D ~XEN_PROCESSOR_PM_PX; cpufreq_controller =3D FREQCTL_none; return; } =20 - if ( (arg =3D strpbrk(str, ",:")) !=3D NULL ) - *arg++ =3D '\0'; - - if ( !strcmp(str, "xen") ) + if ( choice > 0 || !strcmp(str, "xen") ) + { + xen_processor_pmbits |=3D XEN_PROCESSOR_PM_PX; + cpufreq_controller =3D FREQCTL_xen; if ( arg && *arg ) cpufreq_cmdline_parse(arg); + } } custom_param("cpufreq", setup_cpufreq_option); =20 --=__Part2B1C438B.1__= Content-Type: text/plain; name="cpufreq-cmdline-allow-bool.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cpufreq-cmdline-allow-bool.patch" cpufreq: allow ordinary boolean options to be passed on the command = line=0A=0AI was quite surprised to find "cpufreq=3Doff" not doing what one = would=0Aexpect it to do. Fix this.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/docs/misc/xen-command-line.markdown=0A+++ = b/docs/misc/xen-command-line.markdown=0A@@ -391,11 +391,12 @@ If set, = force use of the performance cou=0A available support.=0A =0A ### = cpufreq=0A-> `=3D dom0-kernel | none | xen[,[powersave|performance|ondemand= |userspace][,][,[][,[verbose]]]]`=0A+> `=3D none | {{ = | xen } [:[powersave|performance|ondemand|userspace][,][= ,[][,[verbose]]]]} | dom0-kernel`=0A =0A > Default: `xen`=0A = =0A-Indicate where the responsibility for driving power states lies.=0A+Ind= icate where the responsibility for driving power states lies. Note that = the=0A+choice of `dom0-kernel` is deprecated and not supported by all Dom0 = kernels.=0A =0A * Default governor policy is ondemand.=0A * `` = and `` are integers which represent max and min processor = frequencies=0A--- a/xen/drivers/cpufreq/cpufreq.c=0A+++ b/xen/drivers/cpufr= eq/cpufreq.c=0A@@ -64,9 +64,14 @@ enum cpufreq_controller cpufreq_controll= =0A =0A static void __init setup_cpufreq_option(char *str)=0A {=0A- = char *arg;=0A+ char *arg =3D strpbrk(str, ",:");=0A+ int choice;=0A = =0A- if ( !strcmp(str, "dom0-kernel") )=0A+ if ( arg )=0A+ = *arg++ =3D '\0';=0A+ choice =3D parse_bool(str);=0A+=0A+ if ( choice = < 0 && !strcmp(str, "dom0-kernel") )=0A {=0A xen_processor_pmbi= ts &=3D ~XEN_PROCESSOR_PM_PX;=0A cpufreq_controller =3D FREQCTL_dom= 0_kernel;=0A@@ -74,19 +79,20 @@ static void __init setup_cpufreq_option(=0A= return;=0A }=0A =0A- if ( !strcmp(str, "none") )=0A+ if = ( choice =3D=3D 0 || !strcmp(str, "none") )=0A {=0A xen_process= or_pmbits &=3D ~XEN_PROCESSOR_PM_PX;=0A cpufreq_controller =3D = FREQCTL_none;=0A return;=0A }=0A =0A- if ( (arg =3D = strpbrk(str, ",:")) !=3D NULL )=0A- *arg++ =3D '\0';=0A-=0A- if = ( !strcmp(str, "xen") )=0A+ if ( choice > 0 || !strcmp(str, "xen") = )=0A+ {=0A+ xen_processor_pmbits |=3D XEN_PROCESSOR_PM_PX;=0A+ = cpufreq_controller =3D FREQCTL_xen;=0A if ( arg && *arg )=0A = cpufreq_cmdline_parse(arg);=0A+ }=0A }=0A custom_param("cpufr= eq", setup_cpufreq_option);=0A =0A --=__Part2B1C438B.1__= 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 --=__Part2B1C438B.1__=--