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

[PATCH v2] x86/HVM: adjust hvm_interrupt_blocked()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 7 Sep 2023 15:12:48 +0200
  • 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=EzY0BtiwbILLQZ4b4TJ6wOWk6JKxQEtwdjfMMMHJBZM=; b=VwkXLNUu4KM2OLgabj7EdTPrP3JCDie7pLyybmh+DUjajrjyrm9aeQJo41iPmkUQftEhwfSDyeBoz2TVOQzWGAFbIOXJL0dK9MDUTc6uGc2P7AvlBH7qqPw6r7ewZlCqcuAH7DzLbK0XLFexkW9IjDUDgTFG+94xp9G6Qx8Y74rjq5mpDYzJD2feRrb1CWpD8sJQkng54cQiaE52icPy0ydsSnNRciRF9rSP7DaxZ4W1ey6g8AizWAQRSGB2tzNUYCwQ6knIwzHaaufNo7+jazIvBhPF2EXNEvydE3qdlSpQVIqtliftrJ0Ja8hUXlXk+fgPT9CQvAgTVM13Cp+TMA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l8FSipE0OeNY7i0I8sLtzBrXvSC9OwUKX90y45hS7BzyVkPZazop+Iy/2mnqFDMxzzYmEzxAjJJsXLjF6h/aWZYCB1cRmc0PQNbMbF8kxIFW1U3ADCiVgEfgukEZ75KswQYnJZrfHpBBCYiIbR07bH37YNC+zebklKV20Fg+Naf7KJjpyyMmslq0ztTuRlq+iXi18L4vq9GSiIU4VhbEuBWOtD9ZcnTsyvVVKWVnQ6lcnw0y3+43Iv9iA3qpn4lP8iI5mDyFK3OLr0FL9ypRLNLDcP/Mm7Ai0XaekKH5GE4c4Pak0DmzStONy6lrs9WokY5zPC670fdA9P3m7GyUiA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 07 Sep 2023 13:13:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

First of all, hvm_intsrc_mce was not considered here at all, yet nothing
blocks #MC (other than an already in-progress #MC, but dealing with this
is not the purpose of this patch).

While nominally STI-shadow only blocks maskable interrupts, but not NMI,
at least Intel offers more leeway: "Nonmaskable interrupts and system-
management interrupts may also be inhibited on the instruction boundary
following such an execution of STI." In case guest kernels might rely on
such behavior, keep the STI check together with the MOV-SS one.

Additionally EFLAGS.IF being clear affects neither #MC nor NMI.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
The EFLAGS.IF check may want moving yet further down, i.e. also past the
TPR check. Otoh it may also be okay to keep the original condition, just
after the added MCE conditional. Except for hvm_intblk_tpr, the specific
types returned here aren't really of interest to callers. The special
case in vmx_intr_assist() concering hvm_intblk_tpr looks to prefer to
have the check done last (i.e. all other blocking reasons to be
prefered). For the one in nvmx_intr_intercept() it's not as clear to me,
though.
---
v2: Keep STI and MOV-SS together.

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3904,9 +3904,8 @@ enum hvm_intblk hvm_interrupt_blocked(st
             return intr;
     }
 
-    if ( (intack.source != hvm_intsrc_nmi) &&
-         !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) )
-        return hvm_intblk_rflags_ie;
+    if ( intack.source == hvm_intsrc_mce )
+        return hvm_intblk_none;
 
     intr_shadow = alternative_call(hvm_funcs.get_interrupt_shadow, v);
 
@@ -3917,6 +3916,9 @@ enum hvm_intblk hvm_interrupt_blocked(st
         return ((intr_shadow & HVM_INTR_SHADOW_NMI) ?
                 hvm_intblk_nmi_iret : hvm_intblk_none);
 
+    if ( !(guest_cpu_user_regs()->eflags & X86_EFLAGS_IF) )
+        return hvm_intblk_rflags_ie;
+
     if ( intack.source == hvm_intsrc_lapic )
     {
         uint32_t tpr = vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xF0;



 


Rackspace

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