From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933048AbcKWHmC (ORCPT ); Wed, 23 Nov 2016 02:42:02 -0500 Received: from mga03.intel.com ([134.134.136.65]:30937 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932934AbcKWHmB (ORCPT ); Wed, 23 Nov 2016 02:42:01 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,537,1473145200"; d="scan'208";a="904647460" From: Alexander Shishkin To: Andi Kleen , linux-kernel@vger.kernel.org Cc: 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 In-Reply-To: <1479488124-17034-1-git-send-email-andi@firstfloor.org> References: <1479488124-17034-1-git-send-email-andi@firstfloor.org> User-Agent: Notmuch/0.22.1 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 23 Nov 2016 09:41:40 +0200 Message-ID: <87h96yej7v.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andi Kleen writes: > +/* > + * Disable the PT trace for debugging purposes. > + */ > +void pt_disable(void) > +{ > + u64 val; > + > + if (!boot_cpu_has(X86_FEATURE_INTEL_PT)) > + return; > + > + rdmsrl_safe(MSR_IA32_RTIT_CTL, &val); > + val &= ~RTIT_CTL_TRACEEN; > + wrmsrl_safe(MSR_IA32_RTIT_CTL, val); > +} > +EXPORT_SYMBOL(pt_disable); 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". Also, I can't tell if this is called from an atomic 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; - will work equally well for intel_bts or the ARM/Coresight tracers. Regards, -- Alex