Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753051AbdI1K4M (ORCPT ); Thu, 28 Sep 2017 06:56:12 -0400 Received: from terminus.zytor.com ([65.50.211.136]:35927 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753025AbdI1K4K (ORCPT ); Thu, 28 Sep 2017 06:56:10 -0400 Date: Thu, 28 Sep 2017 03:52:34 -0700 From: tip-bot for Masami Hiramatsu Message-ID: Cc: ananth@linux.vnet.ibm.com, torvalds@linux-foundation.org, ast@fb.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, rostedt@goodmis.org, paulmck@linux.vnet.ibm.com, mhiramat@kernel.org, ast@kernel.org, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org Reply-To: tglx@linutronix.de, linux-kernel@vger.kernel.org, rostedt@goodmis.org, paulmck@linux.vnet.ibm.com, ananth@linux.vnet.ibm.com, ast@fb.com, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, ast@kernel.org, mingo@kernel.org, mhiramat@kernel.org In-Reply-To: <150581513991.32348.7956810394499654272.stgit@devbox> References: <150581513991.32348.7956810394499654272.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] kprobes: Improve smoke test to check preemptibility Git-Commit-ID: 3539d09154e11336c31a900a9cd49e386ba6d9b2 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2868 Lines: 86 Commit-ID: 3539d09154e11336c31a900a9cd49e386ba6d9b2 Gitweb: https://git.kernel.org/tip/3539d09154e11336c31a900a9cd49e386ba6d9b2 Author: Masami Hiramatsu AuthorDate: Tue, 19 Sep 2017 18:59:00 +0900 Committer: Ingo Molnar CommitDate: Thu, 28 Sep 2017 09:23:03 +0200 kprobes: Improve smoke test to check preemptibility Add preemptible check to each handler. Handlers are called with non-preemtible, which is guaranteed by Documentation/kprobes.txt. Signed-off-by: Masami Hiramatsu Cc: Alexei Starovoitov Cc: Alexei Starovoitov Cc: Ananth N Mavinakayanahalli Cc: Linus Torvalds Cc: Paul E . McKenney Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/150581513991.32348.7956810394499654272.stgit@devbox Signed-off-by: Ingo Molnar --- kernel/test_kprobes.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kernel/test_kprobes.c b/kernel/test_kprobes.c index 0dbab6d..47106a1 100644 --- a/kernel/test_kprobes.c +++ b/kernel/test_kprobes.c @@ -34,6 +34,10 @@ static noinline u32 kprobe_target(u32 value) static int kp_pre_handler(struct kprobe *p, struct pt_regs *regs) { + if (preemptible()) { + handler_errors++; + pr_err("pre-handler is preemptible\n"); + } preh_val = (rand1 / div_factor); return 0; } @@ -41,6 +45,10 @@ static int kp_pre_handler(struct kprobe *p, struct pt_regs *regs) static void kp_post_handler(struct kprobe *p, struct pt_regs *regs, unsigned long flags) { + if (preemptible()) { + handler_errors++; + pr_err("post-handler is preemptible\n"); + } if (preh_val != (rand1 / div_factor)) { handler_errors++; pr_err("incorrect value in post_handler\n"); @@ -156,6 +164,10 @@ static int test_kprobes(void) static u32 j_kprobe_target(u32 value) { + if (preemptible()) { + handler_errors++; + pr_err("jprobe-handler is preemptible\n"); + } if (value != rand1) { handler_errors++; pr_err("incorrect value in jprobe handler\n"); @@ -232,6 +244,10 @@ static u32 krph_val; static int entry_handler(struct kretprobe_instance *ri, struct pt_regs *regs) { + if (preemptible()) { + handler_errors++; + pr_err("kretprobe entry handler is preemptible\n"); + } krph_val = (rand1 / div_factor); return 0; } @@ -240,6 +256,10 @@ static int return_handler(struct kretprobe_instance *ri, struct pt_regs *regs) { unsigned long ret = regs_return_value(regs); + if (preemptible()) { + handler_errors++; + pr_err("kretprobe return handler is preemptible\n"); + } if (ret != (rand1 / div_factor)) { handler_errors++; pr_err("incorrect value in kretprobe handler\n");