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

Re: [PATCH v3 03/13] libs/guest: allow fetching a specific MSR entry from a cpu policy


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 4 May 2021 13:58:11 +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=ONepewlv+FsTt9OZUtOs7BhlRHHkSUMAl/yz4LBnMrg=; b=gxEIOh6ZtFhruRqzuO/FFw+lDzlJOsBbnTAk1rH0hv7q7xwWGH6kH635+mRSP7BPjDscdgdX53hC3ROUQF2bB/ZtcPEcQdgg37BKY5GNrVh5c0DXTPjNJBAmMgsHEDIpvEgIUgf+si0cEqq+MNx9o/8g82eEFV/67HyczNz9idzOZJx+bgvLHwxD1Cg6xWvQoIBAqlkVLpL58DIqYytgKj0aEXfzA9U/dOzdeXLkHaQY7JnOkfpeLmMpsS1eMNaj1JbO5bty/xl8lGjv6agG5vlZ2G3mRyU7bvlDQUYz50CG7Pw238o2z3GL9tubNG0GPCmCCpePNaeKSrGLezN2eA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N0dDvNMXIwg3AJbVqYpB4Bj10OwKZ1t6iLdCSj4nSI+4C397cFTGGA+OkZkCxHkDnuH7GvJBQQ8sloWye4xya/waE86uUQ+axV0/jrh6DYbYU3kcsLJg1bxQY1eU/iRlk8B/7e+Pn/dVc0jHth+tFTPbtLQZ8tLihQSJ1F7xxxm14mFMR/w4uW3liCljdE5ur4PlqVNfadoCVeVBTf8GoRaCVTv4xPGebCTDnA/vP6mlYe6rFqgjqCTcvDHcMG/DJ438T+oyG+PLSneYqbIAmj/ITYf5isEVX9F00rd3mqmzmqlka6qd52yB/+X8iIExlc9ZNju1Po2sSHOeuAwrbw==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 04 May 2021 11:58:24 +0000
  • Ironport-hdrordr: A9a23:OQb/S6PECRH7EMBcT3Hw55DYdL4zR+YMi2QD/3taDTRIb82VkN 2vlvwH1RnyzA0cQm0khMroAsa9aFvm39pQ7ZMKNbmvGDPntmyhMZ144eLZrwHIMxbVstRQ3a IIScVDIfXtEFl3itv76gGkE9AmhOKK6rysmP229RZQZCtBApsQiDtRIACdD0FwWU1qBYAhEo Cd+8pAoFObCA4qR+68AWQIWPWGmsbCk4jobQVDKxks7gSPij3A0s+GLzGz2BACXzRThYoz6G StqX2D2oyPkdGejiXd2Wja8ohMlLLapOdrKcSQhqEuW1fRoymyYoAJYczmgBkUp6WV5E8ugJ 3wpX4bTrhOwlfwWk3wnhf3wQnn118Vmg/f4HuVm2Hqr8C8ZB9SMbs5uatjfhHU61UtsbhHuc ohtQLp1OskMTr6kCvw/NTOXR1x/3DE2UYKquIPk2dZFbIXdb45l/1vwGpuDJwCECjmgbpXdt VGMce03oczTXqqK1rdvmVp3eW2WGUyEhqsUiE5y7Ko+gkTs3Zjw0QCwssD2l8G6ZImUpFBo9 /JK6Jyidh1P4MrRJM4IN1Ebdq8C2TLTx6JGGWOIW7/HKVCH37WsZb47Jg8+enCQu1G8LIC3L D6FH9Iv287fEzjTeeU2odQzxzLSGKhGRzw18B3/fFCy/3BbYuuFRfGZEElksOmrflaKNbcQe yPNJVfBOKmBXfyGLxOwxb1V/BpWDgjefxQnux+d0OFo8rNJIGvnPfcauzv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6Nf0yTk3R6Awhd8M7eXlIvnJf2b u1R6RFKELOfVRPd7wZYKtF3bHxqnJOWdNontWCCqvhXyRMZRiPNcaKIn5Msb4pO4ZYZT5c5sXF NRXQwC+MOsnbwwf6jwFaKE1slbli686a6xfqMYyq3UfFwrk7vrsU5zjZYTsaSNKLIQ2X7sWMFv MXw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, May 04, 2021 at 01:40:11PM +0200, Jan Beulich wrote:
> On 04.05.2021 12:56, Roger Pau Monné wrote:
> > On Mon, May 03, 2021 at 12:41:29PM +0200, Jan Beulich wrote:
> >> On 30.04.2021 17:52, Roger Pau Monne wrote:
> >>> --- a/tools/libs/guest/xg_cpuid_x86.c
> >>> +++ b/tools/libs/guest/xg_cpuid_x86.c
> >>> @@ -850,3 +850,45 @@ int xc_cpu_policy_get_cpuid(xc_interface *xch, const 
> >>> xc_cpu_policy_t policy,
> >>>      *out = *tmp;
> >>>      return 0;
> >>>  }
> >>> +
> >>> +static int compare_entries(const void *l, const void *r)
> >>> +{
> >>> +    const xen_msr_entry_t *lhs = l;
> >>> +    const xen_msr_entry_t *rhs = r;
> >>> +
> >>> +    if ( lhs->idx == rhs->idx )
> >>> +        return 0;
> >>> +    return lhs->idx < rhs->idx ? -1 : 1;
> >>> +}
> >>> +
> >>> +static xen_msr_entry_t *find_entry(xen_msr_entry_t *entries,
> >>> +                                   unsigned int nr_entries, unsigned int 
> >>> index)
> >>> +{
> >>> +    const xen_msr_entry_t key = { index };
> >>> +
> >>> +    return bsearch(&key, entries, nr_entries, sizeof(*entries), 
> >>> compare_entries);
> >>> +}
> >>
> >> Isn't "entries" / "entry" a little too generic a name here, considering
> >> the CPUID equivalents use "leaves" / "leaf"? (Noticed really while looking
> >> at patch 7.)
> > 
> > Would you be fine with naming the function find_msr and leaving the
> > rest of the parameters names as-is?
> 
> Yes. But recall I'm not the maintainer of this code anyway.

You cared to provide feedback, and I'm happy to make the change.

Thanks, Roger.



 


Rackspace

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