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

Re: [Xen-devel] [PATCH v3 11/28] xen/x86: Clear dependent features when clearing a cpu cap



On Thu, Mar 17, 2016 at 07:56:32PM +0000, Andrew Cooper wrote:
> On 17/03/16 19:51, Konrad Rzeszutek Wilk wrote:
> > On Tue, Mar 15, 2016 at 03:35:07PM +0000, Andrew Cooper wrote:
> >> When clearing a cpu cap, clear all dependent features.  This avoids having 
> >> a
> >> featureset with intermediate features disabled, but leaf features enabled.
> >>
> >> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> >> ---
> >> CC: Jan Beulich <JBeulich@xxxxxxxx>
> >>
> >> v3:
> >>  * Style fixes.  Use __test_and_set_bit()
> >> ---
> >>  xen/arch/x86/cpu/common.c | 16 +++++++++++++++-
> >>  1 file changed, 15 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
> >> index cd168c8..cb1cab3 100644
> >> --- a/xen/arch/x86/cpu/common.c
> >> +++ b/xen/arch/x86/cpu/common.c
> >> @@ -53,8 +53,22 @@ static unsigned int cleared_caps[NCAPINTS];
> >>  
> >>  void __init setup_clear_cpu_cap(unsigned int cap)
> >>  {
> >> +  const uint32_t *dfs;
> >> +  unsigned int i;
> >> +
> >> +  if (__test_and_set_bit(cap, cleared_caps))
> >> +          return;
> >> +
> >>    __clear_bit(cap, boot_cpu_data.x86_capability);
> >> -  __set_bit(cap, cleared_caps);
> >> +  dfs = lookup_deep_deps(cap);
> >> +
> >> +  if (!dfs)
> >> +          return;
> >> +
> >> +  for (i = 0; i < FSCAPINTS; ++i) {
> >> +          cleared_caps[i] |= dfs[i];
> >> +          boot_cpu_data.x86_capability[i] &= ~dfs[i];
> >> +  }
> > That is OK, but what if the feature we clear has a dependeny
> > chain - of clearing other features?
> 
> The purpose of patch 10 "xen/x86: Generate deep dependencies of
> features" is to flatten the dependency tree into a single bitmap, so
> dfs[] in this case is the complete set of all eventual features
> dependent on cap.

/me nods

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> 
> ~Andrew
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
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®.