lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1463007752-116802-31-git-send-email-davidcc@google.com>
Date:	Wed, 11 May 2016 16:02:30 -0700
From:	David Carrillo-Cisneros <davidcc@...gle.com>
To:	Peter Zijlstra <peterz@...radead.org>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...hat.com>
Cc:	Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
	Matt Fleming <matt@...eblueprint.co.uk>,
	Tony Luck <tony.luck@...el.com>,
	Stephane Eranian <eranian@...gle.com>,
	Paul Turner <pjt@...gle.com>,
	David Carrillo-Cisneros <davidcc@...gle.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2 30/32] perf,perf/x86: add hook perf_event_arch_exec

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@...gle.com>
Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ