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

RE: [PATCH v3 1/3] x86/vmx: implement VMExit based guest Bus Lock detection


  • To: Pau Monné, Roger <roger.pau@xxxxxxxxxx>, "Beulich, Jan" <JBeulich@xxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Tue, 19 Jul 2022 07:31:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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=U9urn5LBzX7deftHHBmns6fZBycOG2pTxxCGfdTGXjc=; b=XNim0R5b7yYJKyinfJ7Wirb8KmHU8hJNJv0Q+BK3K+zNz/Gsfb14AG/HbOyxubwWyalpPlWtRxCOqb0LUIcKU0PVULAfpSvBpKhhJTBR2ocbcRn9hRt2lo/xirnO+YpBninxtrTpdgaUqRIYskyQfDkufrwUfCyVxZMuLErg7Ba6XNOM+6XwOVofR/9W7lt7BfgAQsZQxl0i3Gv3hTFK1G/YLcj4lRbQX5VzlPJ6h9mqdodU9l/I8RbkJtA0bu8a2LR4lY0nl/Xn9Q4Sh9cbMQVuF3MWPgOY6EgPpq/TBNmUAR6bB31rbXCr1zb6ouYPxPjIRg6B9TIMewlqkjDh6w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GJchAt4JRf3fOXZIyjFRXOZajx3i8EkDbXW2u/pZCeBZGZDytk1g3o7jupTCwtG809jwXtnbTTp3IeJrkprCFAI9wb4ZNco/SzIgIX0OABwcSjpyFqI6FaSjPoGCo8rPDkSUBMPHyGNlQASVNunbnC8hvX9HRTw9hgNKElABME3rBfKXqis4N2PNCY1Fzubzai3qLvZbX5qv8SrJgyabZw4GNTRJV9/6Ws5bdmXeBDMYvCPH9McOzPz30G4Yl1FHF8kbOyvTbRuseOxHVVpJXNcuTu91Zxs6UYIPoiAIjcQx4XEHmQrW6ML51bKfnhpUxm+ccXKIg7sb+0UYES2UXA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 19 Jul 2022 07:31:40 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.6.500.17
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYjUzyisX0+ExRGkiFh4Bp+KXF1a1t9f+AgAALFYCAF2Y1QA==
  • Thread-topic: [PATCH v3 1/3] x86/vmx: implement VMExit based guest Bus Lock detection

> From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Sent: Monday, July 4, 2022 6:07 PM
> 
> On Mon, Jul 04, 2022 at 11:27:37AM +0200, Jan Beulich wrote:
> > On 01.07.2022 15:16, Roger Pau Monne wrote:
> > > --- a/xen/arch/x86/hvm/vmx/vmx.c
> > > +++ b/xen/arch/x86/hvm/vmx/vmx.c
> > > @@ -4065,6 +4065,11 @@ void vmx_vmexit_handler(struct
> cpu_user_regs *regs)
> > >
> > >      if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
> > >          return vmx_failed_vmentry(exit_reason, regs);
> > > +    if ( unlikely(exit_reason & VMX_EXIT_REASONS_BUS_LOCK) )
> > > +    {
> > > +        perfc_incr(buslock);
> > > +        exit_reason &= ~VMX_EXIT_REASONS_BUS_LOCK;
> > > +    }
> >
> > To cover for the flag bit, don't you also need to mask it off in
> > nvmx_idtv_handling()? Or (didn't go into detail with checking whether
> > there aren't any counter indications) pass the exit reason there from
> > vmx_vmexit_handler(), instead of re-reading it from the VMCS?
> 
> This seem to be an existing issue with nvmx_idtv_handling(), as it
> should use just the low 16bits to check against the VM Exit reason
> codes.
> 
> I can send a pre-patch to fix it, could pass exit reason from
> vmx_vmexit_handler(), but I would still need to cast to uint16_t for
> comparing against exit reason codes, as there's a jump into the 'out'
> label before VMX_EXIT_REASONS_BUS_LOCK is masked out.

or just masking out the bit in an earlier place which then also
covers nvmx_n2_vmexit_handler() below? There are a few other
goto's and return's before the point where that bit is currently
masked out. Having bus lock counted even in those failure paths
is also not a bad thing imho...

> 
> I think there's a similar issue with nvmx_n2_vmexit_handler() that
> doesn't cast the value to uint16_t and is called before
> VMX_EXIT_REASONS_BUS_LOCK is removed from exit reason.
> 



 


Rackspace

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