From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933994AbcKWQ6Q (ORCPT ); Wed, 23 Nov 2016 11:58:16 -0500 Received: from one.firstfloor.org ([193.170.194.197]:60122 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055AbcKWQ6O (ORCPT ); Wed, 23 Nov 2016 11:58:14 -0500 Date: Wed, 23 Nov 2016 08:57:41 -0800 From: Andi Kleen To: Alexander Shishkin Cc: Andi Kleen , linux-kernel@vger.kernel.org, Andi Kleen , tom.zanussi@linux.intel.com, rostedt@goodmis.org, peterz@infradead.org, alexander.shishkin@linux.intel.com Subject: Re: [PATCH] Add support for disabling Intel PT trace in ftrace Message-ID: <20161123165740.GB26852@two.firstfloor.org> References: <1479488124-17034-1-git-send-email-andi@firstfloor.org> <87h96yej7v.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h96yej7v.fsf@ashishki-desk.ger.corp.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > This will create unexplainable gaps in the trace, at least we should > output RECORD_AUX when this happens, maybe add a flag for "had to stop > the trace for reasons external to perf". I don't think it's unexplainable. After all the user set it up this way. It's the same as with an address filter for example. If we started messing with the perf state then we have all the locking/recursion problems between ftrace and perf. kprobe can be set on near all kernel functions. I tried to do only the minimum safe thing. Otherwise it would need a special black list and likely other things for correctness. Just disabling is much simpler and avoids all that. > > Also, I can't tell if this is called from an atomic context. It's not, but it doesn't matter if you just change the MSR. It can be done in any context. > > But I'd suggest something more generic like perf_pmu_off($pmu): > - we already have the code to stop the output; > - this won't be a driver-specific api then; > - this will be reflected in the event hw state; > - it will also go through the driver's callbacks, so its internal > states will actually match the reality; See above. > - will work equally well for intel_bts or the ARM/Coresight tracers. BTS could be handled like PT, but frankly noone should be using that, so I don't think it's worth it. -Andi