All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.4 preempt kernel patch
@ 2004-05-28  4:12 Atsushi Nemoto
  2004-05-28 17:51 ` Jun Sun
  0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Nemoto @ 2004-05-28  4:12 UTC (permalink / raw)
  To: linux-mips; +Cc: jsun

Hi.  I'm investigating preempt patch for 2.4 kernel.  (MIPS part of
preempt-kernel-rml-2.4.26-pre5-1.patch seems a bit old.  I'm looking
Jun Sun's 030304-b.preempt-mips.patch).

The patch contains following block (end of
arch/mips/kernel/irq.c:do_IRQ()):

 
 	if (softirq_pending(cpu))
 		do_softirq();
+
+#if defined(CONFIG_PREEMPT)
+	for(;;) {
+		preempt_enable_no_resched();
+		if (preempt_is_disabled() || !need_resched())
+			break;
+
+		db_assert(intr_off());
+		db_assert(!in_interrupt());
+
+		preempt_disable();
+		__sti();
+		preempt_schedule();
+		__cli();
+	}
+#endif
+
 	return 1;
 }
 

Q1.  What is purpose of this block?  (To decrease latency?  But other
archs (and 2.6 MIPS kernel) do not have block like this...)

Q2.  If an interrupt happened between __sti() and __cli(), and the
interrupt handler raise softirq, the softirq handler will not be
called soon (because do_softirq() immediately return if preempt
disabled).  So we must check softirq_pending again after this block?

Thank you.
---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.4 preempt kernel patch
  2004-05-28  4:12 2.4 preempt kernel patch Atsushi Nemoto
@ 2004-05-28 17:51 ` Jun Sun
  2004-05-29 13:45   ` Atsushi Nemoto
  0 siblings, 1 reply; 3+ messages in thread
From: Jun Sun @ 2004-05-28 17:51 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips, jsun

On Fri, May 28, 2004 at 01:12:36PM +0900, Atsushi Nemoto wrote:
> Hi.  I'm investigating preempt patch for 2.4 kernel.  (MIPS part of
> preempt-kernel-rml-2.4.26-pre5-1.patch seems a bit old.  I'm looking
> Jun Sun's 030304-b.preempt-mips.patch).
> 
> The patch contains following block (end of
> arch/mips/kernel/irq.c:do_IRQ()):
> 
>  
>  	if (softirq_pending(cpu))
>  		do_softirq();
> +
> +#if defined(CONFIG_PREEMPT)
> +	for(;;) {
> +		preempt_enable_no_resched();
> +		if (preempt_is_disabled() || !need_resched())
> +			break;
> +
> +		db_assert(intr_off());
> +		db_assert(!in_interrupt());
> +
> +		preempt_disable();
> +		__sti();
> +		preempt_schedule();
> +		__cli();
> +	}
> +#endif
> +
>  	return 1;
>  }
>  
> 
> Q1.  What is purpose of this block?  (To decrease latency?  But other
> archs (and 2.6 MIPS kernel) do not have block like this...)
> 

This is to check possible preemption at the end of (possibly nested)
interrupt handling.

All other arches and 2.6 MIPS are doing the same thing in .S file
(something like ret_from_irq path)

> Q2.  If an interrupt happened between __sti() and __cli(), and the
> interrupt handler raise softirq, the softirq handler will not be
> called soon (because do_softirq() immediately return if preempt
> disabled).  So we must check softirq_pending again after this block?
> 

do_softirq() does not (and should not) return when preemtpion is disabled.  
We should be fine here.

Jun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.4 preempt kernel patch
  2004-05-28 17:51 ` Jun Sun
@ 2004-05-29 13:45   ` Atsushi Nemoto
  0 siblings, 0 replies; 3+ messages in thread
From: Atsushi Nemoto @ 2004-05-29 13:45 UTC (permalink / raw)
  To: jsun; +Cc: linux-mips

>>>>> On Fri, 28 May 2004 10:51:51 -0700, Jun Sun <jsun@mvista.com> said:

>> Q1.  What is purpose of this block?  (To decrease latency?  But
>> other archs (and 2.6 MIPS kernel) do not have block like this...)

jsun> This is to check possible preemption at the end of (possibly
jsun> nested) interrupt handling.

jsun> All other arches and 2.6 MIPS are doing the same thing in .S
jsun> file (something like ret_from_irq path)

Oh, I found it in 2.6 MIPS kernel.  Thank you very much.

>> Q2.  If an interrupt happened between __sti() and __cli(), and the
>> interrupt handler raise softirq, the softirq handler will not be
>> called soon (because do_softirq() immediately return if preempt
>> disabled).  So we must check softirq_pending again after this
>> block?

jsun> do_softirq() does not (and should not) return when preemtpion is
jsun> disabled.  We should be fine here.

Sorry, it was my mistake.  I was misreading the in_interrupt()
code... (&& and ||).  Thank you.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-29 13:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-28  4:12 2.4 preempt kernel patch Atsushi Nemoto
2004-05-28 17:51 ` Jun Sun
2004-05-29 13:45   ` Atsushi Nemoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.