Re: [PATCH v2 x86 1/2] fix page faults by nmiaction in nmi ifkmemcheck is enabled

From: Li Zhong
Date: Mon Mar 05 2012 - 20:47:11 EST


On Mon, 2012-03-05 at 11:29 +0100, Wim Van Sebroeck wrote:
> Hi Li,
>
> > diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
> > index 8464ea1..e575e63 100644
> > --- a/drivers/watchdog/hpwdt.c
> > +++ b/drivers/watchdog/hpwdt.c
> > @@ -689,9 +689,22 @@ static void __devinit dmi_find_icru(const struct dmi_header *dm, void *dummy)
> > }
> > }
> >
> > +static struct nmiaction hpwdt_nmiaction[] = {
> > + {
> > + .handler = hpwdt_pretimeout,
> > + .name = "hpwdt",
> > + },
> > + {
> > + .handler = hpwdt_pretimeout,
> > + .flags = NMI_FLAG_FIRST,
> > + .name = "hpwdt",
> > + },
> > +};
> > +
> > static int __devinit hpwdt_init_nmi_decoding(struct pci_dev *dev)
> > {
> > int retval;
> > + struct nmiaction *na = hpwdt_nmiaction;
> >
> > /*
> > * On typical CRU-based systems we need to map that service in
> > @@ -733,9 +746,11 @@ static int __devinit hpwdt_init_nmi_decoding(struct pci_dev *dev)
> > * die notify list to handle a critical NMI. The default is to
> > * be last so other users of the NMI signal can function.
> > */
> > - retval = register_nmi_handler(NMI_UNKNOWN, hpwdt_pretimeout,
> > - (priority) ? NMI_FLAG_FIRST : 0,
> > - "hpwdt");
> > +
> > + if (priority)
> > + na = &hpwdt_nmiaction[1];
> > +
> > + retval = register_nmi_handler(NMI_UNKNOWN, na);
> > if (retval != 0) {
> > dev_warn(&dev->dev,
> > "Unable to register a die notifier (err=%d).\n",
>
> Why not do something like;
>
> static struct nmiaction hpwdt_nmiaction = {
> .handler = hpwdt_pretimeout,
> .name = "hpwdt",
> };
>
> ...
> if (priority)
> hpwdt_nmiaction.flags = NMI_FLAG_FIRST;
> ...
>

Thank you, Wim. I'll update it.

Thanks,
Zhong

> Kind regards,
> Wim.
>


--
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/