Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1413040imm; Thu, 5 Jul 2018 22:55:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpel2TDENz249+EQooz/plsP/hlenmuYGIREBZCiBUfgzAhFQnYUidYY0C7MkAlj99daFNgB X-Received: by 2002:aa7:850b:: with SMTP id v11-v6mr9136126pfn.165.1530856549472; Thu, 05 Jul 2018 22:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856549; cv=none; d=google.com; s=arc-20160816; b=VdxzB5kao8eSlASegwX5iC7eW8DmgKi6FDpoByexAqArE1kvqvJfwwdCyTrtUl1eXS nsthISARF/bgrxWnG/HBil0nXhMaF1EVkoWLW/qKC7JpsiNc9FvEizdkkhXL+T554doC LII2BDyss24IH8+W4J8XwwNs0BCbQyUbN26GUUk8UphaHtCL25OPHBAl30UzvWrbnHTa m/n1039awEw/3t+L5dusRPNmrbP0pNs/IYjcwgkc267829XoNVmkpda1sRpqYesjnLVb 0O3oOOKZ3F7V4tTeWhXRkzVCSSCvxPmVkrpdnIpnB8ZoF3V7EU/dpe8c+nGyo8BGHyuo Wnbg== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=l3YdaGxdDOn1IgGUtmUuxsaxh+3la/Rie2nOnd+qixo=; b=TZDBD52gGJWdxmpccVApO/GqwX45nMl54qPOv0OuDlrF9LM3Om736VVuJ1SMchciKj ZlafQrVxt1/tA/35LJ18k9zS4A10r/YvESRdTUWCdbbWotQ3y0lhxu9XCgkeUe0hO+W1 HhOUgqAfYJrxpp29ToXK5cqD07zY+ry4rbkkQ0hTyWOLkhCoLsV5QTt7rF/wrHW2vnc7 H2zVu82WcG8e/cWNvKsln71Jk2DFCl+5oMZtUEDnqc5ONMpThKKiOrtflBk3L7Gj4k+p F0/8hjrJkWikirK7wO0+LUSNS6hCncGz6Ilq8dBtUIZFzNI3AfSkBG45n/Nb7Sxrd6U4 JArQ== 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 l5-v6si7722144pls.360.2018.07.05.22.55.34; Thu, 05 Jul 2018 22:55:49 -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 S934762AbeGFFxC (ORCPT + 99 others); Fri, 6 Jul 2018 01:53:02 -0400 Received: from smtprelay0091.hostedemail.com ([216.40.44.91]:59728 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934713AbeGFFw4 (ORCPT ); Fri, 6 Jul 2018 01:52:56 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 27645181D3368; Fri, 6 Jul 2018 05:52:55 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1535:1544:1593:1594:1605:1711:1730:1747:1777:1792:2393:2553:2559:2562:2736:2828:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4362:4605:5007:6119:6120:6691:7901:7903:7904:9010:10004:10848:11026:11232:11233:11658:11914:12043:12050:12740:12760:12895:13439:14181:14659:14721:21060:21080:21451:21611:21627:30012:30029:30034:30054:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: joke35_366546ba7eb3b X-Filterd-Recvd-Size: 5433 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf10.hostedemail.com (Postfix) with ESMTPA; Fri, 6 Jul 2018 05:52:53 +0000 (UTC) Message-ID: Subject: Re: [PATCH] checkpatch: Add exceptions for dsb keyword usage From: Joe Perches To: Mark Rutland Cc: Prakruthi Deepak Heragu , apw@canonical.com, linux-arm-kernel , linux-kernel@vger.kernel.org, ckadabi@codeaurora.org, tsoni@codeaurora.org, bryanh@codeaurora.org Date: Thu, 05 Jul 2018 22:52:52 -0700 In-Reply-To: <20180706054510.puli24y6i6ylghxt@salmiak> References: <1530814776-16988-1-git-send-email-pheragu@codeaurora.org> <20180706054510.puli24y6i6ylghxt@salmiak> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-06 at 06:45 +0100, Mark Rutland wrote: > On Thu, Jul 05, 2018 at 02:14:28PM -0700, Joe Perches wrote: > > On Thu, 2018-07-05 at 11:19 -0700, Prakruthi Deepak Heragu wrote: > > > mb() API can relpace the dsb() API in the kernel code. So, dsb() usage > > > is discouraged. However, there are exceptions when dsb is used in a > > > variable or a function name. Exceptions are when 'dsb' is prefixed with > > > class [-_>*\.] and/or suffixed with class [-_\.;]. > > This is a really confusing way of describing the match behaviour, and doesn't > explain why this is a big problem. > > In C it's either: > > dsb() > dsb(scope) // e.g. dsb(ish) > > ... where scope is [a-z]*. > > ... which can be matched as something like 'dsb([a-z]*)' if necessary. > > > [] > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > > > [] > > > @@ -5372,6 +5372,12 @@ sub process { > > > "Avoid line continuations in quoted strings\n" . $herecurr); > > > } > > > > > > +# dsb is too ARMish, and should usually be mb. > > > + if ($line =~ /[^-_>*\.]\bdsb\b[^-_\.;]/) { > > > + WARN("ARM_BARRIER", > > > + "Use of dsb is discouranged: prefer mb.\n" . > > > + $herecurr); > > > + } > > > > This patch is whitespace damaged with a spelling error. > > > > Also, if this is reasonable test, and I don't know > > that it is, it should be cc'd to the linux-arm list > > linux-arm-kernel@lists.infradead.org > > > > Also, I suggest 2 tests, one for .S files and > > another for .[ch] files, and this be made specific > > to arch/arm... files > > > > Something like: > > > > if ($realfile =~ @^arch/arm@ && > > ($realfile =~ /\.S$/ && $line =~ /\bdsb\b/) || > > ($realfile =~ /\.[ch]$/ && $line =~ /\bdsb\s*\(/)) { > > WARN("ARM_DSB", > > "Prefer mb over dsb as an ARM memory barrier\n" . $herecurr); > > } > > > > ARM people, is this reasonable? > > I don't think this is a big deal today. > > For code under arch/{arm,arm64}, it's perfectly reasonable to use dsb. > > For code *ouside* of arch/{arm,arm64}, there are a number of cases where we > want to use dsb(), e.g. when dealing with architectural drivers that require > special barriers, or for common code shared across arm and arm64. > > It doesn't look like this is a big problem today, anyhow: > > [mark@salmiak:~/src/linux]% git grep -w 'dsb(.*)' -- ^arch > drivers/irqchip/irq-armada-370-xp.c: dsb(); > drivers/irqchip/irq-gic-v3-its.c: dsb(ishst); > drivers/irqchip/irq-gic-v3-its.c: dsb(ishst); > drivers/irqchip/irq-gic-v3-its.c: dsb(sy); > drivers/irqchip/irq-gic-v3-its.c: dsb(sy); > drivers/irqchip/irq-gic-v3-its.c: dsb(sy); > drivers/mtd/nand/raw/cmx270_nand.c: dsb(); > drivers/mtd/nand/raw/cmx270_nand.c: dsb(); > drivers/mtd/nand/raw/cmx270_nand.c: dsb(); > drivers/mtd/nand/raw/cmx270_nand.c: dsb(); > drivers/mtd/nand/raw/cmx270_nand.c: dsb(); > drivers/perf/arm_spe_pmu.c: dsb(nsh); > drivers/perf/arm_spe_pmu.c: dsb(nsh); > drivers/power/reset/arm-versatile-reboot.c: dsb(); > drivers/soc/rockchip/pm_domains.c: dsb(sy); > drivers/soc/rockchip/pm_domains.c: dsb(sy); > drivers/staging/mt7621-mmc/sd.c: //dsb(); /* --- by chhung */ > drivers/staging/mt7621-mmc/sd.c: //dsb(); /* --- by chhung */ > drivers/staging/vc04_services/interface/vchiq_arm/vchiq.h:#define dsb(a) > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c: dsb(sy); /* data barrier operation */ > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c: dsb(sy); > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h: do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(sy); } while (0) > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h: do { debug_ptr[DEBUG_ ## d] = (v); dsb(sy); } while (0) > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h: do { debug_ptr[DEBUG_ ## d]++; dsb(sy); } while (0) > virt/kvm/arm/hyp/vgic-v3-sr.c: dsb(sy); > virt/kvm/arm/hyp/vgic-v3-sr.c: dsb(sy); > virt/kvm/arm/hyp/vgic-v3-sr.c: dsb(sy); Thanks Mark. So it seems this shouldn't be applied.