Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1399583

[PATCH v2 30/32] perf,perf/x86: add hook perf_event_arch_exec

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From David Carrillo-Cisneros <davidcc@google.com>
Newsgroups linux.kernel
Subject [PATCH v2 30/32] perf,perf/x86: add hook perf_event_arch_exec
Date Thu, 12 May 2016 01:10:04 +0200
Message-ID <rxLqs-1mv-59@gated-at.bofh.it> (permalink)
References <rxLqq-1mv-9@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AiZif+3qWhOgp7MZ5p8Hic1zvf5bJNu4RJnk44eHbsg=; b=A3eOiG9koLLasFBBNplwuZGuvM42GLQcGR8Unqa+IqGBcKnb8qPjSQk+95g5efd+7e 1o27XKQcByhcbwyTgZCFOwl6oLMxIMmzM5WK2r4q4f+SC5RbfEyCwVEc6ef3um5eUum8 QxnTpyf2yEP1au75uMhJrBODgn5UIbKWiHBVS+jeVNywWvas9At8ic7kzz7YCXxg7qeX g11i71YW6gHMTB/7Lg0pQcOmnCYKY72q3AvBo1HVRnoAnhlmdZDsT/sbeiFbwkC3Ljxm 3/9WeCo96VkzPPuvZSh7Hv+5hGzeeGrgy2wQi1hoAbRrGj8e/bW7yiqhwbEJwzNUzyEH PDMQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AiZif+3qWhOgp7MZ5p8Hic1zvf5bJNu4RJnk44eHbsg=; b=FZ+YWWxm1qb+5gBjkIm4DHKanyiwhHi9YyN1hZDqJ2Ymb1GbkEDavQawvUsHAJ1348 E8DI/o/N5yWPtRylDbdmoz+s88NdxeI3PY43djHkOxmasDXW1SamdJhEYyqTGrtV/Cus zzPPpbMifjybAKlpKt7oXzaiBfFS29EE3H5uS9XN2OaswN58p6BFIY7w+FV3LuW3O4ps ISRtdryxwDbkEuFNPmyQzJhq22u0gjcJcW1iJj24ATjNVFfDZmMQl7YNh/zbALVTiywC Wfqey/2Dp1KtCy0H8it+6jmT6NvVQSLf5iGUYmOehnRLAla0/Y/iHXrUDRikU8iaY+U4 rchQ==
X-Gm-Message-State AOPr4FXZY49R+VxVKvLu+uKnnF6BYZXQEBLKHdSAk2mr8Rf8lYDp/3Ac9u2EGMHHqdGMwT06
X-Received by 10.66.139.199 with SMTP id ra7mr8609660pab.111.1463007795213; Wed, 11 May 2016 16:03:15 -0700 (PDT)
X-Mailer git-send-email 2.8.0.rc3.226.g39d4020
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-Cc Vikas Shivappa <vikas.shivappa@linux.intel.com>, Matt Fleming <matt@codeblueprint.co.uk>, Tony Luck <tony.luck@intel.com>, Stephane Eranian <eranian@google.com>, Paul Turner <pjt@google.com>, David Carrillo-Cisneros <davidcc@google.com>, x86@kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Wed, 11 May 2016 16:02:30 -0700
X-Original-Message-ID <1463007752-116802-31-git-send-email-davidcc@google.com>
X-Original-References <1463007752-116802-1-git-send-email-davidcc@google.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1399583

Show key headers only | View raw


perf_event context switches events to newly exec'ed tasks using
perf_event_exec. Add a hook for such path.

In x86, perf_event_arch_exec is used to synchronize the software
cache of the PQR_ASSOC msr, setting the right RMID for the new task.

Reviewed-by: Stephane Eranian <eranian@google.com>
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 arch/x86/include/asm/perf_event.h | 2 ++
 include/linux/perf_event.h        | 5 +++++
 kernel/events/core.c              | 1 +
 3 files changed, 8 insertions(+)

diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index a7d907f..e744398 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -334,6 +334,8 @@ extern struct cftype perf_event_cgrp_arch_subsys_cftypes[];
 	.dfl_cftypes = perf_event_cgrp_arch_subsys_cftypes, \
 	.legacy_cftypes = perf_event_cgrp_arch_subsys_cftypes,
 
+#define perf_event_arch_exec pqr_ctx_switch
+
 #else
 
 #define PERF_CGROUP_ARCH_CGRP_SUBSYS_ATTS
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index f40b3aa..fa52e46 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1394,4 +1394,9 @@ static struct device_attribute format_attr_##_name = __ATTR_RO(_name)
 #define PERF_CGROUP_ARCH_CGRP_SUBSYS_ATTS
 #endif
 
+#ifndef perf_event_arch_exec
+#define perf_event_arch_exec() do { } while (0)
+#endif
+
+
 #endif /* _LINUX_PERF_EVENT_H */
diff --git a/kernel/events/core.c b/kernel/events/core.c
index c3d9712..4f3a24f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6018,6 +6018,7 @@ void perf_event_exec(void)
 				   true);
 	}
 	rcu_read_unlock();
+	perf_event_arch_exec();
 }
 
 struct remote_output {
-- 
2.8.0.rc3.226.g39d4020

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2 30/32] perf,perf/x86: add hook perf_event_arch_exec David Carrillo-Cisneros <davidcc@google.com> - 2016-05-12 01:10 +0200

csiph-web