From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754224AbdEFTnG (ORCPT ); Sat, 6 May 2017 15:43:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56290 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbdEFTnA (ORCPT ); Sat, 6 May 2017 15:43:00 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 43D3B3DE3E Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=oleg@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 43D3B3DE3E Date: Sat, 6 May 2017 21:42:56 +0200 From: Oleg Nesterov To: Geert Uytterhoeven Cc: Ingo Molnar , Peter Zijlstra , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH/RFC] signal: Export signal_wake_up_state() to modules Message-ID: <20170506194256.GA21726@redhat.com> References: <1493977751-19340-1-git-send-email-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1493977751-19340-1-git-send-email-geert+renesas@glider.be> User-Agent: Mutt/1.5.24 (2015-08-30) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 06 May 2017 19:42:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.