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

Re: [PATCH] x86/nsvm: Fix L2 VINTR intercept merging when only Xen intercepts L1


  • To: abdelkareem.abdelsaamad@xxxxxxxxxx
  • From: Stephen Cheng <stephen.cheng@xxxxxxxxxx>
  • Date: Thu, 5 Nov 2026 15:59:15 +0800
  • 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=arcselector10001; 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=kW80s8L8CvcHBg2AaqGBVnt0IpXL7pjGySKAFcXDAzw=; b=KDv95UVJNepnEV82JaBSD9F5PDI/UB44xwZNlaydLhCNgANfq16SCU905ZNCT14IcFKWuufyND0KnoBpQp/XVZS6Naej0FDQbPyUHwBQBoIwlHnclMwY8PIRDVzuBmxQeQTL0MysI5tdPrJ2dvNGoXUpJAi58/9MkyH0HtOjCuOehUumTjLCeqSJHvkPXcbXquiRzL/cYxjA4ptnHyJP/hOhJvscYEHL6Bw4kdIQ0emRKUHzqbDZtWj7p6s6W+YHOlAFVKzhjln48rh05Z3U1lOISmMamrjSUm1uKlhm/nriSuI+2g1D+xMkedQhln8b67A4PO8CzrnU73i3W+/8zA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w5PwtNzueYgA3+8iTqhn8wRls1LOCKMd5YE+7Wr+rgRQGslWfbmgSPvbVyoOe1N13VwmUVmZ9a1xizJwNs8Y5JoAlkafkhVOVwioR2HMRTuTunUR7J9t3FokfCwWxZdVPkCn0//NcX9k1fdbvz9bWshqL8jctjb1agZVriAz3oJYFj6q4SE1gXSFSGc+OXhGWapeL8i+CDBFkHLXO0Z0/Vw1RtN7xLreuxqW3m0a0cNnieHaS8ZQ5FHZn10VGzW+La9VHTxFpHeSLarTb/5CiLbuntwcrpvtFyb6A5KzdZcwIr85yEyRMXSxLuaHIQdIfMNq0v3GUtZwT5OH/8FWwA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, jason.andryuk@xxxxxxx, jbeulich@xxxxxxxx, roger@xxxxxxxxxxxxxx, teddy.astie@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 05 Nov 2026 07:59:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03/11/2026 16:59, Abdelkareem Abdelsaamad wrote:
> When nesting SVM, if the L1 hypervisor has not requested a virtual interrupt
> (VINTR) intercept for L2, Xen should not force one.

I agree with the change itself, but I think the description needs
reworking.

The real bug is that Xen's interrupt window is the VINTR intercept plus a
dummy V_IRQ, both set in n1vmcb, but only the intercept is merged into
n2vmcb.  The V_IRQ in n2vmcb is L1's own interrupt for L2.  So the
intercept fires on L1's V_IRQ, and the host VMEXIT_VINTR handler clears
it as if it were Xen's dummy.  L1's interrupt for L2 is lost, and L1 is
told V_IRQ=0 as if L2 had taken it.

> Furthermore, handling this forced VMEXIT_VINTR can cause a pending L1 virtual
> interrupt to be incorrectly delivered to L2. This occurs because when the
> intercept is determined to be requested solely by the host
> (returning NESTEDHVM_VMEXIT_HOST), svm_vmexit_handler does not switch to the
> correct VMCB context before evaluating the interrupt injection.

I don't think this paragraph is accurate.  Staying in L2's context is
correct: L1 didn't ask for this exit, so L2 should simply keep running
on n2vmcb.  Switching to L1 here would be an emulated #VMEXIT that L1
never requested.  Also, svm_vmexit_handler() doesn't evaluate injection;
svm_intr_assist() does, on the way back in.

With the description reworked:
Reviewed-by: Stephen Cheng <stephen.cheng@xxxxxxxxxx>

Stephen



 


Rackspace

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