Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5787065ybi; Sun, 7 Jul 2019 12:39:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPF5FLKlf+6BA8z6PtSjOmhK4W6DOh/d18YhCSP2zohAncj6zYFcblGVgSu92M3H3vfn9u X-Received: by 2002:a63:5610:: with SMTP id k16mr18950235pgb.335.1562528362151; Sun, 07 Jul 2019 12:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562528362; cv=none; d=google.com; s=arc-20160816; b=Qgm0dzMk7WQGAY9BvhS6VOq1ct4X4ShiG9rVjjhshZ9vcWkvGkO1f7mASKna0Telx0 896965NgO12VxJ+oyAXnBO4kOEZFTthuoW3qgfaL5H6pcrsatxu7UDnkce/f3zid8hFd w+BY2OtyQFs001XkO6u4s9m9isCPxAZzDhwwRHUlpgxsHUN8x0IQEsET6IfN367C1ZND V3Ow+LvBnmIIQChxVwEw/DuYauQpZhXkdeP3vokD/xRUcmagmhF6P/ufxQZ+EZnLMvPd lDw3uOoH/gHi4e6CqhXkuitYQnIupz+r2QKBoGTU74y5KEcSwsyJ5eHQl+a+rZRHmjSW DrtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:in-reply-to:references:message-id:cc:to:subject:from :dkim-signature:dkim-signature; bh=IEkfr4YRUhLQp/HsBY74d4iNJyE2lakZV4Jo08VmuaA=; b=B3IXLbwcliXs0/c649+0Ez5A0EjuuKQZx7qt7VP+sfCFkxtnjDFIjqodYUCNHW/jRC gtwxh+NMHbcyMIE6QEx2/vCsX5aKn2v/aAFrmSroUxC6U+5atZHZmaCK2cg+mE2ONn9T ql1gq/KsTnKazNidyyg/e33U8hZqMMQLjNNvlgrOgPXDTR6MzSNAOEbkikUDDUhSxS6g bQb8IvODsTLn+B4f4q7C5TE7t88OnoMlFsqGXsdb0gLvAYN/i3WzQzucBM0A5QEyOBCv N4KRvEfvFN8PPu2pBQFVbfpKxXQ7d/S8NaEC9Jm3CDlGoIS5jPGciK12Flz7PaoCkwnS nLug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexedi.com header.s=mandrill header.b=eOkYYoEn; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=bO66F2uY; 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 z7si15596011plk.350.2019.07.07.12.39.07; Sun, 07 Jul 2019 12:39:22 -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; dkim=pass header.i=@nexedi.com header.s=mandrill header.b=eOkYYoEn; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=bO66F2uY; 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 S1727366AbfGGSuI (ORCPT + 99 others); Sun, 7 Jul 2019 14:50:08 -0400 Received: from mail186-26.suw21.mandrillapp.com ([198.2.186.26]:38244 "EHLO mail186-26.suw21.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbfGGSuH (ORCPT ); Sun, 7 Jul 2019 14:50:07 -0400 X-Greylist: delayed 1800 seconds by postgrey-1.27 at vger.kernel.org; Sun, 07 Jul 2019 14:50:07 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=mandrill; d=nexedi.com; h=From:Subject:To:Cc:Message-Id:References:In-Reply-To:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=kirr@nexedi.com; bh=IEkfr4YRUhLQp/HsBY74d4iNJyE2lakZV4Jo08VmuaA=; b=eOkYYoEnGUWqIB0dbm6nCcKDIIjoxM4d+HhRgGETEvjlGfW7UgggueEiV4ZKgBm8ASPzz58BSXeN IlmkkOBadR4II4eSBitdArJdpwPS/iD390IQP8SzJQQpZSq5HN0pZhZLS1Ya/MLN88HkPISXXNaV qKalsjTLIFxcUuHIVbU= Received: from pmta02.mandrill.prod.suw01.rsglab.com (127.0.0.1) by mail186-26.suw21.mandrillapp.com id h48vdu174bkc for ; Sun, 7 Jul 2019 18:20:06 +0000 (envelope-from ) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1562523606; h=From : Subject : To : Cc : Message-Id : References : In-Reply-To : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=IEkfr4YRUhLQp/HsBY74d4iNJyE2lakZV4Jo08VmuaA=; b=bO66F2uYOXuv1h/WHJ+zyPIP0BmHtwh52THKQzlyoBeVJYgYEiyH2vKJe1xixzJMj+HUSH i1ANXEJCPJgzylWHcGjxBZfFSG+5eR/vzKlLngs/6dGthQ8yIbvjM62NW4MqG15eTGOZSmTY fBbQP5AV4cCTWK4SH/rwXwZu/9V9Q= From: Kirill Smelkov Subject: Re: [Cocci] [PATCH 1/2] coccinelle: api/stream_open: treat all wait_.*() calls as blocking Received: from [87.98.221.171] by mandrillapp.com id f5fde34343224dcd9d9edba9fbdda79c; Sun, 07 Jul 2019 18:20:06 +0000 To: Masahiro Yamada Cc: , Linux Kernel Mailing List , Sebastian Andrzej Siewior , Bjorn Helgaas , Logan Gunthorpe Message-Id: <20190707182002.GB25031@deco.navytux.spb.ru> References: <20190623072838.31234-1-kirr@nexedi.com> In-Reply-To: X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=31050260.f5fde34343224dcd9d9edba9fbdda79c X-Mandrill-User: md_31050260 Date: Sun, 07 Jul 2019 18:20:06 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 06, 2019 at 10:17:18PM +0900, Masahiro Yamada wrote: > On Sun, Jun 23, 2019 at 4:29 PM Kirill Smelkov wrote: > > > > Previously steam_open.cocci was treating only wait_event_.* - e.g. > > wait_event_interruptible - as a blocking operation. However e.g. > > wait_for_completion_interruptible is also blocking, and so from this > > point of view it would be more logical to treat all wait_.* as a > > blocking point. > > > > The logic of this change actually came up for real when > > drivers/pci/switch/switchtec.c changed from using > > wait_event_interruptible to wait_for_completion_interruptible: > > > > https://lore.kernel.org/linux-pci/20190413170056.GA11293@deco.navytux.spb.ru/ > > https://lore.kernel.org/linux-pci/20190415145456.GA15280@deco.navytux.spb.ru/ > > https://lore.kernel.org/linux-pci/20190415154102.GB17661@deco.navytux.spb.ru/ > > > > For a driver that uses nonseekable_open with read/write having stream > > semantic and read also calling e.g. wait_for_completion_interruptible, > > running stream_open.cocci before this patch would produce: > > > > WARNING: _fops: .read() and .write() have stream semantic; safe to change nonseekable_open -> stream_open. > > > > while after this patch it will report: > > > > ERROR: _fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. > > > > Cc: Julia Lawall > > Cc: Logan Gunthorpe > > Cc: Sebastian Andrzej Siewior > > Cc: Bjorn Helgaas > > Signed-off-by: Kirill Smelkov > > --- > > Applied to linux-kbuild. Thanks. Thanks. > > scripts/coccinelle/api/stream_open.cocci | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci > > index 350145da7669..12ce18fa6b74 100644 > > --- a/scripts/coccinelle/api/stream_open.cocci > > +++ b/scripts/coccinelle/api/stream_open.cocci > > @@ -35,11 +35,11 @@ type loff_t; > > // a function that blocks > > @ blocks @ > > identifier block_f; > > -identifier wait_event =~ "^wait_event_.*"; > > +identifier wait =~ "^wait_.*"; > > @@ > > block_f(...) { > > ... when exists > > - wait_event(...) > > + wait(...) > > ... when exists > > } > > > > @@ -49,12 +49,12 @@ identifier wait_event =~ "^wait_event_.*"; > > // XXX currently reader_blocks supports only direct and 1-level indirect cases. > > @ reader_blocks_direct @ > > identifier stream_reader.readstream; > > -identifier wait_event =~ "^wait_event_.*"; > > +identifier wait =~ "^wait_.*"; > > @@ > > readstream(...) > > { > > ... when exists > > - wait_event(...) > > + wait(...) > > ... when exists > > } > > > > -- > > 2.20.1 > > _______________________________________________ > > Cocci mailing list > > Cocci@systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Best Regards > Masahiro Yamada