Received: by 10.192.165.148 with SMTP id m20csp762925imm; Wed, 25 Apr 2018 07:19:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx490pCE9DDJpA/qi+an//12uGldIoE20Zdv5HYP487MMyVqVJInoKV44VMTj6Q3h63XVIknz X-Received: by 10.98.163.21 with SMTP id s21mr28388231pfe.168.1524665974725; Wed, 25 Apr 2018 07:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524665974; cv=none; d=google.com; s=arc-20160816; b=XS6iq0bH6Ew9NzAth3iLsfs2V6s6PI6swhyeiHzeOu5DVUO9tUmWR5wttM8C6YiXYf 7JuRsYu8EBp29UB5OeTjHtDpibovKx5tTEBJLhYey0T0sv3IMBkn6Evfmn5ICWecPZCC ma1jpLjr2FwZN6vJPoSlplFrYLPRQInzdwZ+IMIOz2ItT3auKpkFRR5yZycOBLewGjNj gv2fTp48DQlQrfAMcliEPAHyOI0fLv4HAZ07nKVW0woIQQUNBP6zPnF9kO3Q50W1uWj9 dFNqzZEdBnZ5GPDDOH2ZTKkNSpCSN09BI06S56VscGpOIoFGTZjIaGGFHKS/UAm6wCyQ chUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=zO0HVAWdQ0ZRUE6etYgGGPfB/bUiss1TvdTTp9bFFJg=; b=Hfq1G8Wy5clPT7w0bck+I9Nb0/cVPYmlgw/15cx2ZOJzEHMQ9A4nFymTT2uRvHreua iWAgPkvgLBgcuwV13rDXhalCzdys/8Qsa8BES9ocqiVoV4zgW0w4vcxU2011c1oBPDsh 0kx2C5svOqTGt55xa6nXXBVbTevvDrNE9fyLeTMN3MIYa0FhgYJ8cqNs9nne62zLjBES KfDuRgJZUN0BX18fnh3sBhzuMpKs8oNDRXzitAkQrDeXj0v0wDCgDDZ5h/m1sk3chVm/ El+l7QMzmEeg+YdnCmL0lqJoJtYEaRmEN/UrZEZrjyEohlgoHPhRPCRDcF+oStkYO2tt FdIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba2-v6si16488589plb.110.2018.04.25.07.19.20; Wed, 25 Apr 2018 07:19:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754518AbeDYOSM (ORCPT + 99 others); Wed, 25 Apr 2018 10:18:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47128 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753336AbeDYOSL (ORCPT ); Wed, 25 Apr 2018 10:18:11 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98103A202F; Wed, 25 Apr 2018 14:18:10 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id A26172023239; Wed, 25 Apr 2018 14:18:08 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 25 Apr 2018 16:18:10 +0200 (CEST) Date: Wed, 25 Apr 2018 16:18:07 +0200 From: Oleg Nesterov To: Daniel Vetter Cc: Andrey Grodzovsky , Michel =?iso-8859-1?Q?D=E4nzer?= , Linux Kernel Mailing List , amd-gfx list , dri-devel , David.Panariti@amd.com, Eric Biederman , Alex Deucher , Andrew Morton , Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: [PATCH 2/3] drm/scheduler: Don't call wait_event_killable for signaled process. Message-ID: <20180425141807.GA8212@redhat.com> References: <1524583836-12130-1-git-send-email-andrey.grodzovsky@amd.com> <1524583836-12130-3-git-send-email-andrey.grodzovsky@amd.com> <7313704c-0693-0bb9-8818-99cd2b7c0ca0@daenzer.net> <20180424194418.GE25142@phenom.ffwll.local> <20180424214027.GG25142@phenom.ffwll.local> <20180425132228.GC7592@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 25 Apr 2018 14:18:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 25 Apr 2018 14:18:10 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'oleg@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/25, Daniel Vetter wrote: > > On Wed, Apr 25, 2018 at 3:22 PM, Oleg Nesterov wrote: > > On 04/24, Daniel Vetter wrote: > >> > >> wait_event_killabel doesn't check for fatal_signal_pending before calling > >> schedule, so definitely has a nice race there. > > > > This is fine. See the signal_pending_state() check in __schedule(). > > > > And this doesn't differ from wait_event_interruptible(), it too doesn't > > check signal_pending(), we rely on schedule() which must not block if the > > caller is signalled/killed. > > > > The problem is that it is not clear what should fatal_signal_pending() or > > even signal_pending() mean after exit_signals(). > > Uh, I was totally thrown off in all the wait_event* macros and somehow > landed in the _locked variants, which all need to recheck before they > drop the lock, for efficiency reasons. See do_wait_intr(). Just in case, note that do_wait_intr() has to check signal_pending() for completely differerent reason. We need to return non-zero code to stop the main loop in __wait_event_interruptible_locked(); unlike ___wait_event() it doesn't check signal_pending() itself. Oleg.