Re: [PATCH 3/6] x86, NMI: Add priorities to handlers
From: Peter Zijlstra
Date: Fri Jan 07 2011 - 08:09:31 EST
On Thu, 2011-01-06 at 16:18 -0500, Don Zickus wrote:
> In order to consolidate the NMI die_chain events, we need to setup the priorities
> for the die notifiers.
>
> I started by defining a bunch of common priorities that can be used by the
> notifier blocks. Then I modified the notifier blocks to use the newly created
> priorities.
>
> Now that the priorities are straightened out, it should be easier to remove the
> event DIE_NMI_IPI.
>
> Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
> ---
> arch/x86/include/asm/nmi.h | 20 ++++++++++++++++++++
> arch/x86/kernel/apic/hw_nmi.c | 2 +-
> arch/x86/kernel/cpu/mcheck/mce-inject.c | 2 +-
> arch/x86/kernel/cpu/perf_event.c | 2 +-
> arch/x86/kernel/kgdb.c | 2 +-
> arch/x86/kernel/reboot.c | 2 ++
> arch/x86/oprofile/nmi_int.c | 2 +-
> arch/x86/oprofile/nmi_timer_int.c | 2 +-
> 8 files changed, 28 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
> index c4021b9..fb82fb6 100644
> --- a/arch/x86/include/asm/nmi.h
> +++ b/arch/x86/include/asm/nmi.h
> @@ -23,6 +23,26 @@ void arch_trigger_all_cpu_backtrace(void);
> #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
> #endif
>
> +/*
> + * Define some priorities for the nmi notifier call chain.
> + *
> + * Create a local nmi bit that has a higher priority than
> + * external nmis, because the local ones are more frequent.
> + *
> + * Also setup some default high/normal/low settings for
> + * subsystems to registers with. Using 4 bits to seperate
> + * the priorities. This can go alot higher if needed be.
> + */
> +
> +#define NMI_LOCAL_SHIFT 16 /* randomly picked */
> +#define NMI_LOCAL_BIT (1ULL << NMI_LOCAL_SHIFT)
> +#define NMI_HIGH_PRIOR (1ULL << 8)
> +#define NMI_NORMAL_PRIOR (1ULL << 4)
> +#define NMI_LOW_PRIOR (1ULL << 0)
> +#define NMI_LOCAL_HIGH_PRIOR (NMI_LOCAL_BIT | NMI_HIGH_PRIOR)
> +#define NMI_LOCAL_NORMAL_PRIOR (NMI_LOCAL_BIT | NMI_NORMAL_PRIOR)
> +#define NMI_LOCAL_LOW_PRIOR (NMI_LOCAL_BIT | NMI_LOW_PRIOR)
> +
> void stop_nmi(void);
> void restart_nmi(void);
>
> static struct event_constraint unconstrained;
> diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
> index cd21b65..983fb54 100644
> --- a/arch/x86/kernel/kgdb.c
> +++ b/arch/x86/kernel/kgdb.c
> @@ -606,7 +606,7 @@ static struct notifier_block kgdb_notifier = {
> /*
> * Lowest-prio notifier priority, we want to be notified last:
> */
> - .priority = -INT_MAX,
> + .priority = NMI_LOCAL_LOW_PRIOR,
> };
>
> /**
I had to add the below to make things build here.
---
Index: linux-2.6/arch/x86/kernel/kgdb.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/kgdb.c
+++ linux-2.6/arch/x86/kernel/kgdb.c
@@ -48,6 +48,7 @@
#include <asm/apicdef.h>
#include <asm/system.h>
#include <asm/apic.h>
+#include <asm/nmi.h>
struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
{
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/