[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: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 4 Jul 2022 12:07:17 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r/eoU4HS7oUI5jbCrKJ6hYEphK9oyK1oMtredb0lIVU=; b=MP9Ka3aAoLekPKy+XkbT/nNUMSr/dqLGavHHzUZEPJ5DPvDDMeXO7xq8oHygaFHCRoRSlhhPaowDbzQeLm0pQEmqwQMybq5LhMBF9Jq8g4611iNYOg3zZge39aFvgiWTBUg49GLTzh3uvl8wjBamTKv6MBQidLHgnhbXdMJJRhPGYODzFlRAODFB6Bf49pVzfmmnja5S+xIrLbFnkRZ1FV0dnBnNgK8Z2uTlUq2IH4M/x+ASa+Qc6FEToSnuxWTGxXhryLGmKgJIafoo1x1lUlhEqGvyk9yPx1CBU7ApnmJ2cdERi9HZK860utYE8P0m+eoiwDU/UPTix6SDVbiVwQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TycFsGFoe/nTc8KuMZyDkXjig+t9QQulxO9PkJM0XvGTolDWnBguPlKaNraqwl0ogDVRGV1y0+2Oc6ogLh64OM9+7NcGippoFUFVcH/NkArEDcup3pmgUEnObRBXQWQIL8YtLn893vjmscjSHGE5jltVW3WhwrkXHqUrccdjpD7YZtwFLs/GtYcNZ9B/c166+37lUEudqrjhn2azStdpZMpD5SRRKp02EEuzIYJZgN/yp4CxIBWaKPOLo0dgualC2CyVNBZvfjRHGGwzObQ2Sb8JqacoUrgWEGUobKW9B2iYJ1jtRwFqY4nSwr8IcX7NyDrIXWOVf4GYp0K7JEhL5A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 04 Jul 2022 10:07:35 +0000
  • Ironport-data: A9a23:d0r7kKgll72qgDQG4v8fb8KQX161ehEKZh0ujC45NGQN5FlHY01je htvDWnXO/3fY2ehe492aIix8kxQu8WBztJhT1Bv+C03QS4b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M58wIFqtQw24LhXFvW4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YRlxO4rWn8khaSl/Fx5RDKpi37TIGFHq5KR/z2WeG5ft69NHKRhveKE9pKNwC2wI8 uEEIjcQaBzFn/ix3L+wVuhrgIIkMdXvO4Qc/HpnyFk1D95/GcyFH/qMuIAehWhv7ixNNa+2i 84xcz1gYQ6GexRSElwWFIg/jKGjgXyXnzhw9w7O+fRvszm7IApZ+uLkM+H8V9uwWsAWgB+xq V7f72LbK0RPXDCY4X/fmp62vcfNly7mXIMZFJWj6+VnxlaUwwQ7CgAQE12yovC7i0u3c9NZN 0EQvCEpqMAa90G1T9+7QxyxplaFuAIRX5xbFOhSwB6J4rrZ5UCeHGdsZi5MbpkqudE7QRQu1 0SVhJX5CDp3qrqXRHmBsLCOoluP1TM9KGYDYWoISFUD6ty6+YUr1EuQEZBkDbK/icDzFXfo2 TeWoSMihrIVy8kWy6G8+lOBiDWpznTUcjMICszsdjrNxmtEiESNPuRENXCzAS58Ebuk
  • Ironport-hdrordr: A9a23:VHXgBq9z2jAjC3cRpShuk+FEdb1zdoMgy1knxilNoENuH/Bwxv rFoB1E73TJYVYqN03IV+rwXZVoZUmsjaKdgLNhRItKOTOLhILGFuFfBOfZsl7d8mjFh5VgPM RbAtRD4b/LfD9HZK/BiWHXcurIguP3lpxA7d2uskuFJjsaD52IgT0JaDpyRSZNNXN77NcCZe yhDo0tnUvRRV0nKuCAQlUVVenKoNPG0LrgfB49HhYirC2Dlymh5rLWGwWRmk52aUIG/Z4StU z+1yDp7KSqtP+2jjfaym/o9pxT3P/s0MFKCsCggtUcbh/slgGrToJ8XKDqhkF9nMifrHIR1P XcqRYpOMp+r1vXY2GOuBPonzLt1T4/gkWSvGOwsD/Gm4jUVTg6A81OicZyaR3C8Xctu9l6ze Ziw3+Zn4A/N2KNoA3No/zzEz16nEu9pnQv1cQJiWZEbIcYYLhN6aQC4UJuFosaFi6S0vFrLA BXNrCT2B9qSyLaU5iA1VMfgOBEH05DVCtue3Jy9fB8iFNt7TNEJ0hx/r1sop5PzuN+d3B+3Z W7Dk1ZrsAwciYoV9MNOA4ge7rCNoWfe2O6DEuiZXLaKYogB1Xh77bK3ZRd3pDYRHVP9up4pK j8
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

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.

Thanks, Roger.



 


Rackspace

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