Message ID | 20200226121921.28627-4-roger.pau@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/smp: fix send_IPI_mask usage of scratch_cpumask | expand |
On 26.02.2020 13:19, Roger Pau Monne wrote: > Add helpers to track when executing in #MC handler context. This is > modeled after the in_irq helpers. > > Note that there are no users of in_mce_handler() introduced by the > change, further users will be added by followup changes. > > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> FTR I'm not finally certain this doesn't go a little too far. #MC handling paths have to be very careful anyway in what they call or do. Jan
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index d61e582af3..e5bd4f542c 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -93,7 +93,9 @@ void x86_mce_vector_register(x86_mce_vector_t hdlr) void do_machine_check(const struct cpu_user_regs *regs) { + mce_enter(); _machine_check_vector(regs); + mce_exit(); } /* diff --git a/xen/include/asm-x86/hardirq.h b/xen/include/asm-x86/hardirq.h index 069e48fce9..276e3419d7 100644 --- a/xen/include/asm-x86/hardirq.h +++ b/xen/include/asm-x86/hardirq.h @@ -8,6 +8,7 @@ typedef struct { unsigned int __softirq_pending; unsigned int __local_irq_count; unsigned int nmi_count; + unsigned int mce_count; bool_t __mwait_wakeup; } __cacheline_aligned irq_cpustat_t; @@ -23,6 +24,11 @@ typedef struct { #define nmi_enter() (nmi_count(smp_processor_id())++) #define nmi_exit() (nmi_count(smp_processor_id())--) +#define mce_count(cpu) __IRQ_STAT(cpu, mce_count) +#define in_mce_handler() (mce_count(smp_processor_id()) != 0) +#define mce_enter() (mce_count(smp_processor_id())++) +#define mce_exit() (mce_count(smp_processor_id())--) + void ack_bad_irq(unsigned int irq); extern void apic_intr_init(void);
Add helpers to track when executing in #MC handler context. This is modeled after the in_irq helpers. Note that there are no users of in_mce_handler() introduced by the change, further users will be added by followup changes. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- Changes since v3: - Rename to in_mce_handler. - Drop parentheses around cpu in macro. Changes since v2: - Move definition of mc_count to x86 hardirq.h. --- xen/arch/x86/cpu/mcheck/mce.c | 2 ++ xen/include/asm-x86/hardirq.h | 6 ++++++ 2 files changed, 8 insertions(+)