Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1133994ybd; Sun, 23 Jun 2019 00:45:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjoyZMlfygc8AnpsuTafL3EI0rFy4fqjkw9/dFaU/pbeCK8Aq0miVjva9I7aEvsnK8a1ob X-Received: by 2002:a17:902:8d91:: with SMTP id v17mr121847574plo.91.1561275952524; Sun, 23 Jun 2019 00:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561275952; cv=none; d=google.com; s=arc-20160816; b=G9ytUbgNs0BGteFsmig6qP5AMsYIL8huDKPwhFyatbbXGBFOFq2WeiQ/w1urOxCIIu nL/OYA4NLKV+itIUpsBbbqfiDYKdjejAnIGBoA5l3vSyrAnZm2XwsmMWRy6VgtLaCnLl 1qqdv0puFPfhFSROYwBxZatFY5MHgDLAwS6ImPa1Eeba1HUjqpQINYiguR3+u5/S09Ow XmHpt4xVBgsVwMYQAb0AFTnjy/8huK7pr3m+4JcjTWzIVtWxSl95wPCCCZzYEF+7Ee40 c5/ennhO0jUyh0DGmNI4V+NzVRtYOnVFHFzI5byg4VjZkPlJaGmmSxGnK/kUOipZYnDI ly9Q== 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:message-id:cc:to:subject:from:dkim-signature:dkim-signature; bh=heA1ye5BNgh1EP8cOvkyYqS+CIu9oX7BkDTAUuWSqzo=; b=gs8dVtVmfJmxRgYo+pYks1TDZwLGCk/lWKtJlsc41ahRqXQatBKN3aW6lzOBia8ulW xjDvQV2UmUAF9eHLiWiZsIzhQph6E0WSIEeqgy952gV6GfxXwtzhAmY3Wm0EuSWAtpi5 Cs0ZhMRyQq9zZxRAYSRP+/DqCiE6c5EfqcaWPyd7VzpfRhqJzwLhvf0khxzZ4zPrgpm6 ADTOzERBd4nH5ewORcLezTD4MRHjTbYCUKyvGMp83bfpAgok+ICLbVUT4ILwlz9fIekg NrCdBPvgEKVdn0W7T3e1FNzodQt4N9mzCgmeefNtzs1w3HGNbLuiIk6L9SBxWKm+EoFQ lZdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexedi.com header.s=mandrill header.b=jdV7G+N0; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=adHVKzGz; 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 c1si224587plr.405.2019.06.23.00.45.36; Sun, 23 Jun 2019 00:45:52 -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=jdV7G+N0; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=adHVKzGz; 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 S1726408AbfFWHn4 (ORCPT + 99 others); Sun, 23 Jun 2019 03:43:56 -0400 Received: from mail180-6.suw31.mandrillapp.com ([198.2.180.6]:42682 "EHLO mail180-6.suw31.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726056AbfFWHn4 (ORCPT ); Sun, 23 Jun 2019 03:43:56 -0400 X-Greylist: delayed 901 seconds by postgrey-1.27 at vger.kernel.org; Sun, 23 Jun 2019 03:43:55 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=mandrill; d=nexedi.com; h=From:Subject:To:Cc:Message-Id:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=kirr@nexedi.com; bh=heA1ye5BNgh1EP8cOvkyYqS+CIu9oX7BkDTAUuWSqzo=; b=jdV7G+N0xuN+X03q/9LTAL1LwB5YmbwtvlSHrOtQqdNRxZrHn3NuH8CqADn+cptoLeribb9GvhXd +3oS0bN9p7kwLBgJunb/EbxygPaAwbv2JLRU1IewTiJ87p8UX7rlbxqA4EpOflnNTw/da/fZzma8 ffti3qG+rPMOdlxILnQ= Received: from pmta03.mandrill.prod.suw01.rsglab.com (127.0.0.1) by mail180-6.suw31.mandrillapp.com id h1smrm22sc07 for ; Sun, 23 Jun 2019 07:28:53 +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=1561274933; h=From : Subject : To : Cc : Message-Id : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=heA1ye5BNgh1EP8cOvkyYqS+CIu9oX7BkDTAUuWSqzo=; b=adHVKzGzJx5PRnR2SWx/SexOQ/pyUP+lJfGFSgNcoa2egwdmgBfgykhFZD0b2Jvc5L9vhA 0ocGYcOUuXbTwAnfO1INhKawCTNrvmpxhMeIFH5BagbEDmsm4nPO8y8KQXQO+PrhCnpvPBn0 VvsV+NdVI3P2bD54ov9B2BpcZMOzU= From: Kirill Smelkov Subject: [PATCH 1/2] coccinelle: api/stream_open: treat all wait_.*() calls as blocking Received: from [87.98.221.171] by mandrillapp.com id b784ad94a0ef431287fdc374e9d05c1c; Sun, 23 Jun 2019 07:28:53 +0000 X-Mailer: git-send-email 2.20.1 To: , Cc: Kirill Smelkov , Julia Lawall , Logan Gunthorpe , Sebastian Andrzej Siewior , Bjorn Helgaas Message-Id: <20190623072838.31234-1-kirr@nexedi.com> 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.b784ad94a0ef431287fdc374e9d05c1c X-Mandrill-User: md_31050260 Date: Sun, 23 Jun 2019 07:28:53 +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 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 --- 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