Re: [PATCH] realtime-preempt patch-2.6.15-rt19 compile error (was: realtime-preempt patch-2.6.15-rt18 issues)

Ingo Molnar
2006-03-15T09:33:42Z

* karsten wiese <annabellesgarden@yahoo.de> wrote:

>
> --- Rui Nuno Capela <rncbc@rncbc.org> schrieb:
> > - The SLAB related usb-storage crash on disconnect is
> > still there:
>
> and its still in up to rc6-rt3, unless you apply attached patch. My
> uniprocessor behaves with it.

ah, indeed!

> Ingo, what exactly needs fixing here?

smp_call_function() will call things in a hardirq context, so calling
do_drain() from there [which uses preemptible spinlocks, etc.] is
unsafe. (it will work most of the time, but not all of the time) It
should rather be done from some per-CPU task.

a better fix would be the one below - it still does the call on the
current CPU, and skips other CPUs (on SMP). Does this solve the problem
on your box too?

Ingo

Index: linux-rt.q/mm/slab.c
===================================================================
--- linux-rt.q.orig/mm/slab.c
+++ linux-rt.q/mm/slab.c
@@ -2192,19 +2192,20 @@ static void check_spinlock_acquired_node
*/
static void smp_call_function_all_cpus(void (*func)(void *arg), void *arg)
{
- unsigned long flags;
+ unsigned int this_cpu;

check_irq_on();
- preempt_disable();
+// preempt_disable();

- slab_irq_disable(flags);
+ slab_irq_disable(this_cpu);
func(arg);
- slab_irq_enable(flags);
+ slab_irq_enable(this_cpu);

- if (smp_call_function(func, arg, 1, 1))
- BUG();
+// FIXME
+// if (smp_call_function(func, arg, 1, 1))
+// BUG();

- preempt_enable();
+// preempt_enable();
}

static void drain_array_locked(struct kmem_cache *cachep, struct array_cache *ac,
@@ -2231,8 +2232,7 @@ static void drain_cpu_caches(struct kmem
int this_cpu;
int node;

-// FIXME:
-// smp_call_function_all_cpus(do_drain, cachep);
+ smp_call_function_all_cpus(do_drain, cachep);
check_irq_on();
for_each_online_node(node) {
l3 = cachep->nodelists[node];