public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Mukesh Ojha <quic_mojha@quicinc.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	tglx@linutronix.de, paulmck@kernel.org, will@kernel.org,
	dave@stgolabs.net
Subject: Re: [PATCH] softirq: Remove raise_softirq from tasklet_action_common()
Date: Wed, 9 Feb 2022 00:04:55 +0100	[thread overview]
Message-ID: <20220208230455.GA539926@lothringen> (raw)
In-Reply-To: <1644066805-17212-1-git-send-email-quic_mojha@quicinc.com>

On Sat, Feb 05, 2022 at 06:43:25PM +0530, Mukesh Ojha wrote:
> Think about a scenario when all other cores are in suspend
> and one core is only running ksoftirqd and it is because
> some client has invoked tasklet_hi_schedule() only once
> during that phase.
> 
> tasklet_action_common() handles that softirq and marks the
> same softirq as pending again. And due to that core keeps
> running the softirq handler [1] forever and it is not able to
> go to suspend.
> 
> We can get rid of raising softirq from tasklet handler.
> 
> [1]
> <idle>-0    [003]   13058.769081:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13058.769085: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13058.769087:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13058.769091:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13058.769094: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13058.769097:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13058.769100:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13058.769103: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13058.769106:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13058.769109:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13059.058923:  softirq_entry   vec=0  action=HI_SOFTIRQ
> ...
> ..
> ..
> ..
> 
> <idle>-0    [003]   13059.058951:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13059.058954: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13059.058957:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13059.058960:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13059.058963: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13059.058966:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13059.058969:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13059.058972: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13059.058975:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13059.058978:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13059.058981: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13059.058984:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13059.058987:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13059.058990: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13059.058993:  softirq_exit   vec=0  action=HI_SOFTIRQ
> <idle>-0    [003]   13059.058996:  softirq_entry   vec=0  action=HI_SOFTIRQ
> <idle>-0     [003]  13059.059000: softirq_raise:        vec=0 [action=HI_SOFTIRQ]
> <idle>-0    [003]   13059.059002:  softirq_exit   vec=0  action=HI_SOFTIRQ
> 
> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
> ---
>  kernel/softirq.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/softirq.c b/kernel/softirq.c
> index 41f4709..d3e6fb9 100644
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -795,7 +795,6 @@ static void tasklet_action_common(struct softirq_action *a,
>  		t->next = NULL;
>  		*tl_head->tail = t;
>  		tl_head->tail = &t->next;
> -		__raise_softirq_irqoff(softirq_nr);
>  		local_irq_enable();

That requeue happens when the tasklet is already executing on some other CPU
or when it has been disabled through tasklet_disable().

So you can't just remove that line or you'll break everything.

It would be nice to identify which tasklet keeps being requeued. Is it because
something called tasklet_disable() to it and never called back tasklet_enable() ?

Thanks.

  parent reply	other threads:[~2022-02-09  2:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 13:13 [PATCH] softirq: Remove raise_softirq from tasklet_action_common() Mukesh Ojha
2022-02-08 13:40 ` Mukesh Ojha
2022-02-08 23:04 ` Frederic Weisbecker [this message]
2022-02-21 11:18   ` Mukesh Ojha
2022-02-23 15:50     ` Mukesh Ojha

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=20220208230455.GA539926@lothringen \
    --to=frederic@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=quic_mojha@quicinc.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    /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