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

Re: [PATCH v2 1/6] libs/guest: introduce support for setting guest MSRs


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 13 Jul 2023 16:14:30 +0100
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MJsj4KSe5JAhjFlCBYkS2o/CEljs6ul5TGHCIlkNXKc=; b=G/x8IRKDG98vRBbiYPtWliED5ahHrm1OyItnjWLcArjRE7OuVwRYEP39eS2BKFI5wpaS6wF+7T2XF7aEWsF1naDuYkqkbWdMG2Oz51sHRF2OgKBqi7YBK7e8Iy+3XIBNMqHaAojBtymXCjTLjA9nONty2tAGaCPchyI3QGLGEHkH7Z/b98i8LXjxVOHCE5WW2G7xBjRizE3+OY40a7xRzAjdJ9MLJGewA5b26xPumVKxd4ZJ0xxxbVZ47/fYnF7uW+YfUlklOSVv0OEEv+E7Hd/0qOq7vX2fukOYYhQ67OOsvNz7btUVWMkzUfgGc2hfifvcQ1rx8MVrYJ1XicWZQg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g7Ih3mfJgjCtC9X14Uq5eXkAcH5DgZgsV3AQ4GF/f/xwkzZDX27g1jygtcZ+5DW+0bxI6an4b6qfxO8JM6ZSN0NJrqI4U6CciSXXPl+rcO+wUKnYoPMjMoy199dXFhJ46xaZUOaDTNQNYvvZSpifOApNVNuwDFPm26hMWOMKpquo2Nao1BgntP9k6us13rM5SBl8kRG8AIbxYyUw6IdonubwKeG3oTcx19aj/h1idy8zPVASxopHOJyasyPg0hti4gHGwBHh/7YnI7FGe9oJo2KWGVsC6UhyJU/8a3PAz/mMwMDqr/TOvnzjoGhqe//GrHruaxY/UIO8Nc42zLfYMg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Thu, 13 Jul 2023 15:14:54 +0000
  • Ironport-data: A9a23:fOUOyq5FB+3cSmKTvYX2JQxRtBvGchMFZxGqfqrLsTDasY5as4F+v jYWXDqBaP/bM2P1fNkja4q2p05V65PSnYBgSAdq+Co9Hi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9lU35ZwehBtC5gZlPa8S5weE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m/ vMidisSTRq6u/u75e+CZss3ncIPBZy+VG8fkikIITDxK98DGMiGb4CUoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OnEooiOOF3Nn9I7RmQe18mEqCq 32A1GP+GhwAb/SUyCaf82LqjejK9c/+cNtLSuTjqaM62zV/wEQxDCczTWuEn8Wcg3z5ef91M 1YK3AwH+P1aGEuDC4OVsweDiG6JuFsQVsRdF8U+6RqR0ezE7gCBHG8GQzVdLts8u6ceWjgCx lKP2dTzClRHsrKPTmmG3qyJtj70Mi8QRVLufgcBRAoBptXm/oc6i0uXSs45SfbuyNroBTv33 jaG6jAkgKkehtIK0KP9+k3bhzWrpd7CSQtdChjrY19JJzhRPOaND7FEI3CChRqcBO51lmW8g UU=
  • Ironport-hdrordr: A9a23:+wRpPKEoIleCk5nkpLqFrZHXdLJyesId70hD6qkRc20hTiX8ra vBoB1173/JYUkqKQ0dcLy7WZVoIkmshqKdn7NhX4tKNTOO0AGVxepZnOjfKlPbakjDHuU079 YeT0AXYuedMbAQ5/yU3OF2eexM/PC3tJmNwcPi5zNVSwduApsQnTuQyGygYzNLrM0tP+tIKH JYjPA31gZIAk5nCviTNz0+Ru3eoN+OvIv+CCR2fiIP2U21lDa177y/OASZ2xp2aUIz/Z4StV LdlhD/5OGFu/W2oyWssFP73tBtgd78zdkGItKKhtN9EESLti+YIL55XqGEvnQOgMzH0idTrP D85y04Oth16TfqcnqrrQDL0w3tuQxekEPK+BujmH7+ps68ez4gEcpGgutiA2Hk13Y=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 11/07/2023 10:22 am, Roger Pau Monne wrote:
> diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
> index 5b035223f4f5..5e5c8124dd74 100644
> --- a/tools/libs/guest/xg_cpuid_x86.c
> +++ b/tools/libs/guest/xg_cpuid_x86.c
> @@ -423,10 +423,169 @@ static int xc_cpuid_xend_policy(
>      return rc;
>  }
>  
> +static int compare_msr(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;

The sum total of logic here is just

return lhs->idx - rhs->idx;

(I think.  Double check which way around the subtraction works.)

You don't need to return -1, 0 or 1.  You only need negative, 0 or positive.

~Andrew



 


Rackspace

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