public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: C Hanish Menon <hanishkvc@yahoo.com>
To: Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Seems like a race or unhandled situation with ksoftirqd scheduling/management
Date: Tue, 21 May 2002 23:13:30 +0530	[thread overview]
Message-ID: <3CEA8742.2040308@yahoo.com> (raw)

Hi,

On a mips target to which I have added HAL for linux, I found that the 
system time wasn't going forward. On further look, I found that jiffies 
is getting updated properly (as expected), but ksoftirqd (and all its 
siblings tasklets, soft timers, bottom halves ...) aren't working.


This is the sequence of events that lead to the situation where 
ksoftirqd is left out in the cold.

   a) ksoftirqd gets scheduled

   b) ksoftirqd doesn't find any pending softirqs

   c) ksoftirqd gives back control to scheduler

   d) schedular REMOVES ksoftirqd from run_queue
	(TASK_INTERRUPTIBLE but no signal pending)

   e) timer interrupt occurs.

   f) timer interrupt handler sets mark_bh for TIMER_BH

   g) mark_bh inturn task_hi_schedules TIMER_BH related tasklet

   h) task_hi_schedule adds the tasklet to its list to process

   i) task_hi_schedule calls cpu_raise_softirq for this
	cpu and HI_SOFTIRQ

   j) cpu_raise_softirq sets the corresponding pending bit.

   k) cpu_raise_softirq DOESNOT wakeup_softirqd
      because currently its in INTERRUPT_CONTEXT. (local_irq_count)


   So if no other events occur with inturn could lead to the 
wakeup_softirqd being called, then ksoftirqd doesn't get into
run_queue and doesn't run. In my target currently only the
TIMER_BH uses the softirq based mechanism. And it won't trigger
ksoftirqd to be woken up.

   According to the comment in cpu_raise_softirq it doesn't 
wakeup_softirqd in irq context because on returning from a irq
softirqd will be run,  but it doesn't seem to be valid in any
architectures (have varified x86, mips). Because on returning
from irq context, just the scheduler gets called, but as
the ksoftirqd is not in the run queue, it won't get scheduled.

Only way ksoftirqd can get into the runqueue is if, wakeup_softirqd
gets called, which inturn occurs only from cpu_raise_softirqd. Which
can occur for my target only as part of mark_bh(TIMER_BH) (that to
only the 1st time it occurs), but which won't trigger wakeup_softirqd
because of interrupt context.

_Am I_ missing some other way ksoftirqd could endup in the run_queue. I
have looked around to some extent, but cann't see any other way how
ksoftirqd could get into the runqueue. Have to admit, haven't looked
fully into the linux scheduling logic, but logically I don't seem to
have left out any possibility.

My current Solution:

Currenlty I have just commented out the check for Interrupt and BH 
context in cpu_raise_softirqd before calling wakeup_softirqd. It works 
fine now. Also it doesn't seem to be a problem, because 
cpu_raise_softirqd seems to get called only if required and also there 
seems to be enough checks and bounds so that it doesn't get called 
repeatedly.


NOTE:

I am using 2.4.16 with linux-mips patchs (from sourceforge) for my linux 
port to the target. Regarding this problem, I have looked into linux 
2.4.18 and also linux-2.4.19pre4, the code leading to this situation
hasn't changed in them, so the problem should/will still be there.


Keep :-)
HanishKVC




             reply	other threads:[~2002-05-21 17:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-21 17:43 C Hanish Menon [this message]
     [not found] <3CEA8742.2040308@yahoo.com.suse.lists.linux.kernel>
2002-05-21 18:22 ` Seems like a race or unhandled situation with ksoftirqd scheduling/management Andi Kleen

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=3CEA8742.2040308@yahoo.com \
    --to=hanishkvc@yahoo.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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