Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1637147

Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules
Date 2017-05-08 01:30 +0200
Message-ID <tEDMJ-4eZ-5@gated-at.bofh.it> (permalink)
References <tDI26-8l5-13@gated-at.bofh.it> <tEdSh-3MB-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Oleg,

On Sat, May 6, 2017 at 9:42 PM, Oleg Nesterov <oleg@redhat.com> 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@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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH/RFC] signal: Export signal_wake_up_state() to modules Geert Uytterhoeven <geert+renesas@glider.be> - 2017-05-05 11:50 +0200
  Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Christoph Hellwig <hch@infradead.org> - 2017-05-05 12:10 +0200
    Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Geert Uytterhoeven <geert@linux-m68k.org> - 2017-05-05 12:20 +0200
      Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Geert Uytterhoeven <geert@linux-m68k.org> - 2017-05-05 13:10 +0200
        Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Christoph Hellwig <hch@infradead.org> - 2017-05-05 13:30 +0200
          Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Geert Uytterhoeven <geert@linux-m68k.org> - 2017-05-05 13:40 +0200
  Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Oleg Nesterov <oleg@redhat.com> - 2017-05-06 21:50 +0200
    Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Geert Uytterhoeven <geert@linux-m68k.org> - 2017-05-08 01:30 +0200

csiph-web