linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH 1/3] lockdep/irq: Be more strict about IRQ-threadable code end
Date: Mon, 23 Mar 2020 17:31:05 +0100	[thread overview]
Message-ID: <20200323163105.GM2452@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20200323153039.GA5755@lenoir>

On Mon, Mar 23, 2020 at 04:30:40PM +0100, Frederic Weisbecker wrote:
> On Mon, Mar 23, 2020 at 02:53:20PM +0100, Peter Zijlstra wrote:
> > On Mon, Mar 23, 2020 at 04:32:05AM +0100, Frederic Weisbecker wrote:
> > > --- a/kernel/irq/handle.c
> > > +++ b/kernel/irq/handle.c
> > > @@ -144,18 +144,24 @@ irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags
> > >  
> > >  	for_each_action_of_desc(desc, action) {
> > >  		irqreturn_t res;
> > > +		bool threadable;
> > >  
> > >  		/*
> > >  		 * If this IRQ would be threaded under force_irqthreads, mark it so.
> > >  		 */
> > > -		if (irq_settings_can_thread(desc) &&
> > > -		    !(action->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT)))
> > > +		threadable = (irq_settings_can_thread(desc) &&
> > > +			      !(action->flags & (IRQF_NO_THREAD | IRQF_PERCPU | IRQF_ONESHOT)));
> > > +
> > > +		if (threadable)
> > >  			trace_hardirq_threaded();
> > >  
> > >  		trace_irq_handler_entry(irq, action);
> > >  		res = action->handler(irq, action->dev_id);
> > >  		trace_irq_handler_exit(irq, action, res);
> > >  
> > > +		if (threadable)
> > > +			trace_hardirq_unthreaded();
> > 
> > AFAICT this doesn't work for nested IRQ handlers.
> 
> So current->hardirq_threaded should be a counter perhaps?

Yeah, see how the old code used the hardirq_context counter for exactly
that. Also note how the old code was actually cheaper than this
(minimally, but still).

  reply	other threads:[~2020-03-23 16:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  3:32 [RFC PATCH 0/3] lockdep/irq: wait-type related cleanups Frederic Weisbecker
2020-03-23  3:32 ` [RFC PATCH 1/3] lockdep/irq: Be more strict about IRQ-threadable code end Frederic Weisbecker
2020-03-23 13:53   ` Peter Zijlstra
2020-03-23 15:30     ` Frederic Weisbecker
2020-03-23 16:31       ` Peter Zijlstra [this message]
2020-03-24  3:20         ` Frederic Weisbecker
2020-03-23  3:32 ` [RFC PATCH 2/3] lockdep: Merge hardirq_threaded and irq_config together Frederic Weisbecker
2020-03-23 14:02   ` Peter Zijlstra
2020-03-23 14:53     ` Sebastian Andrzej Siewior
2020-03-23 16:14       ` Frederic Weisbecker
2020-03-23  3:32 ` [RFC PATCH 3/3] lockdep: Briefly comment current->hardirq_threadable usecases Frederic Weisbecker

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=20200323163105.GM2452@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bigeasy@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).