From: Don Zickus <dzickus@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org, Andi Kleen <andi@firstfloor.org>,
Robert Richter <robert.richter@amd.com>,
ying.huang@intel.com, LKML <linux-kernel@vger.kernel.org>,
paulmck@linux.vnet.ibm.com
Subject: Re: [V3][PATCH 2/6] x86, nmi: create new NMI handler routines
Date: Fri, 26 Aug 2011 10:21:04 -0400 [thread overview]
Message-ID: <20110826142104.GW2067@redhat.com> (raw)
In-Reply-To: <1314351852.9377.1.camel@twins>
On Fri, Aug 26, 2011 at 11:44:12AM +0200, Peter Zijlstra wrote:
> On Thu, 2011-08-25 at 12:45 -0400, Don Zickus wrote:
> > +static int __setup_nmi(unsigned int type, struct nmiaction *action)
> > +{
> > + struct nmi_desc *desc = nmi_to_desc(type);
> > + struct nmiaction **a = &(desc->head);
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&desc->lock, flags);
> > +
> > + /*
> > + * some handlers need to be executed first otherwise a fake
> > + * event confuses some handlers (kdump uses this flag)
> > + */
> > + if (!(action->flags & NMI_FLAG_FIRST))
> > + while ((*a) != NULL)
> > + a = &((*a)->next);
> > +
> > + action->next = *a;
> > + rcu_assign_pointer(*a, action);
> > +
> > + spin_unlock_irqrestore(&desc->lock, flags);
> > + return 0;
> > +}
> > +
> > +static struct nmiaction *__free_nmi(unsigned int type, const char *name)
> > +{
> > + struct nmi_desc *desc = nmi_to_desc(type);
> > + struct nmiaction *n, **np = &(desc->head);
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&desc->lock, flags);
> > +
> > + while ((*np) != NULL) {
> > + n = *np;
> > +
> > + /*
> > + * the name passed in to describe the nmi handler
> > + * is used as the lookup key
> > + */
> > + if (!strcmp(n->name, name)) {
> > + WARN(in_nmi(),
> > + "Trying to free NMI (%s) from NMI context!\n", n->name);
> > + rcu_assign_pointer(*np, n->next);
> > + break;
> > + }
> > + np = &(n->next);
> > + }
> > +
> > + spin_unlock_irqrestore(&desc->lock, flags);
> > + synchronize_rcu();
> > + return (*np);
> > +}
>
> Probably not worth fixing, but if someone was silly enough to register
> with an already existing name we're up shit creek, right? :-)
Hmm, I thought I put a check in there during registration to prevent that.
Guess not. But yeah, I thought about doing that just to have one less
thing bite me later.
Cheers,
Don
next prev parent reply other threads:[~2011-08-26 14:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 16:45 [V3][PATCH 0/6] x86, nmi: new NMI handling routines Don Zickus
2011-08-25 16:45 ` [V3][PATCH 1/6] x86, nmi: split out nmi from traps.c Don Zickus
2011-08-25 16:45 ` [V3][PATCH 2/6] x86, nmi: create new NMI handler routines Don Zickus
2011-08-26 9:44 ` Peter Zijlstra
2011-08-26 14:21 ` Don Zickus [this message]
2011-09-06 10:08 ` Robert Richter
2011-09-06 16:53 ` Don Zickus
2011-08-25 16:45 ` [V3][PATCH 3/6] x86, nmi: wire up NMI handlers to new routines Don Zickus
2011-09-06 16:15 ` Robert Richter
2011-09-06 16:52 ` Don Zickus
2011-09-07 9:03 ` Borislav Petkov
2011-09-06 17:20 ` Corey Minyard
2011-09-06 17:49 ` Don Zickus
2011-09-06 17:59 ` Corey Minyard
2011-08-25 16:45 ` [V3][PATCH 4/6] x86, nmi: add in logic to handle multiple events and unknown NMIs Don Zickus
2011-09-06 16:18 ` Robert Richter
2011-08-25 16:45 ` [V3][PATCH 5/6] x86, nmi: track NMI usage stats Don Zickus
2011-08-25 16:45 ` [V3][PATCH 6/6] x86, nmi: print out NMI stats in /proc/interrupts Don Zickus
2011-09-06 16:39 ` Robert Richter
2011-09-06 17:40 ` Don Zickus
2011-08-26 9:44 ` [V3][PATCH 0/6] x86, nmi: new NMI handling routines Peter Zijlstra
2011-08-26 14:39 ` Don Zickus
2011-08-26 14:51 ` Peter Zijlstra
2011-09-06 16:43 ` Robert Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110826142104.GW2067@redhat.com \
--to=dzickus@redhat.com \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=x86@kernel.org \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox