From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932864AbcKGR13 (ORCPT ); Mon, 7 Nov 2016 12:27:29 -0500 Received: from smtprelay0040.hostedemail.com ([216.40.44.40]:53350 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932314AbcKGR12 (ORCPT ); Mon, 7 Nov 2016 12:27:28 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::,RULES_HIT:41:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:4321:4385:5007:6261:7875:10004:10400:10848:10967:11026:11232:11658:11914:12043:12296:12438:12555:12740:12760:13069:13311:13357:13439:14181:14659:14721:21080:21451:30012:30054:30062:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:5,LUA_SUMMARY:none X-HE-Tag: ant25_5cd8010f7d714 X-Filterd-Recvd-Size: 2637 Date: Mon, 7 Nov 2016 12:27:16 -0500 From: Steven Rostedt To: Heiko Carstens Cc: Tejun Heo , linux-kernel@vger.kernel.org, Sebastian Ott , Martin Schwidefsky Subject: Re: [PATCH] percpu: use notrace variant of preempt_disable/preempt_enable Message-ID: <20161107122716.6e4597a7@gandalf.local.home> In-Reply-To: <20161103135838.GB9487@osiris> References: <20161103135838.GB9487@osiris> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Nov 2016 14:58:38 +0100 Heiko Carstens wrote: > Commit 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like > events do") added a couple of this_cpu_read calls to the ftrace code. > > On x86 this is not a problem, since it has single instructions to read > percpu data. Other architectures which use the generic variant now > have additional preempt_disable and preempt_enable calls in the core > ftrace code. This may lead to recursive calls and in result to a dead > machine, e.g. if preemption and debugging options are enabled. > > To fix this use the notrace variant of preempt_disable and > preempt_enable within the generic percpu code. > > Reported-and-bisected-by: Sebastian Ott > Tested-by: Sebastian Ott > Fixes: 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like events do") > Signed-off-by: Heiko Carstens Acked-by: Steven Rostedt Feel free to push this in your tree. -- Steve > --- > include/asm-generic/percpu.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h > index 40e887068da2..0504ef8f3aa3 100644 > --- a/include/asm-generic/percpu.h > +++ b/include/asm-generic/percpu.h > @@ -118,9 +118,9 @@ do { \ > #define this_cpu_generic_read(pcp) \ > ({ \ > typeof(pcp) __ret; \ > - preempt_disable(); \ > + preempt_disable_notrace(); \ > __ret = raw_cpu_generic_read(pcp); \ > - preempt_enable(); \ > + preempt_enable_notrace(); \ > __ret; \ > }) >