Received: by 10.223.164.221 with SMTP id h29csp339000wrb; Fri, 3 Nov 2017 15:43:11 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RGRk4vWKsSchgGHNG44DkW5ul4NNaXph9/XjW7t0yET8kJDmjrrY4pLlsKAtt6SingRq56 X-Received: by 10.98.24.80 with SMTP id 77mr9248561pfy.195.1509748991858; Fri, 03 Nov 2017 15:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509748991; cv=none; d=google.com; s=arc-20160816; b=o6iT/Y0Ei+QzWg5300WuMxLmDophJ8dp8W9TrswGh31XpoAsKk2pvEsRG4rmFm4OhK dnaOHm2+WAPpBy7ptAGXmCdQHmuD3xxyO6E/bjZDm5uAC8qOfTP/vcdQXVOu+OMYYy4v gGwYv861MZIlILqobdUEJSdvg8FIUwj/c2Ix8Ho5fzh1Zu14GHCpXTTr+nu4Oe3C2eH1 /DXRPbybOtFbQPMKIENS79kfln9hAUnQquejyN15ISr53uPoYgNkvb6iaLRcveyfMe89 Z6Q+kU+QAd6sZ2QxmZ9UsK9g/Z44fcZVG68356O/HiXw1RQ90uxkI4rwszG+0qEbSYk/ tgaw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=hroV+wFTlGSGU8eNlVxaGPHbn7ezYRjTKuSnurcBL44=; b=IAqTvUjhSHr1G9bIEX8iwRZaY/z68YTVFqFAYfcVTr1wR1JPuZVFip9xo27TRGU4P7 7jpvORKfE9f/NqGQcpDbVACvulLsZ80JDnPh/C/ITY7vtkvxbht2oko5eKNJE4XqxW/o m8ZV5iRMQSCbQBsGCpvb1GkcePTQKqWUl3e76aUIItzNbcYf7TVS0T13aZ3RLbbYKJTT LuoiDURQl0PK/u1EeCGoacBxUdF7fCzoP2xb+hLKVhVZKof5deboQVZAkFPmFONQINWW Lg8gzwV5aJd8hloSdLze/2GqLgtA4MdaMzyUj3O8hco2Tt9Y6H9FzX62OePuJXpEZrcp ZS7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alibaba-inc.com header.s=default header.b=VsDmnaSX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba-inc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y72si5789772plh.13.2017.11.03.15.42.46; Fri, 03 Nov 2017 15:43:11 -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=@alibaba-inc.com header.s=default header.b=VsDmnaSX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alibaba-inc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754253AbdKCWlr (ORCPT + 92 others); Fri, 3 Nov 2017 18:41:47 -0400 Received: from out0-248.mail.aliyun.com ([140.205.0.248]:46239 "EHLO out0-248.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752128AbdKCWlp (ORCPT ); Fri, 3 Nov 2017 18:41:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alibaba-inc.com; s=default; t=1509748900; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type; bh=hroV+wFTlGSGU8eNlVxaGPHbn7ezYRjTKuSnurcBL44=; b=VsDmnaSX1WJthe0FcnpBFjL6LLALiCBRW8LK7rwaYM2OWkz8RdA0i1+MOlqGBlLUADe9/bA0qoPjTG2PdNriPn8ZZz2NqQjyAfXj0q939343ren1v5oGQ/KAx0aMVXG68kelp7Bdo3MsRgyzYrijJKGZGXYKu5DbGyeixDfEZrk= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03280;MF=yang.s@alibaba-inc.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---.9Jdwu7s_1509748893; Received: from US-143344MP.local(mailfrom:yang.s@alibaba-inc.com ip:121.0.29.200) by smtp.aliyun-inc.com(127.0.0.1); Sat, 04 Nov 2017 06:41:35 +0800 Subject: Re: [RFC PATCH] scripts: checkpatch.pl: remove obsolete in_atomic rule To: Joe Perches , apw@canonical.com, Jonathan Corbet Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org References: <1509736086-408-1-git-send-email-yang.s@alibaba-inc.com> <1509738092.15520.40.camel@perches.com> From: "Yang Shi" Message-ID: <46bcd443-cad5-beb6-10a0-bbdd1d38a70e@alibaba-inc.com> Date: Sat, 04 Nov 2017 06:41:29 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1509738092.15520.40.camel@perches.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/17 12:41 PM, Joe Perches wrote: > On Sat, 2017-11-04 at 03:08 +0800, Yang Shi wrote: >> checkpatch.pl still reports the below in_atomic warning: >> >> WARNING: use of in_atomic() is incorrect outside core kernel code >> + if (in_atomic()) >> >> But, in_atomic() has been used outside kernel dir for a long time, and >> even drivers. So, remove the obsolete rule even though they can be >> ignored. > > Removing in_atomic() from checkpatch does not make sense > without also updating include/linux/preempt.h > > Jonathon Corbet added this comment in > > commit 8c703d35fa91911dd92a18c31a718853f483ad80 > Author: Jonathan Corbet > Date: Fri Mar 28 14:15:49 2008 -0700 > > in_atomic(): document why it is unsuitable for general use > > Discourage people from inappropriately using in_atomic() > > Signed-off-by: Jonathan Corbet > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds > --- > include/linux/hardirq.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h > index 49829988bfa0..897f723bd222 100644 > --- a/include/linux/hardirq.h > +++ b/include/linux/hardirq.h > @@ -72,6 +72,13 @@ > #define in_softirq() (softirq_count()) > #define in_interrupt() (irq_count()) > > +/* > + * Are we running in atomic context? WARNING: this macro cannot > + * always detect atomic context; in particular, it cannot know about > + * held spinlocks in non-preemptible kernels. Thus it should not be This part looks changed. CONFIG_PREEMPT_COUNT might be enabled with non-preemptible kernel, so that in_atomic() could know if kernel held spinlocks or not. Yang > + * used in the general case to determine whether sleeping is possible. > + * Do not use in_atomic() in driver code. > + */ > > Maybe he remembers why... > >> Signed-off-by: Yang Shi >> CC: Andrew Morton >> --- >> Not sure if removing the obsolete rule is preferred by checkpatch.pl, anyway >> it sounds not make sense to keep invalid rule. >> >> scripts/checkpatch.pl | 11 ----------- >> 1 file changed, 11 deletions(-) >> >> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl >> index 8b80bac..e8cf94f 100755 >> --- a/scripts/checkpatch.pl >> +++ b/scripts/checkpatch.pl >> @@ -6231,17 +6231,6 @@ sub process { >> "Using $1 should generally have parentheses around the comparison\n" . $herecurr); >> } >> >> -# whine mightly about in_atomic >> - if ($line =~ /\bin_atomic\s*\(/) { >> - if ($realfile =~ m@^drivers/@) { >> - ERROR("IN_ATOMIC", >> - "do not use in_atomic in drivers\n" . $herecurr); >> - } elsif ($realfile !~ m@^kernel/@) { >> - WARN("IN_ATOMIC", >> - "use of in_atomic() is incorrect outside core kernel code\n" . $herecurr); >> - } >> - } >> - >> # whine about ACCESS_ONCE >> if ($^V && $^V ge 5.10.0 && >> $line =~ /\bACCESS_ONCE\s*$balanced_parens\s*(=(?!=))?\s*($FuncArg)?/) { From 1583075207882186224@xxx Fri Nov 03 19:42:46 +0000 2017 X-GM-THRID: 1583073096436484454 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread