tools/libxc: Reduce feature handling complexity in xc_cpuid_apply_policy()
PATCH 1/1 tools/libxc: Reduce feature handling complexity in xc_cpuid_apply_policy()
xc_cpuid_apply_policy() is gaining extra parameters to untangle CPUID complexity in Xen. While an improvement in general, it does have the unfortunate side effect of duplicating some settings across muliple parameters.
Rearrange the logic to only consider 'pae' if no explicit featureset is provided. This reduces the complexity for callers who have already provided a pae setting in the featureset.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Ian Jackson <[email protected]>
--- tools/libxc/include/xenctrl.h | 6 ++++++ tools/libxc/xc_cpuid_x86.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
tools/libxc/include/xenctrl.h +6 -0
@@ -1798,6 +1798,12 @@ int xc_cpuid_set(xc_interface *xch,const unsigned int *input, const char **config, char **config_transformed); +/* +* Make adjustments to the CPUID settings for a domain. +* +* Either pass a full new @featureset (and @nr_features), or adjust individual +* features (@pae). +*/ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, const uint32_t *featureset,
tools/libxc/xc_cpuid_x86.c +5 -2
@@ -532,6 +532,11 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,cpuid_featureset_to_policy (feat, p); } +else + { +if ( di.hvm ) + p->basic.pae = pae; + }if ( !di.hvm ) {
@@ -615,8 +620,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,break ; } - p->basic.pae = pae; -/* * These settings are necessary to cause earlier HVM_PARAM_NESTEDHVM / * XEN_DOMCTL_disable_migrate settings to be reflected correctly in
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of Andrew Cooper
Sent: 03 March 2020 18:23
To: Xen-devel <[email protected]>
Cc: Andrew Cooper <[email protected]>; Ian Jackson <[email protected]>; Wei Liu <[email protected]>; Jan Beulich <[email protected]>; Roger Pau Monné <[email protected]>
Subject: [Xen-devel] [PATCH]tools/libxc: Reduce feature handling complexity inxc_cpuid_apply_policy()
xc_cpuid_apply_policy()is gaining extra parameters to untangle CPUID complexity in Xen. While an improvement in general, it does have the unfortunate side effect of duplicating some settings across muliple parameters.
Quoted 5 lines
Rearrange the logic to only consider 'pae' if no explicit featureset is provided. This reduces the complexity for callers who have already provided a pae setting in the featureset.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Tools ping?
~Andrew
Quoted 62 lines · Andrew Cooper
xc_cpuid_apply_policy()is gaining extra parameters to untangle CPUID complexity in Xen. While an improvement in general, it does have the unfortunate side effect of duplicating some settings across muliple parameters.Rearrange the logic to only consider 'pae' if no explicit featureset is provided. This reduces the complexity for callers who have already provided a pae setting in the featureset.
Signed-off-by Andrew Cooper <[email protected]>---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Ian Jackson <[email protected]>--- tools/libxc/include/xenctrl.h | 6 ++++++ tools/libxc/xc_cpuid_x86.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-)tools/libxc/include/xenctrl.h +6
-0@@ -1798,6 +1798,12 @@ int xc_cpuid_set(xc_interface *xch,const unsigned int *input, const char **config, char **config_transformed); +/* +* Make adjustments to the CPUID settings for a domain. +* +* Either pass a full new @featureset (and @nr_features), or adjust individual +* features (@pae). +*/ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, const uint32_t *featureset,tools/libxc/xc_cpuid_x86.c +5
-2@@ -532,6 +532,11 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,cpuid_featureset_to_policy (feat, p); } +else + { +if ( di.hvm ) + p->basic.pae = pae; + }if ( !di.hvm ) {@@ -615,8 +620,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid,break ; } - p->basic.pae = pae; -/* * These settings are necessary to cause earlier HVM_PARAM_NESTEDHVM / * XEN_DOMCTL_disable_migrate settings to be reflected correctly in
Quoted 10 lines · Andrew Cooper
xc_cpuid_apply_policy()is gaining extra parameters to untangle CPUID complexity in Xen. While an improvement in general, it does have the unfortunate side effect of duplicating some settings across muliple parameters.Rearrange the logic to only consider 'pae' if no explicit featureset is provided. This reduces the complexity for callers who have already provided a pae setting in the featureset.
Signed-off-by Andrew Cooper <[email protected]>