[PATCH v5] um: Enable preemption in UML

Johannes Berg johannes at sipsolutions.net
Fri Sep 22 02:10:32 PDT 2023


On Fri, 2023-09-22 at 10:06 +0100, Anton Ivanov wrote:
> On 22/09/2023 09:41, Johannes Berg wrote:
> > > Yes, but when does the fork actually happen?
> > > 
> > Looking further at this, now I'm confused as to why it doesn't happen
> > _all_ the time.
> > 
> > I think this has pretty much always been wrong, just now we actually
> > notice it?
> > 
> > Basically, when we create a new thread (really just mm I think), we say
> > the first thing that has to run there is fork_handler(), which
> > initialises things the first time around. This calls force_flush_all()
> > 
> > But of course it's called from __schedule(), which has
> > preemption/interrupts disabled. So you can't do mmap_read_lock()?
> 
> Stupid question.
> 
> If we have preemption and interrupts disabled and we are UP do we really need to lock it at this point?

Heh.

Functionally, I guess not. But lockdep gets really unhappy about stuff
in there:

=============================
WARNING: suspicious RCU usage
6.6.0-rc1 #159 Not tainted
-----------------------------
lib/maple_tree.c:840 suspicious rcu_dereference_check() usage!

other info that might help us debug this:


rcu_scheduler_active = 2, debug_locks = 1
no locks held by startup.sh/282.

stack backtrace:
CPU: 0 PID: 282 Comm: startup.sh Not tainted 6.6.0-rc1 #159
Stack:
 71a9bdd0 605001f3 00000000 6003cf40
 606bd782 00000000 60b3e968 00000000
 71a9be10 60526292 00000082 6051cb2a
Call Trace:
 [<6051cb2a>] ? _printk+0x0/0x94
 [<6002a5b4>] show_stack+0x13d/0x14c
 [<605001f3>] ? dump_stack_print_info+0xde/0xed
 [<6003cf40>] ? um_set_signals+0x0/0x3f
 [<60526292>] dump_stack_lvl+0x62/0x96
 [<6051cb2a>] ? _printk+0x0/0x94
 [<605262e0>] dump_stack+0x1a/0x1c
 [<6008865e>] lockdep_rcu_suspicious+0x10d/0x11c
 [<6052721b>] ? debug_lockdep_rcu_enabled+0x0/0x3b
 [<6052721b>] ? debug_lockdep_rcu_enabled+0x0/0x3b
 [<605085cd>] mas_root+0x86/0x91
 [<60508547>] ? mas_root+0x0/0x91
 [<60508611>] mas_start+0x39/0x9c
 [<60508875>] ? mas_state_walk+0x0/0x3e
 [<6050888d>] mas_state_walk+0x18/0x3e
 [<605088f1>] mas_walk+0x3e/0x96
 [<60508a03>] mas_find_setup+0xba/0xcd
 [<60509d49>] ? mas_find+0x0/0x4a
 [<60509d71>] mas_find+0x28/0x4a
 [<6002c92b>] force_flush_all+0x51/0x7c
 [<6002926e>] fork_handler+0x14/0x96


johannes



More information about the linux-um mailing list