Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753251AbcD2Erk (ORCPT ); Fri, 29 Apr 2016 00:47:40 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:33132 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753157AbcD2Eqt (ORCPT ); Fri, 29 Apr 2016 00:46:49 -0400 From: David Carrillo-Cisneros To: Peter Zijlstra , Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar Cc: Vikas Shivappa , Matt Fleming , Tony Luck , Stephane Eranian , Paul Turner , David Carrillo-Cisneros , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 30/32] perf,perf/x86: add hook perf_event_arch_exec Date: Thu, 28 Apr 2016 21:43:36 -0700 Message-Id: <1461905018-86355-31-git-send-email-davidcc@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1461905018-86355-1-git-send-email-davidcc@google.com> References: <1461905018-86355-1-git-send-email-davidcc@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1802 Lines: 55 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 Signed-off-by: David Carrillo-Cisneros --- 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 99fc206..c13f501 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -332,6 +332,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_update + #else #define PERF_CGROUP_ARCH_CGRP_SUBSYS_ATTS diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 9c973bd..99b4393 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1289,4 +1289,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 cfffa50..5c675b4 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3248,6 +3248,7 @@ void perf_event_exec(void) for_each_task_context_nr(ctxn) perf_event_enable_on_exec(ctxn); rcu_read_unlock(); + perf_event_arch_exec(); } struct perf_read_data { -- 2.8.0.rc3.226.g39d4020