From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756438AbdKCTlh (ORCPT ); Fri, 3 Nov 2017 15:41:37 -0400 Received: from smtprelay0243.hostedemail.com ([216.40.44.243]:54362 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751981AbdKCTlg (ORCPT ); Fri, 3 Nov 2017 15:41:36 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:69:355:379:541:599:800:960:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3653:3865:3866:3867:3868:3870:3871:3872:4321:4605:5007:6119:6120:7903:8957:9121:10004:10400:10848:11232:11233:11658:11914:12043:12262:12295:12296:12438:12555:12679:12740:12760:12895:12986:13439:14181:14659:14721:21060:21080:21221:21365:21433:21451:21627:30012:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: watch61_db99ec2c1f4d X-Filterd-Recvd-Size: 3702 Message-ID: <1509738092.15520.40.camel@perches.com> Subject: Re: [RFC PATCH] scripts: checkpatch.pl: remove obsolete in_atomic rule From: Joe Perches To: Yang Shi , apw@canonical.com, Jonathan Corbet Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Date: Fri, 03 Nov 2017 12:41:32 -0700 In-Reply-To: <1509736086-408-1-git-send-email-yang.s@alibaba-inc.com> References: <1509736086-408-1-git-send-email-yang.s@alibaba-inc.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 + * 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)?/) {