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

Re: [PATCH for-4.21??? 3/3] x86/vLAPIC: properly support the CMCI LVT


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Date: Tue, 14 Oct 2025 17:12:03 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=fAT6IUttfd7V6Wbp2R8ttI0tk79mm5RZ9yChfc42N5Q=; b=pFFMdqjMWLnPENKrSVjPK87xqRRyUO1SKy4kqkiqq1W8VaS2Xg9v123JfyVmBo4J9Ed3yqQ+aaRDt53wjDTYHgbI1We4OOiLTEKMNVHjgg0jh3m1iY+BkM2uV29jps00RseJKohJRH/+HbKpMF1m2rbqftEv114mVHW+SQAZSkFo3NpqyBlJDZSBdBP6if7Fi2VcZ/WiDuoRNZysKzlNoHVJ/6kiBgEf3DaaoD9YdVJf2/YY9UNU98TL7djv8EAeXm6j7IZMHwY07d3WRs3dkZtLupKHHaCKb+Z7YMe6HYvwLZfoXcI3kg6ksOWsP539b5TY2XvZISbK7fyW7iI6tw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SkbO89gnUgUV8HYeZmrDe+jaQldmvoTRNZsMedfH1ZNKkL/MHqSHDZKk3bvQbyAAuDSxvszU1qCMByrRTgMMIVNFgmKwPaBLwq4oYTKIzaVmMl1mcTbYav1B/3HkGhi5F+blDQ71U0Ogre8w+6XOqdchhK7kov7yohuXpreg432nTJBhxbD09N9VszerfwKQgPrtyFO8EcdZo3SouxlHRswDTgPe/agYL5diwvzm10BNZ+ZI/g8zfeUyijLCD8S/GESyvcczLmBCSt05Glak79l8WOWPlpuZTKL3xSNKfBmknfLWyqkCPGiOanPi+h0iMeN4SY+CLTyTmAanBYiBhw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Andrew Cooper <amc96@xxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 14 Oct 2025 14:12:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 09.10.25 18:37, Jan Beulich wrote:
On 09.10.2025 17:08, Grygorii Strashko wrote:
On 08.10.25 15:09, Jan Beulich wrote:
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -31,10 +31,13 @@
   #include <public/hvm/ioreq.h>
   #include <public/hvm/params.h>
-#define LVT_BIAS(reg) (((reg) - APIC_LVTT) >> 4)
+#include <../cpu/mcheck/x86_mca.h> /* MCG_CMCI_P */

This include... You probably do not like it also
It is dependency outside HVM code.

I've been thinking about something like vlapic->caps which can be filed before 
vlapic_init()
or passed as parameter, but seems x86 toolstack is considered to be able 
overwrite anything,
including v->arch.vmce.

Seems, no better options here.

Same here, hence why I used it despite not liking it.

@@ -697,8 +701,17 @@ int guest_rdmsr_x2apic(const struct vcpu
           return X86EMUL_EXCEPTION;
offset = reg << 4;
-    if ( offset == APIC_ICR )
+    switch ( offset )
+    {
+    case APIC_ICR:
           high = (uint64_t)vlapic_read_aligned(vlapic, APIC_ICR2) << 32;
+        break;
+
+    case APIC_CMCI:
+        if ( !(v->arch.vmce.mcg_cap & MCG_CMCI_P) )

Could it be done using wrapper, like vmce_has_cmci()?
As this is Intel specific it's candidate to be opt-out eventually.

Possible. I wanted to limit the churn, hence why I preferred not to introduce
a wrapper. Such an abstraction I wouldn't like to be a function taking a vCPU;
really this should be a domain property imo.

My intention was to limit spreading direct access to "vmce" data over vlapic 
code:

static bool vlapic_has_cmci(const struct vcpu *v)
{
        return v->arch.vmce.mcg_cap & MCG_CMCI_P;
}

Just expressing opinion.

--
Best regards,
-grygorii




 


Rackspace

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