From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH v3 2/6] xen/PMU: Sysfs interface for setting Xen PMU mode Date: Mon, 7 Jul 2014 15:03:38 +0100 Message-ID: <53BAA8BA.7060108@citrix.com> References: <1404414899-1773-1-git-send-email-boris.ostrovsky@oracle.com> <1404414899-1773-3-git-send-email-boris.ostrovsky@oracle.com> <53B681AE.1070108@citrix.com> <53BAA8D6.8020205@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53BAA8D6.8020205@oracle.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: Boris Ostrovsky , konrad.wilk@oracle.com Cc: andrew.cooper3@citrix.com, kevin.tian@intel.com, dietmar.hahn@ts.fujitsu.com, jbeulich@suse.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 07/07/14 15:04, Boris Ostrovsky wrote: > On 07/04/2014 06:27 AM, David Vrabel wrote: >> On 03/07/14 20:14, Boris Ostrovsky wrote: >>> Set Xen's PMU mode via /sys/hypervisor/pmu/pmu_mode. Add XENPMU >>> hypercall. >>> >> [...] >>> +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)) == 0) { >>> + xp.val = pmu_modes[i].mode; >>> + break; >>> + } >>> + } >> This looks like it would accept "office" as "off" (etc) which I don't >> think it is what we want. I assume the intention is to allow either >> "off\n" or "off"? > > Yes, I should make this check more precise. There's an existing strim() helper that might be useful. David