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>] [day] [month] [year] [list]
Date:	Thu, 19 May 2016 23:45:14 -0700
From:	tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	jolsa@...hat.com, peterz@...radead.org, namhyung@...nel.org,
	tglx@...utronix.de, hpa@...or.com, linux-kernel@...r.kernel.org,
	dsahern@...il.com, fweisbec@...il.com, mingo@...nel.org,
	acme@...hat.com
Subject: [tip:perf/urgent] perf core: Generalize max_stack sysctl handler

Commit-ID:  a831100aeefbe6d9f3e47a3e2712f82c042f1f5c
Gitweb:     http://git.kernel.org/tip/a831100aeefbe6d9f3e47a3e2712f82c042f1f5c
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Tue, 10 May 2016 16:34:53 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 16 May 2016 23:11:49 -0300

perf core: Generalize max_stack sysctl handler

So that it can be used for other stack related knobs, such as the
upcoming one to tweak the max number of of contexts per stack sample.

In all those cases we can only change the value if there are no perf
sessions collecting stacks, so they need to grab that mutex, etc.

Cc: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/n/tip-8t3fk94wuzp8m2z1n4gc0s17@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 kernel/events/callchain.c | 5 +++--
 kernel/sysctl.c           | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c
index b9325e7..7fc8993 100644
--- a/kernel/events/callchain.c
+++ b/kernel/events/callchain.c
@@ -228,7 +228,8 @@ exit_put:
 int perf_event_max_stack_handler(struct ctl_table *table, int write,
 				 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-	int new_value = sysctl_perf_event_max_stack, ret;
+	int *value = table->data;
+	int new_value = *value, ret;
 	struct ctl_table new_table = *table;
 
 	new_table.data = &new_value;
@@ -240,7 +241,7 @@ int perf_event_max_stack_handler(struct ctl_table *table, int write,
 	if (atomic_read(&nr_callchain_events))
 		ret = -EBUSY;
 	else
-		sysctl_perf_event_max_stack = new_value;
+		*value = new_value;
 
 	mutex_unlock(&callchain_mutex);
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c8b3186..0ec6907 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1149,7 +1149,7 @@ static struct ctl_table kern_table[] = {
 	},
 	{
 		.procname	= "perf_event_max_stack",
-		.data		= NULL, /* filled in by handler */
+		.data		= &sysctl_perf_event_max_stack,
 		.maxlen		= sizeof(sysctl_perf_event_max_stack),
 		.mode		= 0644,
 		.proc_handler	= perf_event_max_stack_handler,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ