From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751014AbcBKXXI (ORCPT ); Thu, 11 Feb 2016 18:23:08 -0500 Received: from Chamillionaire.breakpoint.cc ([80.244.247.6]:59746 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750761AbcBKXXG (ORCPT ); Thu, 11 Feb 2016 18:23:06 -0500 Date: Fri, 12 Feb 2016 00:22:58 +0100 From: Sebastian Andrzej Siewior To: Sebastian Andrzej Siewior Cc: Steven Rostedt , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] kernel: sched: fix preempt_disable_ip recodring for preempt_disable() Message-ID: <20160211232258.GA29109@breakpoint.cc> References: <1455232867-29059-1-git-send-email-bigeasy@linutronix.de> <1455232867-29059-2-git-send-email-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1455232867-29059-2-git-send-email-bigeasy@linutronix.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before: preempt_test(1) kernel_init_freeable+0x1bd/0x239 preempt_test(2) preempt_test+0x75/0x15c preempt_test(3) preempt_test+0xaa/0x15c preempt_test(4) kernel_init_freeable+0x1bd/0x239 preempt_test(5) kernel_init_freeable+0x1bd/0x239 After: preempt_test(1) preempt_test+0x2f/0x15c preempt_test(2) preempt_test+0x75/0x15c preempt_test(3) preempt_test+0xaa/0x15c preempt_test(4) preempt_test+0xd7/0x15c preempt_test(5) preempt_test+0x121/0x15c diff --git a/init/main.c b/init/main.c index 9e64d7097f1a..da4a4b10964a 100644 --- a/init/main.c +++ b/init/main.c @@ -974,6 +974,35 @@ static int __ref kernel_init(void *unused) "See Linux Documentation/init.txt for guidance."); } +static DEFINE_PER_CPU(unsigned long, pcpu_rtest_var); + +static noinline void preempt_test(void) +{ + spinlock_t sl; + + spin_lock_init(&sl); + + preempt_disable(); + pr_err("%s(1) %pF\n", __func__, current->preempt_disable_ip); + preempt_enable(); + + spin_lock(&sl); + pr_err("%s(2) %pF\n", __func__, current->preempt_disable_ip); + spin_unlock(&sl); + + spin_lock_bh(&sl); + pr_err("%s(3) %pF\n", __func__, current->preempt_disable_ip); + spin_unlock_bh(&sl); + + get_cpu_var(pcpu_rtest_var); + pr_err("%s(4) %pF\n", __func__, current->preempt_disable_ip); + put_cpu_var(pcpu_rtest_var); + + local_bh_disable(); + pr_err("%s(5) %pF\n", __func__, current->preempt_disable_ip); + local_bh_enable(); +} + static noinline void __init kernel_init_freeable(void) { /* @@ -1006,6 +1035,7 @@ static noinline void __init kernel_init_freeable(void) page_alloc_init_late(); do_basic_setup(); + preempt_test(); /* Open the /dev/console on the rootfs, this should never fail */ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) Sebastian