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

Re: [Xen-devel] [PATCH for-4.12] x86/vpmu: Improve documentation and parsing for vpmu=



>>> On 04.02.19 at 15:58, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 04/02/2019 14:44, Jan Beulich wrote:
>>>>> On 04.02.19 at 15:22, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> On 04/02/2019 13:53, Jan Beulich wrote:
>>>>>>> On 04.02.19 at 12:41, <andrew.cooper3@xxxxxxxxxx> wrote:
>>>>> @@ -64,37 +54,37 @@ static DEFINE_PER_CPU(struct vcpu *, last_vcpu);
>>>>>  static int __init parse_vpmu_params(const char *s)
>>>>>  {
>>>>>      const char *ss;
>>>>> +    int rc = 0, val;
>>>>> +
>>>>> +    do {
>>>>> +        ss = strchr(s, ',');
>>>>> +        if ( !ss )
>>>>> +            ss = strchr(s, '\0');
>>>>> +
>>>>> +        if ( (val = parse_bool(s, ss)) >= 0 )
>>>>> +            opt_vpmu_enabled = val;
>>>>> +        else if ( !cmdline_strcmp(s, "bts") )
>>>>> +            vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
>>>>> +        else if ( !cmdline_strcmp(s, "ipc") )
>>>>> +            vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
>>>>> +        else if ( !cmdline_strcmp(s, "arch") )
>>>>> +            vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
>>>>> +        else
>>>>> +            rc = -EINVAL;
>>>>>  
>>>>> -    switch ( parse_bool(s, NULL) )
>>>>> -    {
>>>>> -    case 0:
>>>>> -        break;
>>>>> -    default:
>>>>> -        do {
>>>>> -            ss = strchr(s, ',');
>>>>> -            if ( !ss )
>>>>> -                ss = strchr(s, '\0');
>>>>> -
>>>>> -            if ( !cmdline_strcmp(s, "bts") )
>>>>> -                vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
>>>>> -            else if ( !cmdline_strcmp(s, "ipc") )
>>>>> -                vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
>>>>> -            else if ( !cmdline_strcmp(s, "arch") )
>>>>> -                vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
>>>>> -            else
>>>>> -                return -EINVAL;
>>>>> +        s = ss + 1;
>>>>> +    } while ( *ss );
>>>>> +
>>>>> +    /* Selecting bts/ipc/arch forces vpmu to enabled. */
>>>>> +    if ( vpmu_features )
>>>>> +        opt_vpmu_enabled = true;
>>>> If you want to retain original behavior, the condition here would need
>>>> to be "!rc && vpmu_features". It's not clear whether your modification
>>>> in this regard is intentional.
>>> Oh - that wasn't intentional.
>>>
>>> An alternative, now I think about it, is to just have the <bool>=false
>>> case clear vpmu_features.  This is new behaviour, but it is more
>>> consistent with how other options work, and it wasn't expressable before.
>> Generally - yes. But what would e.g. "vpmu=off,ipc" end up doing in
>> your new model?
> 
> The use of vpmu_features is somewhat weird.  "bts" acts as an extra
> feature on top of "generally on", whereas "ipc" and "arch" act as
> restrictions on top of "generally on".

Okay let's go that route then.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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