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

[PATCH] x86/mcheck: allow varying bank counts per CPU


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Soham Dandapat <Soham.Dandapat@xxxxxxx>
  • Date: Fri, 5 Sep 2025 22:22:12 +0530
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=sZ4DTlzlIKd/12RtkgLudAGUzA4uI4t07+Tf0C6Wtno=; b=O1sXlC0DxiHgaayd9JFn8pLgoy/t5iThwtuynItmsr0x9szOLZUTFStAt1Hfh7WZxk7ynV1Z49bopX5wiX7uvF5bJQZTCUcTsBOcb7ihQrqjvbiChE9hlCjqSidRh1PwQ91p9qeO7cLMUhco6hr+sdfO9ZEW7SWe/4ucNb3PFcGjWqVYtXYY6/WfOaCxHRV4wFfTPIP4WcA7vczw0SD/5oZYJo0onxBiWr46HFDV4+m2XC+Q/y+Uuxq8PsS4OQm+1eaSjEoAMJfwNSj966EeCAq3VJIbAzIdhB/JY4eTqfwth4QgGrwJp/1AQjtxVZ30pOy3quK0f8OGDxEWeaHvFw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xvZRFe36vrYyAPLOeonfYj77oebZ/hCcdMV5taaPptgQdcoR2Ryqh+Y3Wr2M/VjEA8od6QzjrA+b4Ym9KebyPF13gU2ebJFGp/GOPwdMSuLTLkGzmkwjODZSM/6lQ50qMlKtmJKAf2nOQWBhoZlZ25cm+NEk4YYiDqHO/KoKGvkpm/vqgbI8W4BJjHsbMifGoDTMXcpyKxb28jz7SVa1gTpYHoq1IwEYYJ5z0PF8MaWRFkJVSUH2vy3m/RJCTLmjWMniIRsE42U210k16Ark/mSLtPcMzdSl7P9LBvtiHgRig7INMx4fwF6pjRt/BCmF+5Hbje841OPLVH6u7BKTCA==
  • Cc: <jason.andryuk@xxxxxxx>, Soham Dandapat <Soham.Dandapat@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Soham Dandapat <soham.dandapat@xxxxxxx>
  • Delivery-date: Fri, 05 Sep 2025 16:55:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In mca_cap_init function,the mcabanks_alloc allocates and
initializes an mca_banks structure for managing MCA banks,
setting up a bank map and storing the specified or default number
of banks.

After this we will call mcabanks_set(i, mca_allbanks);
The mcabanks_set function sets a specific bit in the bank_map of
an mca_banks structure, provided the structure, its bank_map, and
the bit index are valid.

At the end, we will call
mcabanks_free(xchg(&mca_allbanks, all));
This function is thread safe and does below:
   1. Atomically exchanges the value of "mca_allbanks" with "all"
   2. Returns the old value that was previously in "mca_allbanks"
So, when we will call mcabanks_free , that will free the memory.

The problem is that mcabanks_set(i, mca_allbanks) function is updating
mca_allbanks which will be freed via mcabanks_free later. This means
new mca_allbanks instance("all") will never get chance to update
it's bank_map.

Due to this when we will collect log from mcheck_mca_logout function ,
the condition "if ( !mcabanks_test(i, bankmask) )" will always fails
and MCA logs will not be collected for any bank.

The fix is to solve this problem.

Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
Signed-off-by: Soham Dandapat <soham.dandapat@xxxxxxx>
---
 xen/arch/x86/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 9028ccde54..84238cd0ef 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -663,7 +663,7 @@ static int mca_cap_init(void)
         if ( !all )
             return -ENOMEM;
         for ( i = 0; i < nr; i++ )
-            mcabanks_set(i, mca_allbanks);
+            mcabanks_set(i, all);
         mcabanks_free(xchg(&mca_allbanks, all));
     }
 
-- 
2.17.1




 


Rackspace

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