Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5690570rwb; Wed, 21 Sep 2022 11:00:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Za2KW5bTrOj+H8f5uA5IlDPW6W6VwZUBDhIhPeXU8gfNZTyEZcoyPJDqpAuEazc2x2Csu X-Received: by 2002:a17:902:cccb:b0:172:60b7:4590 with SMTP id z11-20020a170902cccb00b0017260b74590mr6006579ple.152.1663783206002; Wed, 21 Sep 2022 11:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663783205; cv=none; d=google.com; s=arc-20160816; b=AnFnrPOoZxFo0ZZrDFukECfP2qs8MtUsyf7IvloalMU6KIVykb96Vwo4qu0Y5rpZqd 2i8gQZHFMJrvWOjpmvOAj2d1FetLEj4n6UGbOP0nmzaBLDrfzVTCU5WvhCCPGywDB4o1 PD/1BBlzdx1BHMNNUWWCUk/nnDZRfVdokYhU+AN4Ev8i7ky2x3n4rXJ88MTKSTnAS2d0 mPlM14offhykIqfdN4IkkQ30ArQqb7agZzWNs+Tv0p4rxyomkcLk04Y7hSIrPCmgHKnh Og+eycVqPpWE4dATHAwVozOrGOLNDqqQjpJeVYucNuoWDbfl5GxmkW2pVrdDTpcpWhFU 622A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bQlfOsl/VtmSC1/y8XuZX61hso2QXcNKKRVJHYEasZM=; b=h/kUM8x+/jUwnH/VC1EbibVYdo1YdNOVng4/ZOMuuOUxiuWzFu2Ecn3iBtvJs9S1In i176BvzWo0/tTzUKbYwwDII+15aUdfLgjZB3lVX5eoPNwrYuP6Rr6bNSA1AMgfAyem01 9J2eazrLRWA1z6RK726zdU1V/+r13YhrCb8Kzl5Z2hdThkRpx6au9OoUz1SxXcegDARE ZiEEG0D34E3k33fUCSqSwU9dsffgDQKumI/6Iw9XPaw7qsLncR/uXtjoYZ4hmWhT9yAs y6pF8mc97hQGdbzFqIe5Lgz/M5G/SCG+/PhIpNtaIfkXA3gSm2eU8WdcWwXXVy5yu3DA 5glQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N2bg2b5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a63330a000000b0043978ae48a7si3651852pgz.177.2022.09.21.10.59.52; Wed, 21 Sep 2022 11:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N2bg2b5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231868AbiIUQus (ORCPT + 99 others); Wed, 21 Sep 2022 12:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231473AbiIUQuR (ORCPT ); Wed, 21 Sep 2022 12:50:17 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C92851425; Wed, 21 Sep 2022 09:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663778732; x=1695314732; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9Rh9QI5021plHVnKQ/4sO96yjSHLmYjQeIDsxL6/qIg=; b=N2bg2b5z8Q+pTVO5IGXSgMvzrqOhGDw/WxwzPQqvi/BIFK2UGNBoDz/c a9SUXZGQx9++EaQ2JiwkHHu3cpLw5XRrnINy/spVuxxEP3/M5I3iJ9GKS TgqPeIImQOrQ85H02NBoKanu6yBb1jAP43xtltuV7QAJ4ZzUqGOosPCpt hPPQyT/qaMuEEE1DfkeP9v3QE7WhPc70TKwEybPAa+BEOQFXWIeBMMvVe 6umASJYVRbx+VnOyUWVnEvsKa/COd5uqeJ6ONmFJQvc6WNG8gBcDvRdxH vC7C7Jk3IW9XgYtuFUvssROzredkCK+bJjT22s6TyXJ5LimYZtqXvHwVS A==; X-IronPort-AV: E=McAfee;i="6500,9779,10477"; a="300044923" X-IronPort-AV: E=Sophos;i="5.93,333,1654585200"; d="scan'208";a="300044923" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2022 09:45:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,333,1654585200"; d="scan'208";a="948227915" Received: from lxy-dell.sh.intel.com ([10.239.48.38]) by fmsmga005.fm.intel.com with ESMTP; 21 Sep 2022 09:45:25 -0700 From: Xiaoyao Li To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Sean Christopherson , Paolo Bonzini , wei.w.wang@intel.com, kan.liang@linux.intel.com Cc: xiaoyao.li@intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: [RFC PATCH v2 1/3] perf/core: Expose perf_event_{en,dis}able_local() Date: Thu, 22 Sep 2022 00:45:19 +0800 Message-Id: <20220921164521.2858932-2-xiaoyao.li@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220921164521.2858932-1-xiaoyao.li@intel.com> References: <20220921164521.2858932-1-xiaoyao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org KVM needs them to disable/enable an Intel PT perf event before vm-entry/after vm-exit. Signed-off-by: Xiaoyao Li --- include/linux/perf_event.h | 1 + kernel/events/core.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index ee8b9ecdc03b..fc5f3952d6a2 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1472,6 +1472,7 @@ extern int perf_swevent_get_recursion_context(void); extern void perf_swevent_put_recursion_context(int rctx); extern u64 perf_swevent_set_period(struct perf_event *event); extern void perf_event_enable(struct perf_event *event); +extern void perf_event_enable_local(struct perf_event *event); extern void perf_event_disable(struct perf_event *event); extern void perf_event_disable_local(struct perf_event *event); extern void perf_event_disable_inatomic(struct perf_event *event); diff --git a/kernel/events/core.c b/kernel/events/core.c index 2621fd24ad26..8324bb99c6bf 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -2446,6 +2446,7 @@ void perf_event_disable_local(struct perf_event *event) { event_function_local(event, __perf_event_disable, NULL); } +EXPORT_SYMBOL_GPL(perf_event_disable_local); /* * Strictly speaking kernel users cannot create groups and therefore this @@ -2984,6 +2985,12 @@ static void _perf_event_enable(struct perf_event *event) event_function_call(event, __perf_event_enable, NULL); } +void perf_event_enable_local(struct perf_event *event) +{ + event_function_local(event, __perf_event_enable, NULL); +} +EXPORT_SYMBOL_GPL(perf_event_enable_local); + /* * See perf_event_disable(); */ -- 2.27.0