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

Re: [PATCH 3/5] VMX: sync VM-exit perf counters with known VM-exit reasons


  • To: Andrew Cooper <amc96@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Dec 2021 11:27:56 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=+MgJQtXGk+8EPq85VhQcNTrmoGDyXH9sJ7Zoej/YbPI=; b=AsknbHHVKXhBN1SHiio9gmo9hz9gi3EbLQDDirtRnpab1yuUnI4u0p/lKJHBl4HM9qE0uo7SVPfpKve49PcJ5sW+W4yAx32O+SajZVBuVtRg9XhOjHvJjrbNH8KVxzLXKLYUfI7qnRYezvWEqhLA5/rTQW7ZCCXpyy3a51HTwBi0JKUuw6TwTsN9c8WUgRBkV887qGAjqvhqO8NrTSyN1yQnNE77NzIRt76y+TM2LSe7rgAVrKAKwflgd+DenNj3brO3KnzkcpizM0fyZIB8UUwtKWXsuzOyiYwd7XEtwM9vNcULOFvK3F91CSQ15Ajp8a2eTEnDOgQ7byigxoDLTQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UCiATofkT6uv0Z5Y/NtbYnUHjAofM9HTKvtlyksih7YrdqxcNwgmdz0s0CPaf22+PvK4w5/5/aHjsGHcbBpc/YbRP+MvdqkiKRBaj7+Xt7lLCDUgo4eMWDwTC2IhZIryghlXFkVDcrhuUvUYiLYhHmXu3MxWYo2rsKZ/0KKnzCaI+KhsKmKsXsNpPvEPW3u87QRknQ2W69qWHFAwHRQ8zx99uDWfcrnNwHk5U1m5W9C6MqMbuZTl0xwYKTwN4UOr9LuhLIJqwv0h2WbnieRAHQD42wzLRFPbzfhj9u02B6QJBIS1OuatnXWMSMqsFKcUdeBPswSMNuqA57SMzgPTww==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 21 Dec 2021 10:28:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.12.2021 16:00, Andrew Cooper wrote:
> On 03/12/2021 12:05, Jan Beulich wrote:
>> --- a/xen/include/asm-x86/hvm/vmx/vmx.h
>> +++ b/xen/include/asm-x86/hvm/vmx/vmx.h
>> @@ -220,6 +220,8 @@ static inline void pi_clear_sn(struct pi
>>  #define EXIT_REASON_XSAVES              63
>>  #define EXIT_REASON_XRSTORS             64
>>  
>> +#define EXIT_REASON_LAST                EXIT_REASON_XRSTORS
>> +
> 
> Given the problems with sentinals like this in the domctl/sysctl
> headers, I think this scheme would be less fragile if EXIT_REASON was an
> enum.

Enums have some "downsides", so I'm not sure I'd want to go that route,
at least not right here.

>  (Also, we seriously need to reduce the scope of these headers. 
> It's only just dawned on me why Intel uses EXIT_* and AMD uses VMEXIT_*)

Funny, isn't it? Otoh the PM specifically uses VMEXIT_*, while the SDM
specifically talks about "exit reason" everywhere. So there may be more
to this than just the need to avoid name space collisions.

And yes, I fully agree with the need of scope reduction. These
definitions living in a private header in xen/arch/x86/hvm/vmx/ should
be completely sufficient for the build to continue to work. Question
is if, while doing so, we wouldn't want to alter the name prefixes (but
see above).

> Alternatively, what about simply this:
> 
>  #define EXIT_REASON_XSAVES              63
>  #define EXIT_REASON_XRSTORS             64
> +/* Remember to update VMX_PERF_EXIT_REASON_SIZE too. */
> 
> ?
> 
> This avoids having yet another sentinel in the mix, and will be visible
> in *every* patch review.  It also gets rid of the ifdefary in the vmexit
> handler.

I can do it that way, sure, but then there'll again be no build time
check. As long as exit reasons all get added sequentially here, the
comment in context should raise enough attention, but what if Intel
start a second range like AMD did with NPF?

Jan




 


Rackspace

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