* [PATCH/RFC] signal: Export signal_wake_up_state() to modules @ 2017-05-05 9:49 Geert Uytterhoeven [not found] ` <1493977751-19340-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2017-05-05 9:49 UTC (permalink / raw) To: Ingo Molnar, Peter Zijlstra, Oleg Nesterov, Thomas Gleixner Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven When using signal_wake_up() from a loadable kernel module: ERROR: "signal_wake_up_state" [drivers/spi/spi-sh-msiof.ko] undefined! Export signal_wake_up_state() to modules to fix this. Reported-by: kbuild test robot <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> --- I'm using signal_wake_up() to abort a task blocked on wait_for_completion_interruptible(), cfr. sh_msiof_slave_abort() in "spi: sh-msiof: Add slave mode support" (http://www.spinics.net/lists/devicetree/msg175575.html). Is exporting signal_wake_up_state() an acceptable solution? Alternatively, I can extract the code to abort an completion into a generic abort_completion() function, and export that. Or is there a better way to abort a completion? Thanks! --- kernel/signal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/signal.c b/kernel/signal.c index 7e59ebc2c25e669e..f130598acd34f08b 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -660,6 +660,7 @@ void signal_wake_up_state(struct task_struct *t, unsigned int state) if (!wake_up_state(t, state | TASK_INTERRUPTIBLE)) kick_process(t); } +EXPORT_SYMBOL_GPL(signal_wake_up_state); /* * Remove signals in mask from the pending set and queue. -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <1493977751-19340-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>]
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules [not found] ` <1493977751-19340-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> @ 2017-05-05 10:07 ` Christoph Hellwig [not found] ` <20170505100729.GA21589-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> 2017-05-06 19:42 ` Oleg Nesterov 1 sibling, 1 reply; 8+ messages in thread From: Christoph Hellwig @ 2017-05-05 10:07 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Ingo Molnar, Peter Zijlstra, Oleg Nesterov, Thomas Gleixner, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA On Fri, May 05, 2017 at 11:49:11AM +0200, Geert Uytterhoeven wrote: > When using signal_wake_up() from a loadable kernel module: > > ERROR: "signal_wake_up_state" [drivers/spi/spi-sh-msiof.ko] undefined! > > Export signal_wake_up_state() to modules to fix this. Or rever the commit that added the users. This doesn't look like functionality a driver should use.. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20170505100729.GA21589-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>]
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules [not found] ` <20170505100729.GA21589-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> @ 2017-05-05 10:13 ` Geert Uytterhoeven 2017-05-05 11:08 ` Geert Uytterhoeven 0 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2017-05-05 10:13 UTC (permalink / raw) To: Christoph Hellwig Cc: Geert Uytterhoeven, Ingo Molnar, Peter Zijlstra, Oleg Nesterov, Thomas Gleixner, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi Hi Christoph, On Fri, May 5, 2017 at 12:07 PM, Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> wrote: > On Fri, May 05, 2017 at 11:49:11AM +0200, Geert Uytterhoeven wrote: >> When using signal_wake_up() from a loadable kernel module: >> >> ERROR: "signal_wake_up_state" [drivers/spi/spi-sh-msiof.ko] undefined! >> >> Export signal_wake_up_state() to modules to fix this. > > Or rever the commit that added the users. This doesn't look like That commit is not yet applied. > functionality a driver should use.. OK. Then, do you have any advise on how to properly abort a completion? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules 2017-05-05 10:13 ` Geert Uytterhoeven @ 2017-05-05 11:08 ` Geert Uytterhoeven [not found] ` <CAMuHMdVUymKQzt9Rk1mgXxJdVD1O8yFQ6CxFAZDiLRDM795-Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Geert Uytterhoeven @ 2017-05-05 11:08 UTC (permalink / raw) To: Christoph Hellwig Cc: Geert Uytterhoeven, Ingo Molnar, Peter Zijlstra, Oleg Nesterov, Thomas Gleixner, linux-kernel@vger.kernel.org, linux-spi On Fri, May 5, 2017 at 12:13 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Fri, May 5, 2017 at 12:07 PM, Christoph Hellwig <hch@infradead.org> wrote: >> On Fri, May 05, 2017 at 11:49:11AM +0200, Geert Uytterhoeven wrote: >>> When using signal_wake_up() from a loadable kernel module: >>> >>> ERROR: "signal_wake_up_state" [drivers/spi/spi-sh-msiof.ko] undefined! >>> >>> Export signal_wake_up_state() to modules to fix this. >> >> Or rever the commit that added the users. This doesn't look like > > That commit is not yet applied. > >> functionality a driver should use.. > > OK. > > Then, do you have any advise on how to properly abort a completion? Of course I can add a flag to indicate abortion, and just call complete_all(), but IMHO that's a bit silly, given wait_for_completion_interruptible() already provides this side channel information through -ERESTARTSYS. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAMuHMdVUymKQzt9Rk1mgXxJdVD1O8yFQ6CxFAZDiLRDM795-Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules [not found] ` <CAMuHMdVUymKQzt9Rk1mgXxJdVD1O8yFQ6CxFAZDiLRDM795-Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-05-05 11:22 ` Christoph Hellwig 2017-05-05 11:35 ` Geert Uytterhoeven 0 siblings, 1 reply; 8+ messages in thread From: Christoph Hellwig @ 2017-05-05 11:22 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Christoph Hellwig, Geert Uytterhoeven, Ingo Molnar, Peter Zijlstra, Oleg Nesterov, Thomas Gleixner, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi On Fri, May 05, 2017 at 01:08:47PM +0200, Geert Uytterhoeven wrote: > Of course I can add a flag to indicate abortion, and just call complete_all(), > but IMHO that's a bit silly, given wait_for_completion_interruptible() already > provides this side channel information through -ERESTARTSYS. Even if this was the right channel (which I'm not sure about) it should be provided as an abstract API operating on the completion. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules 2017-05-05 11:22 ` Christoph Hellwig @ 2017-05-05 11:35 ` Geert Uytterhoeven 0 siblings, 0 replies; 8+ messages in thread From: Geert Uytterhoeven @ 2017-05-05 11:35 UTC (permalink / raw) To: Christoph Hellwig Cc: Geert Uytterhoeven, Ingo Molnar, Peter Zijlstra, Oleg Nesterov, Thomas Gleixner, linux-kernel@vger.kernel.org, linux-spi Hi Christoph, On Fri, May 5, 2017 at 1:22 PM, Christoph Hellwig <hch@infradead.org> wrote: > On Fri, May 05, 2017 at 01:08:47PM +0200, Geert Uytterhoeven wrote: >> Of course I can add a flag to indicate abortion, and just call complete_all(), >> but IMHO that's a bit silly, given wait_for_completion_interruptible() already >> provides this side channel information through -ERESTARTSYS. > > Even if this was the right channel (which I'm not sure about) it > should be provided as an abstract API operating on the completion. Hence my other question in the patch comments: | Is exporting signal_wake_up_state() an acceptable solution? | Alternatively, I can extract the code to abort an completion into a | generic abort_completion() function, and export that. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules [not found] ` <1493977751-19340-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> 2017-05-05 10:07 ` Christoph Hellwig @ 2017-05-06 19:42 ` Oleg Nesterov [not found] ` <20170506194256.GA21726-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 1 sibling, 1 reply; 8+ messages in thread From: Oleg Nesterov @ 2017-05-06 19:42 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Ingo Molnar, Peter Zijlstra, Thomas Gleixner, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-spi-u79uwXL29TY76Z2rM5mHXA On 05/05, Geert Uytterhoeven wrote: > > I'm using signal_wake_up() to abort a task blocked on > wait_for_completion_interruptible(), cfr. sh_msiof_slave_abort() in > "spi: sh-msiof: Add slave mode support" > (http://www.spinics.net/lists/devicetree/msg175575.html). > > Is exporting signal_wake_up_state() an acceptable solution? > Alternatively, I can extract the code to abort an completion into a > generic abort_completion() function, and export that. I too do not think this is a good idea... signal_wake_up() or even set_tsk_thread_flag() should never be used unless you actually send a signal. Yes, freeze_task() does this too but note that recalc_sigpending() checks freezing() and in this case we really want the target to enter the get_signal() path. And in fact I do not really understand why do you need it, it seems that you can easily rework this code and avoid this hack. Not to mention that sh_msiof_slave_abort() plays with struct completion internals, this doesn't look good too. Finally, clear_thread_flag(TIF_SIGPENDING) in sh_msiof_wait_for_completion() looks wrong. Or it is only for kthreads? Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20170506194256.GA21726-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules [not found] ` <20170506194256.GA21726-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2017-05-07 9:47 ` Geert Uytterhoeven 0 siblings, 0 replies; 8+ messages in thread From: Geert Uytterhoeven @ 2017-05-07 9:47 UTC (permalink / raw) To: Oleg Nesterov Cc: Geert Uytterhoeven, Ingo Molnar, Peter Zijlstra, Thomas Gleixner, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi Hi Oleg, On Sat, May 6, 2017 at 9:42 PM, Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > On 05/05, Geert Uytterhoeven wrote: >> I'm using signal_wake_up() to abort a task blocked on >> wait_for_completion_interruptible(), cfr. sh_msiof_slave_abort() in >> "spi: sh-msiof: Add slave mode support" >> (http://www.spinics.net/lists/devicetree/msg175575.html). >> >> Is exporting signal_wake_up_state() an acceptable solution? >> Alternatively, I can extract the code to abort an completion into a >> generic abort_completion() function, and export that. > > I too do not think this is a good idea... signal_wake_up() or even > set_tsk_thread_flag() should never be used unless you actually send a > signal. Yes, freeze_task() does this too but note that recalc_sigpending() > checks freezing() and in this case we really want the target to enter the > get_signal() path. > > And in fact I do not really understand why do you need it, it seems that > you can easily rework this code and avoid this hack. You mean having my own aborted flag, and calling complete_all()? > Not to mention that sh_msiof_slave_abort() plays with struct completion > internals, this doesn't look good too. One reason to turn it into a generic abort_completion() function... > Finally, clear_thread_flag(TIF_SIGPENDING) in sh_msiof_wait_for_completion() > looks wrong. Or it is only for kthreads? If I don't clear that flag, the next (by the same thread[*]) wait_for_completion_interruptible() will abort immediately. [*] Typically this is the spi message pump worker. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-05-07 9:47 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-05 9:49 [PATCH/RFC] signal: Export signal_wake_up_state() to modules Geert Uytterhoeven [not found] ` <1493977751-19340-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org> 2017-05-05 10:07 ` Christoph Hellwig [not found] ` <20170505100729.GA21589-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> 2017-05-05 10:13 ` Geert Uytterhoeven 2017-05-05 11:08 ` Geert Uytterhoeven [not found] ` <CAMuHMdVUymKQzt9Rk1mgXxJdVD1O8yFQ6CxFAZDiLRDM795-Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-05-05 11:22 ` Christoph Hellwig 2017-05-05 11:35 ` Geert Uytterhoeven 2017-05-06 19:42 ` Oleg Nesterov [not found] ` <20170506194256.GA21726-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2017-05-07 9:47 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).