Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2273435yba; Mon, 15 Apr 2019 08:21:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+6XOt4Oc3mu1Qmd5GADTs16S/NXkrqDgF7vNT7Oj6eQV5xrrBOPT9gSxAQOBacPw0HFT1 X-Received: by 2002:aa7:8518:: with SMTP id v24mr76354670pfn.219.1555341703886; Mon, 15 Apr 2019 08:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555341703; cv=none; d=google.com; s=arc-20160816; b=d6cWQway4hzTAYBkPfkExbOncLxuC3p9yndXTs/svch50o7nX6wOhwjc+aC4gZoqb5 h95hsOryIPv8Wj8MhdyRKRyPjVzLO3T0s46O6Tj9QFS6n/S81YLJ1u4uIxqvi+adfOeJ BR7Wo6M5AaIeuCi88R8dUTAO0+ph7qnjP5ERYmVNfrxXMS1iF7oVbL9qT9EdLJ+WSwEp NjXIktOjDkaVxVIHGdkwEU38MHlW6Sb2NfgPJYZA+m47V0SdBPNyXEKUzGC+raUNiJJs 3uFvnDirq+iuedkpTTcxhNTN3IBvGORhfslWK4MVobNbp1SUYZPyXeBVImJHqR4SY+FJ iOEg== 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; bh=EQ1nTNsD9LeZnnQFtYssJqiP/5lNTflwSlvxG0+b3V4=; b=GaEXfM9tdiNAkc8H7vJqsDdgPZPsof+2YAYW+LXo+q50i0FhnKGXnduaJOlHh70OFU mdPgpB7LeE/ahIheWoUP99WmENWtmJKl/1gaopgF7IXrU07j2/h+yo72CVLsnRXlI1z6 CC2lpclxuem8RFqID2hk47jybizKMSPQpVnE7DGEU7IFaID0kxquA/oLPhKjfgeoLP/A CJT5bNsZV1xgtTLoxMBA3vQmj7LE0oAikJSwJqFFx/f8wmvJ67Z28bdA1vyXbz2UHVtL xNbdNFRQZlf9bvGdXNhIoSwQALCgBKWwu8i58tpaMsOT2w0nAMeOL2UryBQjGnsEBz4A Y6AQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si38824969plq.181.2019.04.15.08.21.26; Mon, 15 Apr 2019 08:21:43 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbfDOPUb (ORCPT + 99 others); Mon, 15 Apr 2019 11:20:31 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:46192 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbfDOPUb (ORCPT ); Mon, 15 Apr 2019 11:20:31 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1hG3PC-0003Uz-Bo; Mon, 15 Apr 2019 17:20:22 +0200 Date: Mon, 15 Apr 2019 17:20:22 +0200 From: Sebastian Andrzej Siewior To: Kirill Smelkov Cc: Julia Lawall , kbuild-all@01.org, Kurt Schwemmer , Logan Gunthorpe , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pci/switchtec: fix stream_open.cocci warnings (fwd) Message-ID: <20190415152021.3j3riefeoz7rf2pa@linutronix.de> References: <20190413170056.GA11293@deco.navytux.spb.ru> <20190415143857.kg2dbg3zxsxdktsi@linutronix.de> <20190415145456.GA15280@deco.navytux.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190415145456.GA15280@deco.navytux.spb.ru> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-04-15 14:55:02 [+0000], Kirill Smelkov wrote: > Hi Sebastian, Hi Kirill, > On Mon, Apr 15, 2019 at 04:38:57PM +0200, Sebastian Andrzej Siewior wrote: > > On 2019-04-13 17:00:59 [+0000], Kirill Smelkov wrote: > > > stream_open.cocci was issuing only warning for pci/switchtec, but after > > > 8a29a3bae2a2 ("pci/switchtec: Don't use completion's wait queue") they > > > started to use wait_even_* inside read method and, since > > > stream_open.cocci considers wait_event_* as blocking the warning became > > > error. Previously it was completions there, but I added support for wait > > > events only for simplicity. > > > > why is wait_event_interruptible() treated differently compared to > > wait_for_completion_interruptible()? > > No particular reason. I just taught stream_open.cocci to consider > only "wait_event_*" as blocking: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/api/stream_open.cocci?h=v5.1-rc5#n35 > > based on original /proc/xen/xenbus deadlock: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/xen/xenbus/xenbus_dev_frontend.c?h=v5.1-rc5#n135 > https://git.kernel.org/linus/581d21a2d02a > > We can extend "a function that blocks" rule to cover other kernel > primitives. > > For the reference: the deadlock scenario is described in > > https://git.kernel.org/linus/10dce8af3422 As far I understand the problem is when the ->read() callback waits for the ->write() callback. The locking isn't changed by patch you mentioned. So extended might make sense. But then wait_event_* by itself in ->read() isn't a problem as long as its counter part isn't in ->write(). But yes, nice finding. > Kirill Sebastian