[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 13/14 RESEND] xenpm: Add set-cpufreq-hwp subcommand


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 May 2023 15:20:16 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JOMokPvjoGqxgL86YeDqkbzpLR6vssQObSPnnAiJB9s=; b=FUAuhGPBZQuZh6m6vVyriKuG9tVFE7oukReVHa0lcjvwW8iEeK/xBUL9O1/uYFpU/RgPYE7BAJImOTA9N0cvymuF2Cl2oo2cP9fbOFc0z2JPVVvRQJPQiH8odkKuYrV5UiWLsyYYFukJdJzQaqB4Q9sjOVPap5a3PQh02MW1a90nTgbvhnJ9P7MGd3hnA/PJbgcZeiM6dqv0dooCi5UimuvC7NSy0u6cI0eW6ZKMKbcEojnwFIjWw39J8gwbNGMK13CDVoC7s3JTC3le2Zc8URweGvWZ9c3X91+MvOP6zblv5kMedlPJpqwZx0F0lhabxYCud9pg9CbbKb21qzCaAg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ds+mSz9gDQ19aoiiZkw6Af6xNzx6tdtjDoiHulaQuHuNXEo9ZPLrQx/s6aE/OhB1WO2el986xu+KrTIh1+EkptJ31bWVMk0BUAin5gdMhwaFMbuVsapnKAXUZ84CiF4NUAoq8T46U/lSZfqILLPLitmeR8ujMSl3UgXJjPYqUCjOHyQUOAa0PIAaXCxujggaW6VJepigv77g5j0iK1KSPpUr+gun5Hkg9Y0SWYjdVeNb5Wplf0JEPI3kNK13i+9O+9vk9xvmeJtOXGIdIThbpZYsWZBrn82tjJXpZIapZwv92RM3gY8IVCdKjM2Mtho2dzA6HXIVz45GaeHUL2MmGQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 22 May 2023 13:21:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22.05.2023 14:59, Jason Andryuk wrote:
> On Mon, May 8, 2023 at 7:56 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 01.05.2023 21:30, Jason Andryuk wrote:
>>> +static int parse_hwp_opts(xc_set_hwp_para_t *set_hwp, int *cpuid,
>>> +                          int argc, char *argv[])
>>> +{
>>> +    int i = 0;
>>> +
>>> +    if ( argc < 1 ) {
>>> +        fprintf(stderr, "Missing arguments\n");
>>> +        return -1;
>>> +    }
>>> +
>>> +    if ( parse_cpuid_non_fatal(argv[i], cpuid) == 0 )
>>> +    {
>>> +        i++;
>>> +    }
>>
>> I don't think you need the earlier patch and the separate helper:
>> Whether a CPU number is present can be told by checking
>> isdigit(argv[i][0]).
> 
>> Hmm, yes, there is "all", but your help text doesn't mention it and
>> since you're handling a variable number of arguments anyway, there's
>> not need for anyone to say "all" - they can simply omit the optional
>> argument.
> 
> Most xenpm commands take "all" or a numeric cpuid, so I intended to be
> consistent with them.  That was the whole point of
> parse_cpuid_non_fatal() - to reuse the existing parsing code for
> consistency.
> 
> I didn't read the other help text carefully enough to see that the
> numeric cpuid and "all" handling was repeated.
> 
> For consistency, I would retain parse_cpuid_non_fatal() and expand the
> help text.  If you don't want that, I'll switch to isdigit(argv[i][0])
> and have the omission of a digit indicate all CPUs as you suggest.
> Just let me know what you want.

While I don't want to push you towards something you don't like yourself,
my view on the "all" has been "Why did they introduce that?" It makes
some sense when it's a placeholder to avoid needing to deal with a
variable number of arguments, but already that doesn't apply to all the
pre-existing operations. Note how many functions already have

    if ( argc > 0 )
        parse_cpuid(argv[0], &cpuid);

and {en,dis}able-turbo-mode don't properly mention "all" in their help
text either.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.