From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 11/30] xen/x86: Calculate maximum host and guest featuresets Date: Mon, 15 Feb 2016 15:52:51 +0000 Message-ID: <56C1F453.6090900@citrix.com> References: <1454679743-18133-1-git-send-email-andrew.cooper3@citrix.com> <1454679743-18133-12-git-send-email-andrew.cooper3@citrix.com> <56C1E2C602000078000D2231@prv-mh.provo.novell.com> <56C1E758.20207@citrix.com> <56C1F7D002000078000D233A@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <56C1F7D002000078000D233A@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Xen-devel List-Id: xen-devel@lists.xenproject.org On 15/02/16 15:07, Jan Beulich wrote: > >>>> +uint32_t __read_mostly raw_featureset[FSCAPINTS]; >>>> +uint32_t __read_mostly host_featureset[FSCAPINTS]; >>>> +uint32_t __read_mostly pv_featureset[FSCAPINTS]; >>>> +uint32_t __read_mostly hvm_featureset[FSCAPINTS]; >>>> + >>>> +static void sanitise_featureset(uint32_t *fs) >>>> +{ >>>> + unsigned int i; >>>> + >>>> + for ( i = 0; i < FSCAPINTS; ++i ) >>>> + { >>>> + /* Clamp to known mask. */ >>>> + fs[i] &= known_features[i]; >>>> + } >>>> + >>>> + switch ( boot_cpu_data.x86_vendor ) >>>> + { >>>> + case X86_VENDOR_INTEL: >>>> + /* Intel clears the common bits in e1d. */ >>>> + fs[FEATURESET_e1d] &= ~COMMON_1D; >>>> + break; >>>> + >>>> + case X86_VENDOR_AMD: >>>> + /* AMD duplicates the common bits between 1d and e1d. */ >>>> + fs[FEATURESET_e1d] = ((fs[FEATURESET_1d] & COMMON_1D) | >>>> + (fs[FEATURESET_e1d] & ~COMMON_1D)); >>>> + break; >>>> + } >>> How is this meant to work with cross vendor migration? >> I don't see how cross-vendor is relevant here. This is about reporting >> the hosts modified featureset accurately to the toolstack. > I.e. you're not later going to use what you generate here to also > massage (or at least validate) what guests are going to see? Oh right - as currently implemented, this will clobber features on an Intel host attempting to emulate AMD through cross-vendor. I will reconsider the logic in v3. This isn't trivial to fix, especially given that we don't yet have per-domain policies. ~Andrew