Re: [PATCH 21/25] x86/mcheck: Split threshold_cpu_callback into two callbacks

From: Borislav Petkov
Date: Mon Nov 07 2016 - 13:19:26 EST


On Mon, Nov 07, 2016 at 06:26:17PM +0100, Sebastian Andrzej Siewior wrote:
> Subject: x86/mcheck: Split threshold_cpu_callback into two callbacks
> From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Date: Tue, 25 Oct 2016 18:04:25 +0200
>
> The threshold_cpu_callback callbacks looks like one of the notifier and
> its arguments are almost the same. Split this out and have one ONLINE
> and one DEAD callback. This will come handy later once the main code
> gets changed to use the callback mechanism.
> Also, handle threshold_cpu_callback_online() return value so we don't
> continue if the function fails.
>
> Boris Petkov removed the callback pointer and replaced it with proper
> functions.
>
> Cc: Tony Luck <tony.luck@xxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: linux-edac@xxxxxxxxxxxxxxx
> Cc: x86@xxxxxxxxxx
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> --- a/arch/x86/include/asm/mce.h
> +++ b/arch/x86/include/asm/mce.h
> @@ -293,9 +293,7 @@ void do_machine_check(struct pt_regs *,
> /*
> * Threshold handler
> */
> -
> extern void (*mce_threshold_vector)(void);
> -extern void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
>
> /* Deferred error interrupt handler */
> extern void (*deferred_error_int_vector)(void);
> @@ -377,7 +375,12 @@ struct smca_bank_info {
> };
>
> extern struct smca_bank_info smca_banks[MAX_NR_BANKS];
> +extern int mce_threshold_create_device(unsigned int cpu);
> +extern int mce_threshold_remove_device(unsigned int cpu);
> +#else
>
> +static inline int mce_threshold_create_device(unsigned int cpu) { return 0; };
> +static inline int mce_threshold_remove_device(unsigned int cpu) { return 0; };
> #endif
>
> #endif /* _ASM_X86_MCE_H */

Right, just a heads-up for tip guys: this second hunk will cause a merge
conflict with the other RAS changes:

Applying patch 21-x86-mcheck-split_threshold_cpu_callback_into_two_callbacks.patch
patching file arch/x86/include/asm/mce.h
Hunk #1 succeeded at 292 (offset -1 lines).
Hunk #2 FAILED at 375.
1 out of 2 hunks FAILED -- saving rejects to file arch/x86/include/asm/mce.h.rej

The fixup is easy though as it is only a contextual conflict due to
renaming of smca_bank_info to smca_bank:

Index: b/arch/x86/include/asm/mce.h
===================================================================
--- a/arch/x86/include/asm/mce.h 2016-11-07 19:12:14.309920731 +0100
+++ b/arch/x86/include/asm/mce.h 2016-11-07 19:13:47.521922219 +0100
@@ -292,9 +292,7 @@ void do_machine_check(struct pt_regs *,
/*
* Threshold handler
*/
-
extern void (*mce_threshold_vector)(void);
-extern void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);

/* Deferred error interrupt handler */
extern void (*deferred_error_int_vector)(void);
@@ -372,6 +370,11 @@ struct smca_bank {
extern struct smca_bank smca_banks[MAX_NR_BANKS];

extern const char *smca_get_long_name(enum smca_bank_types t);
+extern int mce_threshold_create_device(unsigned int cpu);
+extern int mce_threshold_remove_device(unsigned int cpu);
+#else
+static inline int mce_threshold_create_device(unsigned int cpu) { return 0; };
+static inline int mce_threshold_remove_device(unsigned int cpu) { return 0; };
#endif

#endif /* _ASM_X86_MCE_H */
---

Thanks!

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.