Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4493197ybi; Sat, 6 Jul 2019 06:19:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPKoAuuYzzx+v8KIgyUlg6qgQ0GLeZuDizoOpvT8W937tcS1QY048UxtavXvjMFfwXUeyN X-Received: by 2002:a17:902:8546:: with SMTP id d6mr11158682plo.207.1562419155104; Sat, 06 Jul 2019 06:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562419155; cv=none; d=google.com; s=arc-20160816; b=qBIOnVpXkVA2Bjl9EfAt0DRHjuPg+B9hTb+6bVUhjKnxk/0my5dyOh6CTU+g9RMqLh MOrhLS3yRlfzgRvTjlm6rWjtfq+YwwvEnUw/3O8wio/Sj0sAT9L42EA37pJexdE5NJRU WXDBcAmj2wK1g/JsnOgrUzMdEZv1YY2mG+zNjDsLl/PalOtmqEbuEx6IbDmVQd3yN2EY WBJN2/GbyZvnMo1Lf8iJdP+iRgARlsZmlE0yLZdi7u+e4DG/W/YWf3HxDGZUsQmyAQB3 RYmYtBdAB906DXor4BfrItBreSRCUPgbOsbGbkSHOghvPu0ryn8uIH3IT64GezCrizYj U8xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=lkt34pKxsLaqteqRnzNAHUoXLSqpNK8tuJBHhve1u6k=; b=CPdbPXGFKa4Bq7vtoZJohc+TYPUfdbYtD9zyAFLKft2FpU1zUXuQSIhXk4BRNDngF7 EG0Fnlwwv9b0DQTFM4bTmP+UC8Tsp1TSCHrBgjG0BM3OBMD2Wdd7F96QdR07lr3s9nhS cur+1RYGIT14TnSZFLroH7tY4K92Bqmon1FZMM8vfIMCWwZNIHzQ8HXJ7xaUZkSmYi3v CoIlJH1+T8swyBV5BJywLbOuDDyUHG3IpOEzFWhqQUk2TQlkbPvOMPgl1zu+BiSf4lZS gZNjiBhgueXQvgBuvnGnkcYReWkAhFxOIGbV8vomzwBfUn8i1j645wqIo9/hVPUnS7nW ZXgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=MyY4GQM5; 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 f4si11837456plb.38.2019.07.06.06.18.59; Sat, 06 Jul 2019 06:19:15 -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=@nifty.com header.s=dec2015msa header.b=MyY4GQM5; 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 S1726526AbfGFNSF (ORCPT + 99 others); Sat, 6 Jul 2019 09:18:05 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:30556 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbfGFNSF (ORCPT ); Sat, 6 Jul 2019 09:18:05 -0400 Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x66DHtil031897 for ; Sat, 6 Jul 2019 22:17:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x66DHtil031897 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562419076; bh=lkt34pKxsLaqteqRnzNAHUoXLSqpNK8tuJBHhve1u6k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MyY4GQM5U+waAw/qOsyaOyYkcwODHnlxFShswOqRKR0z44ld3On+auS3zxi2CDTQB GUdCEHZLU/ca6BSMogpLYFGVQlaAByl0rzLRbukxeVo8LbLYU5vniKeodIexx8VrNo RbHUzb1M550rQgYegVaHtiG6zLBqEA4lrkbFNg00Y1Kr80uJmxMk47DEdo7GH3xT3e yDz/wQQoqPK8v86pD5QGB+H/gWexV/ErNw6DJH8Uvl+99EhteWvKrXnajCWiGJz32w u4p+tc/B5i9Mruzdeoq1khaTT0BPdoFwlDrU8OX7q+C7TBWst5wqGahxmGK/Y60vvf qJZGWpvgGQ12g== X-Nifty-SrcIP: [209.85.222.49] Received: by mail-ua1-f49.google.com with SMTP id z13so3177880uaa.4 for ; Sat, 06 Jul 2019 06:17:55 -0700 (PDT) X-Gm-Message-State: APjAAAXKG4lyJh4o1V5VeZVCG7IEVy6TYWNBxjPQdYacbuth7SGBKP1l 2p6piT6ymurd/Bgpnxq6vPOzlOzOF/AW+Fm61xs= X-Received: by 2002:ab0:70d9:: with SMTP id r25mr4487674ual.109.1562419074733; Sat, 06 Jul 2019 06:17:54 -0700 (PDT) MIME-Version: 1.0 References: <20190623072838.31234-1-kirr@nexedi.com> In-Reply-To: <20190623072838.31234-1-kirr@nexedi.com> From: Masahiro Yamada Date: Sat, 6 Jul 2019 22:17:18 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [Cocci] [PATCH 1/2] coccinelle: api/stream_open: treat all wait_.*() calls as blocking To: Kirill Smelkov Cc: cocci@systeme.lip6.fr, Linux Kernel Mailing List , Sebastian Andrzej Siewior , Bjorn Helgaas , Logan Gunthorpe Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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