From: David Vrabel <david.vrabel@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>, konrad.wilk@oracle.com
Cc: kevin.tian@intel.com, dietmar.hahn@ts.fujitsu.com,
JBeulich@suse.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 2/6] xen/PMU: Sysfs interface for setting Xen PMU mode
Date: Tue, 10 Jun 2014 14:48:32 +0100 [thread overview]
Message-ID: <53970CB0.6030700@citrix.com> (raw)
In-Reply-To: <1402076686-26586-3-git-send-email-boris.ostrovsky@oracle.com>
On 06/06/14 18:44, Boris Ostrovsky wrote:
> Set Xen's PMU mode via /sys/hypervisor/pmu/pmu_mode. Add XENPMU hypercall.
sysfs files need documentation in Documentaton/ABI/
> --- a/drivers/xen/sys-hypervisor.c
> +++ b/drivers/xen/sys-hypervisor.c
> @@ -20,6 +20,7 @@
> #include <xen/xenbus.h>
> #include <xen/interface/xen.h>
> #include <xen/interface/version.h>
> +#include <xen/interface/xenpmu.h>
>
> #define HYPERVISOR_ATTR_RO(_name) \
> static struct hyp_sysfs_attr _name##_attr = __ATTR_RO(_name)
> @@ -368,6 +369,116 @@ static void xen_properties_destroy(void)
> sysfs_remove_group(hypervisor_kobj, &xen_properties_group);
> }
>
> +struct pmu_mode {
> + const char *name;
> + uint32_t mode;
> +};
> +
> +struct pmu_mode pmu_modes[] = {
> + {"enable", XENPMU_MODE_ON},
> + {"priv_enable", XENPMU_MODE_PRIV},
> + {"disable", 0}
> +};
If there a better, more description set of options here? How about:
"self", "all", "none"?
> +
> +static ssize_t pmu_mode_store(struct hyp_sysfs_attr *attr,
> + const char *buffer, size_t len)
> +{
> + int ret;
> + struct xen_pmu_params xp;
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(pmu_modes); i++) {
> + if (!strncmp(buffer, pmu_modes[i].name,
> + strlen(pmu_modes[i].name))) {
I prefer if (strncmp(...) == 0) as I find the use of the not operator
for a positive match confusing.
David
next prev parent reply other threads:[~2014-06-10 13:48 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 17:44 [PATCH v2 0/6] xen/PMU: PMU support for Xen PV guests Boris Ostrovsky
2014-06-06 17:44 ` [PATCH v2 1/6] xen: xensyms support Boris Ostrovsky
2014-06-10 13:31 ` David Vrabel
2014-06-10 14:49 ` Boris Ostrovsky
2014-06-10 14:51 ` Jan Beulich
2014-06-10 15:03 ` Boris Ostrovsky
2014-06-10 15:21 ` Jan Beulich
2014-06-10 15:45 ` Boris Ostrovsky
2014-06-10 16:13 ` Jan Beulich
2014-06-11 9:37 ` Dietmar Hahn
2014-06-06 17:44 ` [PATCH v2 2/6] xen/PMU: Sysfs interface for setting Xen PMU mode Boris Ostrovsky
2014-06-06 20:19 ` Konrad Rzeszutek Wilk
2014-06-10 13:33 ` David Vrabel
2014-06-10 13:48 ` David Vrabel [this message]
2014-06-10 14:52 ` Boris Ostrovsky
2014-06-11 10:13 ` Dietmar Hahn
2014-06-11 12:53 ` Boris Ostrovsky
2014-06-11 13:12 ` Dietmar Hahn
2014-06-06 17:44 ` [PATCH v2 3/6] xen/PMU: Initialization code for Xen PMU Boris Ostrovsky
2014-06-06 18:57 ` Andrew Cooper
2014-06-06 19:51 ` Boris Ostrovsky
2014-06-06 17:44 ` [PATCH v2 4/6] xen/PMU: Describe vendor-specific PMU registers Boris Ostrovsky
2014-06-10 14:11 ` David Vrabel
2014-06-10 15:29 ` Boris Ostrovsky
2014-06-06 17:44 ` [PATCH v2 5/6] xen/PMU: Intercept PMU-related MSR and APIC accesses Boris Ostrovsky
2014-06-12 6:56 ` Dietmar Hahn
2014-06-12 14:50 ` Boris Ostrovsky
2014-06-06 17:44 ` [PATCH v2 6/6] xen/PMU: PMU emulation code Boris Ostrovsky
2014-06-10 13:57 ` [PATCH v2 0/6] xen/PMU: PMU support for Xen PV guests David Vrabel
2014-06-10 15:27 ` Boris Ostrovsky
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=53970CB0.6030700@citrix.com \
--to=david.vrabel@citrix.com \
--cc=JBeulich@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dietmar.hahn@ts.fujitsu.com \
--cc=kevin.tian@intel.com \
--cc=konrad.wilk@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).