public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: john stultz <johnstul@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [RFC][PATCH -rt] irqd starvation on SMP by a single process?
Date: Fri, 12 May 2006 07:50:25 +0200	[thread overview]
Message-ID: <20060512055025.GA25824@elte.hu> (raw)
In-Reply-To: <1147401812.1907.14.camel@cog.beaverton.ibm.com>


* john stultz <johnstul@us.ibm.com> wrote:

> -		if (!cpu_isset(smp_processor_id(), irq_affinity[irq])) {
> -			mask = cpumask_of_cpu(any_online_cpu(irq_affinity[irq]));
> -			set_cpus_allowed(current, mask);
> -		}

this is intentional, not a bug. The point of the code above is to ensure 
that every IRQ handler is executed on one CPU. I.e. the irq threads are 
semi-affine - they are strictly affine when executing a handler, but 
they may switch CPUs if the affinity mask points it elsewhere.

but ... we might be able to relax that. Potentially some IRQ handlers 
might assume per-cpu-ness, but that should be uncovered by 
DEBUG_PREEMPT's smp_processor_id() checks.

> +		if(!cpus_equal(current->cpus_allowed, irq_affinity[irq]));
> +			set_cpus_allowed(current, irq_affinity[irq]);

> The patch below appears to correct this issue, however it also
> repeatedly(on different irqs) causes the following BUG:

ah. This actually uncovered a real bug. We were calling __do_softirq() 
with interrupts enabled (and being preemptible) - which is certainly 
bad.

this was hidden before because the smp_processor_id() debugging code 
handles tasks bound to a single CPU as per-cpu-safe.

could you check the (totally untested) patch below and see if that fixes 
things for you? I've also added your affinity change.

	Ingo

Index: linux-rt.q/kernel/irq/manage.c
===================================================================
--- linux-rt.q.orig/kernel/irq/manage.c
+++ linux-rt.q/kernel/irq/manage.c
@@ -717,24 +717,21 @@ static int do_irqd(void * __desc)
 	if (param.sched_priority > 25)
 		curr_irq_prio = param.sched_priority - 1;
 
-//	param.sched_priority = 1;
 	sys_sched_setscheduler(current->pid, SCHED_FIFO, &param);
 
 	while (!kthread_should_stop()) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		do_hardirq(desc);
 		cond_resched_all();
+		local_irq_disable();
 		__do_softirq();
-//		do_softirq_from_hardirq();
 		local_irq_enable();
 #ifdef CONFIG_SMP
 		/*
 		 * Did IRQ affinities change?
 		 */
-		if (!cpu_isset(smp_processor_id(), irq_affinity[irq])) {
-			mask = cpumask_of_cpu(any_online_cpu(irq_affinity[irq]));
-			set_cpus_allowed(current, mask);
-		}
+		if (!cpus_equal(current->cpus_allowed, irq_affinity[irq]));
+			set_cpus_allowed(current, irq_affinity[irq]);
 #endif
 		schedule();
 	}

  reply	other threads:[~2006-05-12  5:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-12  2:43 [RFC][PATCH -rt] irqd starvation on SMP by a single process? john stultz
2006-05-12  5:50 ` Ingo Molnar [this message]
2006-05-12  7:59   ` Steven Rostedt
2006-05-12  8:10     ` Ingo Molnar
2006-05-12 11:39     ` Mark Hounschell
2006-05-12 11:56       ` Ingo Molnar
2006-05-12 11:59         ` Mark Hounschell
2006-05-12 12:53         ` Mark Hounschell
2006-05-12 13:03           ` Steven Rostedt
2006-05-12 13:06             ` Mark Hounschell
2006-05-12 13:19             ` Mark Hounschell
2006-05-12 17:47   ` john stultz
2006-05-12 18:04   ` john stultz
2006-05-12 19:16     ` Mark Hounschell
2006-05-12 20:04     ` Mark Hounschell
  -- strict thread matches above, loose matches on Subject: below --
2006-05-12  4:22 Edward Killips

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=20060512055025.GA25824@elte.hu \
    --to=mingo@elte.hu \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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