Re: RCU can use cpu_active_map?

From: Alex Chiang
Date: Mon Feb 09 2009 - 17:50:19 EST


* Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>:
> On Mon, Feb 09, 2009 at 01:13:45PM -0700, Alex Chiang wrote:
> > Paul,
> >
> > I don't pretend to understand RCU, but a very quick and naive
> > look through rcupreempt.c makes me think that we could use the
> > cpu_active_map instead of cpu_online_map?
> >
> > cpu_active_map was introduced by e761b772.
> >
> > In the CPU hotplug path, we touch the cpu_active_map very early
> > on:
> >
> > int __ref cpu_down(unsigned int cpu)
> > {
> > int err;
> > err = stop_machine_create();
> > if (err)
> > return err;
> > cpu_maps_update_begin();
> >
> > if (cpu_hotplug_disabled) {
> > err = -EBUSY;
> > goto out;
> > }
> >
> > cpu_clear(cpu, cpu_active_map);
> > /* ... */
> > synchronize_sched();
> > err = _cpu_down(cpu, 0);
> > if (cpu_online(cpu))
> > cpu_set(cpu, cpu_active_map);
> >
> > out:
> > cpu_maps_update_done();
> > stop_machine_destroy();
> > return err;
> > }
> >
> > The call to _cpu_down() is where we eventually get to the code
> > that my patch below touches, so you can see that we mark the CPU
> > as !active before we ever get to the step of migrating interrupts
> > (which relies on cpu_online_map).
> >
> > If RCU looked at cpu_active_map instead of cpu_online_map, it
> > seems like we would avoid the potential race situation you
> > mentioned earlier.
> >
> > Alternatively, I could explore just playing with the ia64
> > interrupt migration code to use cpu_active_mask instead, but
> > wanted to get your thoughts from the RCU perspective.
>
> Perhaps I am confused, but if the CPU is on its way down, doesn't RCU
> need a mask where the CPU's bit stays set longer rather than shorter?
>
> If I use cpu_active_mask, couldn't there be device interrupts during
> (for example) the synchronize_sched(), which might have RCU read-side
> critical sections that RCU needs to pay attention to?

Hm, I think you're right.

Thanks.

/ac

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/