xen/arch/x86/cpu/mcheck/mce.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
bitmap_copy() copies whole words, so in set_poll_bankmask() it clears
the banks past the end of the CMCI map that bitmap_fill() had just set,
leaving them neither polled nor reported by CMCI. Set those bits after
the copy instead.
Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Roger Pau Monné <roger.pau@amd.com>
---
xen/arch/x86/cpu/mcheck/mce.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 1888f22d15..f9a1389516 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -621,9 +621,14 @@ static void set_poll_bankmask(struct cpuinfo_x86 *c)
{
const struct mca_banks *cmci = per_cpu(no_cmci_banks, cpu);
- if ( unlikely(cmci->num < mb->num) )
- bitmap_fill(mb->bank_map, mb->num);
bitmap_copy(mb->bank_map, cmci->bank_map, min(mb->num, cmci->num));
+ /*
+ * Banks past the end of the CMCI map are not reported by CMCI
+ * either, so they need polling. Set them after the copy, which
+ * works in whole words and would otherwise clear them again.
+ */
+ if ( unlikely(cmci->num < mb->num) )
+ bitmap_set(mb->bank_map, cmci->num, mb->num - cmci->num);
}
else
{
--
2.47.3
On 27.10.2026 01:13, Stefano Stabellini wrote:
> bitmap_copy() copies whole words, so in set_poll_bankmask() it clears
> the banks past the end of the CMCI map that bitmap_fill() had just set,
> leaving them neither polled nor reported by CMCI. Set those bits after
> the copy instead.
May I suggest
"bitmap_copy() copies whole words, so in set_poll_bankmask() it may clear
banks past the end of the CMCI map that bitmap_fill() may just have set,
leaving them neither polled nor reported by CMCI. Set those bits after
the copy instead."
> Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
> Acked-by: Roger Pau Monné <roger.pau@amd.com>
No further tags needed, as it looks.
Jan
bitmap_copy() copies whole words, so in set_poll_bankmask() it may clear
banks past the end of the CMCI map that bitmap_fill() may just have set,
leaving them neither polled nor reported by CMCI. Set those bits after
the copy instead.
Fixes: 560cf418c845 ("x86/mcheck: allow varying bank counts per CPU")
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Roger Pau Monné <roger.pau@amd.com>
---
v2:
- reword the commit message as suggested by Jan
---
xen/arch/x86/cpu/mcheck/mce.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 1888f22d15..f9a1389516 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -621,9 +621,14 @@ static void set_poll_bankmask(struct cpuinfo_x86 *c)
{
const struct mca_banks *cmci = per_cpu(no_cmci_banks, cpu);
- if ( unlikely(cmci->num < mb->num) )
- bitmap_fill(mb->bank_map, mb->num);
bitmap_copy(mb->bank_map, cmci->bank_map, min(mb->num, cmci->num));
+ /*
+ * Banks past the end of the CMCI map are not reported by CMCI
+ * either, so they need polling. Set them after the copy, which
+ * works in whole words and would otherwise clear them again.
+ */
+ if ( unlikely(cmci->num < mb->num) )
+ bitmap_set(mb->bank_map, cmci->num, mb->num - cmci->num);
}
else
{
--
2.47.3
© 2016 - 2026 Red Hat, Inc.