On 04/02/2019 14:44, Jan Beulich wrote: >>>> On 04.02.19 at 15:22, <andrew.coop...@citrix.com> wrote: >> On 04/02/2019 13:53, Jan Beulich wrote: >>>>>> On 04.02.19 at 12:41, <andrew.coop...@citrix.com> 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". I'd expect "vpmu=off,ipc" to imply "vpmu=off,ipc,on", and result in opt_vpmu_enabled=1 and vpmu_features=ipc. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel