From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932688AbbENO4p (ORCPT ); Thu, 14 May 2015 10:56:45 -0400 Received: from smtprelay0106.hostedemail.com ([216.40.44.106]:36899 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750956AbbENO4l (ORCPT ); Thu, 14 May 2015 10:56:41 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2693:2741:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:5007:6119:6261:7875:7903:7904:8660:10004:10400:10450:10455:10848:10967:11026:11232:11473:11658:11914:12438:12517:12519:12740:13069:13148:13149:13153:13206:13228:13229:13230:13311:13357:14096:14097:19904:19999:21080,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 X-HE-Tag: moon14_3a07bbec4622f X-Filterd-Recvd-Size: 2896 Date: Thu, 14 May 2015 10:56:37 -0400 From: Steven Rostedt To: Shreyas B Prabhu Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, preeti@linux.vnet.ibm.com, paulmck@linux.vnet.ibm.com Subject: Re: [PATCH] tracing: Add comments explaining cpu online filter for trace events Message-ID: <20150514105637.02eebc97@gandalf.local.home> In-Reply-To: <5554AE2B.30201@linux.vnet.ibm.com> References: <1431533263-5139-1-git-send-email-shreyas@linux.vnet.ibm.com> <20150513122147.4ead9f07@gandalf.local.home> <5554AE2B.30201@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; 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, 14 May 2015 19:46:11 +0530 Shreyas B Prabhu wrote: > > Thanks for the comments, but can't these still be called with > > preemption enabled. What happens when CONFIG_DEBUG_PREEMPT is set and > > you enable these tracepoints. Wont it trigger a warning about > > smp_processor_id() being used in preemptible code? > > > Yes. It does trigger "using smp_processor_id() in preemptible code" > warnings. But as you mentioned in the previous comments, we should be > safe even if the trace call happens from a preemptible section. Let me > play out the scenarios here again- > > The task gets migrated after the smp_processor_id() > 1. From an online cpu to another online cpu - No impact > 2. From an online cpu to an offline cpu - Should never happen > 3. From an offline cpu to an online cpu - IIUC, once a cpu has been > offlined it returns to cpu_idle_loop, discovers its offline and calls > arch_cpu_idle_dead. All this happens with preemption disabled. So this > scenario too should never happen. > > So I don't see any downside to changing smp_processor_id() to > raw_smp_processor_id() which will suppress the warnings. If you agree > I'll send a patch doing this. Yes, please use the raw_smp_processor_id(), and you can add the above description about why it is safe to do so (in the comments). > > Another alternative which is perhaps worth considering is to change > __DO_TRACE itself to check for offline cpu, without a trace event > specifying the check. This will prevent any currently uncaught and any > future tracepoints from using RCU on offline cpus. But I guess it's > little extreme considering only a low fraction of tracepoints have > potential of being called from offline cpus. I think that's a bit extreme, as it would cause an impact to the speed of tracepoints in the hot path. -- Steve