From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Liu Jinsong <jinsong.liu@alibaba-inc.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
xen-devel@lists.xen.org, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH 4/4] xenpm: Alow getting and setting the max sub C-State
Date: Wed, 18 Jun 2014 16:28:10 +0100 [thread overview]
Message-ID: <53A1B00A.2000900@citrix.com> (raw)
In-Reply-To: <1403103855-23080-5-git-send-email-ross.lagerwall@citrix.com>
On 18/06/14 16:04, Ross Lagerwall wrote:
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> tools/misc/xenpm.c | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
> index e43924c..25d8613 100644
> --- a/tools/misc/xenpm.c
> +++ b/tools/misc/xenpm.c
> @@ -64,6 +64,7 @@ void show_help(void)
> " set-vcpu-migration-delay <num> set scheduler vcpu migration delay in us\n"
> " get-vcpu-migration-delay get scheduler vcpu migration delay\n"
> " set-max-cstate <num> set the C-State limitation (<num> >= 0)\n"
> + " set-max-substate <num> set the sub C-State limitation (<num> >= 0)\n"
> " start [seconds] start collect Cx/Px statistics,\n"
> " output after CTRL-C or SIGINT or several seconds.\n"
> " enable-turbo-mode [cpuid] enable Turbo Mode for processors that support it.\n"
> @@ -188,7 +189,19 @@ static int show_max_cstate(xc_interface *xc_handle)
> if ( (ret = xc_get_cpuidle_max_cstate(xc_handle, &value)) )
> return ret;
>
> - printf("Max possible C-state: C%d\n\n", value);
> + printf("Max possible C-state: C%d\n", value);
> + return 0;
> +}
> +
> +static int show_max_substate(xc_interface *xc_handle)
> +{
> + int ret = 0;
> + uint32_t value;
> +
> + if ( (ret = xc_get_cpuidle_max_substate(xc_handle, &value)) )
> + return ret;
> +
> + printf("Max possible sub C-state: %d\n\n", value);
> return 0;
> }
>
> @@ -223,6 +236,7 @@ void cxstat_func(int argc, char *argv[])
> parse_cpuid(argv[0], &cpuid);
>
> show_max_cstate(xc_handle);
> + show_max_substate(xc_handle);
>
> if ( cpuid < 0 )
> {
> @@ -1088,6 +1102,23 @@ void set_max_cstate_func(int argc, char *argv[])
> value, errno, strerror(errno));
> }
>
> +void set_max_substate_func(int argc, char *argv[])
> +{
> + int value;
> +
> + if ( argc != 1 || sscanf(argv[0], "%d", &value) != 1 || value < 0 )
> + {
> + fprintf(stderr, "Missing or invalid argument(s)\n");
> + exit(EINVAL);
> + }
> +
> + if ( !xc_set_cpuidle_max_substate(xc_handle, (uint32_t)value) )
> + printf("set max_substate to %d succeeded\n", value);
> + else
> + fprintf(stderr, "set max_substate to %d failed (%d - %s)\n",
> + value, errno, strerror(errno));
> +}
> +
Please don't inherit the brokenness of set_max_cstate_func() for the
sake of copying it.
"value "should be unsigned all the way through, and you should use %u in
place of %d everywhere.
~Andrew
> void enable_turbo_mode(int argc, char *argv[])
> {
> int cpuid = -1;
> @@ -1154,6 +1185,7 @@ struct {
> { "get-vcpu-migration-delay", get_vcpu_migration_delay_func},
> { "set-vcpu-migration-delay", set_vcpu_migration_delay_func},
> { "set-max-cstate", set_max_cstate_func},
> + { "set-max-substate", set_max_substate_func},
> { "enable-turbo-mode", enable_turbo_mode },
> { "disable-turbo-mode", disable_turbo_mode },
> };
next prev parent reply other threads:[~2014-06-18 15:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 15:04 [PATCH 0/4] Support controlling the maximum sub C-State Ross Lagerwall
2014-06-18 15:04 ` [PATCH 1/4] x86/mwait_idle: Fix trace output Ross Lagerwall
2014-06-18 15:04 ` [PATCH 2/4] x86/mwait_idle: Allow limiting the sub C-state Ross Lagerwall
2014-06-18 15:23 ` Andrew Cooper
2014-06-18 15:51 ` Jan Beulich
2014-06-18 15:04 ` [PATCH 3/4] tools/libxc: Alow getting and setting the max sub C-State Ross Lagerwall
2014-06-18 15:16 ` Andrew Cooper
2014-06-18 16:00 ` Jan Beulich
2014-06-18 15:04 ` [PATCH 4/4] xenpm: " Ross Lagerwall
2014-06-18 15:28 ` Andrew Cooper [this message]
2014-06-18 15:16 ` [PATCH 0/4] Support controlling the maximum " Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A1B00A.2000900@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jinsong.liu@alibaba-inc.com \
--cc=keir@xen.org \
--cc=ross.lagerwall@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.