Re: [Xen-devel] [PATCH 3/9] x86/cpuid: Extend the cpuid= command line option to support all named features

2018-12-06 Thread Wei Liu
On Mon, Dec 03, 2018 at 04:18:16PM +, Andrew Cooper wrote:
> For gen-cpuid.py, fix a comment describing self.names, and generate the
> reverse mapping in self.values.  Write out INIT_FEATURE_NAMES which maps a
> string name to a bit position.
> 
> For parse_cpuid(), introduce a slightly fuzzy strcmp() to accept changes in
> punctuation, and perform a binary search over INIT_FEATURE_NAMES.
> 
> Signed-off-by: Andrew Cooper 
> ---
> CC: Jan Beulich 
> CC: Wei Liu 
> CC: Roger Pau Monné 
> 
> Slightly RFC, because I'm not entirely certain if this is a good idea or not.
> ---
>  xen/arch/x86/cpuid.c   | 91 
> --
>  xen/tools/gen-cpuid.py | 22 ++--
>  2 files changed, 86 insertions(+), 27 deletions(-)
> 
> diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
> index 0591a7d..eb86a86 100644
> --- a/xen/arch/x86/cpuid.c
> +++ b/xen/arch/x86/cpuid.c
> @@ -18,9 +18,34 @@ static const uint32_t hvm_shadow_featuremask[] = 
> INIT_HVM_SHADOW_FEATURES;
>  static const uint32_t hvm_hap_featuremask[] = INIT_HVM_HAP_FEATURES;
>  static const uint32_t deep_features[] = INIT_DEEP_FEATURES;
>  
> +/*
> + * Works like strcmp(), but customised specifically for this usecase.  'name'
> + * is a NUL terminated string.  's' is considered to match 'name' if the NUL
> + * terminator of 'name' match punctiation in 's'.

"punctuation".

Wei.

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

Re: [Xen-devel] [PATCH 3/9] x86/cpuid: Extend the cpuid= command line option to support all named features

2018-12-04 Thread Jan Beulich
>>> On 03.12.18 at 17:18,  wrote:
> For gen-cpuid.py, fix a comment describing self.names, and generate the
> reverse mapping in self.values.  Write out INIT_FEATURE_NAMES which maps a
> string name to a bit position.
> 
> For parse_cpuid(), introduce a slightly fuzzy strcmp() to accept changes in
> punctuation, and perform a binary search over INIT_FEATURE_NAMES.
> 
> Signed-off-by: Andrew Cooper 
> ---
> CC: Jan Beulich 
> CC: Wei Liu 
> CC: Roger Pau Monné 
> 
> Slightly RFC, because I'm not entirely certain if this is a good idea or 
> not.

It is a good idea, but precautions are needed against attempts
to disable features we rely on (specifically ones inferred from us
running in 64-bit mode), or guests would equally rely on. I'm
therefore unsure whether the mere "named" fact for a feature
is a suitable criteria to allow its disabling from the command line.
Perhaps a second form of annotation in the public header is
needed? Or some minimal feature set to enforce?

Jan


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