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

Re: [PATCH v4 03/10] libx86: introduce helper to fetch msr entry


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 18 May 2021 12:50:02 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tUn5XI88xd1B744IQxuFJuWJsdR5tDB/QShlTfvEat8=; b=OvZHlc+NF2mAhcLlA74Jwb33A3sC5mQHobk3vIbzvB5682/mYqbzWO21x905CPXZhWLXOjYqVaqg2jdibM6K4q36KGvJDdOgZslA7cHSoXxLIYfPf5yPiQk04DXrvA18XRExDZMoRgSl6hVJ7w+8ZAYrBFgI+vlbJ0WukGivU8UfigvLhK3wfXnAGECjw0ls/BrAD5KJreawe3mr6bFdZP68yBUz60fbEgxBBnZ+2bZu7r/wDHxkriHK8hoHjVf8kt7Y3lmSpveYyM3LpKdGSdmGyOB12UipO8AiH13LtG7VjZqXUWEjTg0HvuyWHpfdcq3hDaRxijH/ZHBN/EdexA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QmtPLdVBKFSiE03gZI5XsELw+SwhBuzkymtIUuT1j0+TS9a+7YSqpoPPfKYjA0xTTzloPtQdI3TNXjBdrNZ0UYkJ9q46sPVXII5vIuzUYaU9iJnqLEXFNrjwucxlK4gK+x7Ksuvv1uvvoU7XNwIZ6VKXlmJUNc1KgP83YABDg9cP/sBYg6foxErKTNOe0JHuqb14yC62FaOYGPYLaEEeeHKStGvCPkatU/nGfwLQ6ddOhFbDpSVgWTrXUegu1rNXIVeS6M6vFnPkjPGXO8V6BL3tfqi1EcxDwIPtTALgWmTtjT/wcGU00k+iPPpF5QBkuJRgSlxA1L41JwVLcQ7V9Q==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Ian Jackson" <iwj@xxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 18 May 2021 10:50:25 +0000
  • Ironport-hdrordr: A9a23:JssPva7EjhXk4QuXmAPXwDLXdLJyesId70hD6qkQc3FomwKj9/ xG/c5rsSMc7Qx6ZJhOo7+90cW7L080lqQFhLX5X43SPzUO0VHARO1fBOPZqAEIcBeOlNK1u5 0AT0B/YueAcGSTj6zBkXWF+wBL+qj5zEiq792usUuEVWtRGsZdB58SMHfhLqVxLjM2Y6YRJd 6nyedsgSGvQngTZtTTPAh+YwCSz+e77a4PeHQ9dmYa1DU=
  • Ironport-sdr: Cl4RLLTtjbvYQwRyF1aqSfaIRDAHBKdxtlGin+2jzRydDkRusiQWkz9IVX8MW2rvSqbmJuhoNR gAXjlTfX+MLMj9E0wtQ4m7nvsBdRnE160k8rNRRejYgH812o86ZPNed76tJO7/ZsHn/4pgrF/5 8zgp2C1nDS3ckDhmNEz8CdDDd8LMnt9OarYEZQHHhfdlEfsOJZNITLnF03i4y+Kfq/cNpscP77 NwkVX43/JidDm69M21gKPcjec3/AdlwCDpC7n4oJV1tuD8iU0L0ssnvOSp5N/rZtv5NtSdR5lK v4I=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, May 17, 2021 at 05:43:33PM +0200, Jan Beulich wrote:
> On 07.05.2021 13:04, Roger Pau Monne wrote:
> > @@ -91,6 +91,21 @@ int x86_msr_copy_from_buffer(struct msr_policy *policy,
> >                               const msr_entry_buffer_t msrs, uint32_t 
> > nr_entries,
> >                               uint32_t *err_msr);
> >  
> > +/**
> > + * Get a MSR entry from a policy object.
> > + *
> > + * @param policy      The msr_policy object.
> > + * @param idx         The index.
> > + * @returns a pointer to the requested leaf or NULL in case of error.
> > + *
> > + * Do not call this function directly and instead use x86_msr_get_entry 
> > that
> > + * will deal with both const and non-const policies returning a pointer 
> > with
> > + * constness matching that of the input.
> > + */
> > +const uint64_t *_x86_msr_get_entry(const struct msr_policy *policy,
> > +                                   uint32_t idx);
> > +#define x86_msr_get_entry(p, i) \
> > +    ((__typeof__(&(p)->platform_info.raw))_x86_msr_get_entry(p, i))
> >  #endif /* !XEN_LIB_X86_MSR_H */
> 
> Just two nits: I think it would be nice to retain a blank line ahead of
> the #endif. And here as well as in the CPUID counterpart you introduce,
> strictly speaking, name space violations (via the leading underscore).

I guess another option would be to name the function
x86_msr_get_entry_const, and keep the x86_msr_get_entry macro as-is.

Does that seem better?

Thanks, Roger.



 


Rackspace

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