Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp292277rdh; Thu, 23 Nov 2023 04:19:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGA2oiJpCBCJff8TsJQJYLJcSGaxTZ+KyNMLaHVvtDSrsCHYK7N3WiiKg2892jQ6iURVBR7 X-Received: by 2002:a17:902:ce81:b0:1cc:3c6c:ce23 with SMTP id f1-20020a170902ce8100b001cc3c6cce23mr5278553plg.42.1700741989482; Thu, 23 Nov 2023 04:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700741989; cv=none; d=google.com; s=arc-20160816; b=oIBHtxRM11DSJQ+4lCC+3axknWmCLitineX0Y51V1KOOpk6ima6nvorYDevic9Lp/9 Z0i6A2/NdTZjZX+byZ4k6d3vL1F+ARZ3NEyOzClprRttU15rqcfodtAK7ftrFFisus5N nleaxL1pZkmtZJrYyT4QR7NtkBzCPcHDhBrVqjnvMzzI3clR2U/9rhWhjOH8EupKWgSy 0XEfkPVO9NBAWvlDKmbywkikyx4FnHgJUJUAU1bYjgxKxZS+fXadQpNXBsCjR3Kr2r7R vF9UYEsSvZ33iVpI5pIqpCmwacaIXC8hFnl1Kh5JJjbjIh8up81sHZWpMLcJ6yXJB6y5 TuhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RNzh3upIfUQ/SiOWExsLoNPak1m35NKI7BJelv+ATX4=; fh=cd6f3jNh3j7Qvd5mXmd/oCoIQnwAYeKd0j29JiSirLE=; b=erTzQ26taj5/x+6XfNp2O1lsH+459r8MBVnGtKJ9Jj7nnmwP4w9dcGvwWmoMmB/phU NTvRxslCYNvhb3wp7Q4xGhKHyaWCbFxG35boHlnEeFrULf4f2EvR9J+G4J5Ns0ekQ0ME 4ijGEYGJs3HjIooJz0UoNRN3JY729Rhg+8n6tnzoVLpuWHdeqsqMUuwjd6l8aehc5ioz q+896igdZkyr0ocYV0wKQdsOhPKFKp3Uf9fIosALVQsLubDKr38sEB0tXQZGhl1ya+Ea RQygx7/I75h8lV81OBKn5nrYjJ6aIhulQTtJ3uCyipHPvOtW2eftSleM3P0b3IXQVkYS Qpow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gWMCoVhC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i1-20020a170902cf0100b001c9e765e151si1061159plg.116.2023.11.23.04.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 04:19:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gWMCoVhC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F3AB68091C49; Thu, 23 Nov 2023 04:19:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345276AbjKWMTU (ORCPT + 99 others); Thu, 23 Nov 2023 07:19:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345280AbjKWMTR (ORCPT ); Thu, 23 Nov 2023 07:19:17 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F20F1D42; Thu, 23 Nov 2023 04:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700741964; x=1732277964; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8aCNwpSFHAyXWSCRr6tTvoejhaLHrQ0RcXndxzv80fA=; b=gWMCoVhCK77yAS/boOmjr8CBHR3C6EJ8rUVhE0PkIexL+VjjCH380kZ1 hZ2fpRnkQqOTrgdfnLdYUTiRf9Q7qqdJFOjdDUSr/rvCPjXBcYg2uMsaj ekb2K6iS6i8bAxCnERhOvArnT1/2Mp3d2Vp9prxB9Yh0PZQVSo4cbrAYe BGko5U4gRsPkYesaQs6YYgNBScjHi7oxddftAuRFkXJXAPDwz5UyxAttY yFkrzbIKT631k/F/IsW1iN/5KACb4X9CVO2BLCU+e+zd1J0tNxcKUrl3i SnS1TKPH9P1EMbdO+vShL4fyaNGGPNRWlwkyruUq8zHUWLF0zGUDAn+Xa A==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="478456361" X-IronPort-AV: E=Sophos;i="6.04,221,1695711600"; d="scan'208";a="478456361" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 04:19:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="890774792" X-IronPort-AV: E=Sophos;i="6.04,221,1695711600"; d="scan'208";a="890774792" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.41.107]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 04:19:18 -0800 From: Adrian Hunter To: Peter Zijlstra Cc: Ingo Molnar , Mark Rutland , Alexander Shishkin , Heiko Carstens , Thomas Richter , Hendrik Brueckner , Suzuki K Poulose , Mike Leach , James Clark , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Yicong Yang , Jonathan Cameron , Will Deacon , Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: [PATCH RFC 2/3] perf/x86/intel/pt: Add support for pause_resume() Date: Thu, 23 Nov 2023 14:18:50 +0200 Message-Id: <20231123121851.10826-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231123121851.10826-1-adrian.hunter@intel.com> References: <20231123121851.10826-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 23 Nov 2023 04:19:42 -0800 (PST) Prevent tracing to start if aux_paused. Implement pause_resume() callback. When aux_paused, stop tracing. When not aux_paused, only start tracing if it isn't currently meant to be stopped. Signed-off-by: Adrian Hunter --- arch/x86/events/intel/pt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 42a55794004a..aa883b64814a 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -418,6 +418,9 @@ static void pt_config_start(struct perf_event *event) struct pt *pt = this_cpu_ptr(&pt_ctx); u64 ctl = event->hw.config; + if (event->aux_paused) + return; + ctl |= RTIT_CTL_TRACEEN; if (READ_ONCE(pt->vmx_on)) perf_aux_output_flag(&pt->handle, PERF_AUX_FLAG_PARTIAL); @@ -1563,6 +1566,14 @@ EXPORT_SYMBOL_GPL(intel_pt_handle_vmx); * PMU callbacks */ +static void pt_event_pause_resume(struct perf_event *event) +{ + if (event->aux_paused) + pt_config_stop(event); + else if (!event->hw.state) + pt_config_start(event); +} + static void pt_event_start(struct perf_event *event, int mode) { struct hw_perf_event *hwc = &event->hw; @@ -1798,6 +1809,7 @@ static __init int pt_init(void) pt_pmu.pmu.del = pt_event_del; pt_pmu.pmu.start = pt_event_start; pt_pmu.pmu.stop = pt_event_stop; + pt_pmu.pmu.pause_resume = pt_event_pause_resume; pt_pmu.pmu.snapshot_aux = pt_event_snapshot_aux; pt_pmu.pmu.read = pt_event_read; pt_pmu.pmu.setup_aux = pt_buffer_setup_aux; -- 2.34.1