kthread: convert stop_machine into a kthread
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Paul Mackerras
Update
stop_machine.cto spawnstop_machineas kthreads rather than the deprecatedkernel_threads.Signed-off-by Serge E. Hallyn <[email protected]>
kthread does a lot of stuff we don't need, and stop_machine is fairly special, low-level interface.
Seems like change for change's sake, to me, *and* it added more code than it removed.
Rusty.
Signature · 1 line
Help! Save Australia from the worst of the DMCA: http://linux.org.au/law
Quoted 11 lines · Rusty Russell
Quoted 4 lines · Paul Mackerras
Update
stop_machine.cto spawnstop_machineas kthreads rather than the deprecatedkernel_threads.Signed-off-by Serge E. Hallyn <[email protected]>kthread does a lot of stuff we don't need, and
stop_machineis fairly special, low-level interface.Seems like change for change's sake, to me, *and* it added more code than it removed.
So if kernel_thread is really going to be removed, how else should this be done? Just clone?
-serge
Quoted 2 lines · Serge E. Hallyn
So if
kernel_threadis really going to be removed, how else should this be done? Just clone?
Who said kernel_thread was going to be removed? kthread *uses* kernel_thread. kthread is a helper to make life easier for drivers, not a replacement for kernel_thread.
Paul.
Quoted 6 lines · Serge E. Hallyn
Quoted 2 lines · Rusty Russell
Seems like change for change's sake, to me, *and* it added more code than it removed.
So if
kernel_threadis really going to be removed, how else should this be done? Just clone?
Sorry, is kernel_thread going to be removed, or just not exported to modules? What's kthread going to use?
Confused,
Rusty.
Signature · 1 line
Help! Save Australia from the worst of the DMCA: http://linux.org.au/law
Quoted 5 lines · Rusty Russell
Quoted 4 lines · Serge E. Hallyn
Quoted 2 lines · Rusty Russell
Seems like change for change's sake, to me, *and* it added more code than it removed.
Quoted 8 lines
Quoted 2 lines
So if
kernel_threadis really going to be removed, how else should this be done? Just clone?Sorry, is
kernel_threadgoing to be removed, or just not exported to modules? What's kthread going to use?Confused,
Rusty.
Hah.
Yes, I see. I misread. So I should be focusing on modules :)
Really, all *I* care about is cases where the resulting pid is cached as a pointer to the thread, which it wasn't here anyway.
thanks, sorry for the noise.
-serge
Quoted 15 lines · Serge E. Hallyn
Quoted 5 lines · Rusty Russell
Quoted 4 lines · Serge E. Hallyn
Quoted 2 lines · Rusty Russell
Seems like change for change's sake, to me, *and* it added more code than it removed.
Quoted 8 lines
Quoted 2 lines
So if
kernel_threadis really going to be removed, how else should this be done? Just clone?Sorry, is
kernel_threadgoing to be removed, or just not exported to modules? What's kthread going to use?Confused,
Rusty.
Quoted 6 lines
Hah.
Yes, I see. I misread. So I should be focusing on modules :)
Really, all *I* care about is cases where the resulting pid is cached as a pointer to the thread, which it wasn't here anyway.
There is one other piece we care about as well.
We don't want to capture user space context like a non-default fs namespace in a kernel thread as well. Since the kthread api calls kernel_thread from keventd non of the threads that it spawns can capture any user space context, by accident. There was a very nasty bug a while ago when the fs namespace was captured by a kernel thread and then it was impossible to unmount your filesystem because no one had access to that filesystem mount tree.
In this instance the kstopmachine is stared using the kthread api so it is safe, and then forking children is safe as well.
Once everything that we can convert to the kthread api is converted we need to audit all of the remaining kernel_thread instances to ensure they don't capture user space context.
The basic rule is that is only safe to use kernel_thread directly if it is coming from another kernel thread.
So while the conversion was overkill in this context and we certainly want to concentrate on modules, where it is much less likely to be correct. We want to convert as many instances as we can away from the raw kernel_thread api.
All that is ultimately going away is the export of kernel_thread to modules, because there are so very few instances when using kernel_thread directly can be justified.
Eric