x86/vpmu: Improve documentation and parsing for vpmu=
Quoted 59 lines · Jan Beulich
Quoted 59 lines
Quoted 1 line
Quoted 1 line · On 04.02.19 at 15:58, <[email protected]> wrote:
Quoted 57 lines · Jan Beulich
Quoted 57 lines
Quoted 1 line
Quoted 1 line · On 04.02.19 at 15:22, <[email protected]> wrote:
Quoted 42 lines · Jan Beulich
Quoted 42 lines
Quoted 1 line
Quoted 1 line · On 04.02.19 at 12:41, <[email protected]> wrote:
(quoted diff) +18
-18@@ -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;Quoted 8 lines
Review static DEFINE_PER_CPU(struct vcpu *, last_vcpu); · line 80
Quoted 5 lines
(quoted diff) +5
-0+ } 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.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Generally - yes. But what would e.g. "vpmu=off,ipc" end up doing in your new model?
The use of
vpmu_featuresis 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.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel