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

Re: [Xen-devel] [PATCH RFC 14/31] tools/libxc: Use featureset rather than guesswork



On Wed, 2015-12-16 at 21:24 +0000, Andrew Cooper wrote:
> It is conceptually wrong to base a VM's featureset on the features
> visible to
> the toolstack which happens to construct it.
> 
> Instead, the featureset used is either an explicit one passed by the
> toolstack, or the default which Xen believes it can give to the guest.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> Âtools/libxc/xc_cpuid_x86.c | 229 +++++++++++++------------------------
> --------
> Â1 file changed, 64 insertions(+), 165 deletions(-)
> 
> diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
> index 8bd3126..3f39306 100644
> --- a/tools/libxc/xc_cpuid_x86.c
> +++ b/tools/libxc/xc_cpuid_x86.c
> @@ -24,6 +24,7 @@
> Â#include "xc_private.h"
> Â#include <xen/arch-x86/featureset.h>
> Â#include <xen/hvm/params.h>
> +#include <xen/sysctl.h>
> Â
> Â#define bitmaskof(idx)ÂÂÂÂÂÂ(1u << ((idx) & 31))
> Â#define clear_bit(idx, dst) ((dst) &= ~bitmaskof(idx))
> @@ -211,37 +212,19 @@ static void amd_xc_cpuid_policy(xc_interface *xch,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂregs[0] = DEF_MAX_AMDEXT;
> ÂÂÂÂÂÂÂÂÂbreak;
> Â
> -ÂÂÂÂcase 0x80000001: {
> +ÂÂÂÂcase 0x80000001:
> ÂÂÂÂÂÂÂÂÂif ( !info->pae )
> ÂÂÂÂÂÂÂÂÂÂÂÂÂclear_bit(X86_FEATURE_PAE, regs[3]);

This (and the others which actually change in this patch) are correct
because the locally defined clear_bit (contrary to what one might usually
expect) includes masking off the lower bits to get the offset in the given
word, is that right?

That confused me a lot until I spotted the clear_bit in the context above.
What do you think about renaming it to clear_feature, or something else
without the false expectation? Just thought I'd mention it having scratched
my head for a bit ;-), feel free to say no.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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