Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3813286imm; Wed, 5 Sep 2018 06:29:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYZ5f8WgOQvbg22PmE5maEdNJrfquhn088GhYUXV/q+9OVw3ynVuv1L/B+OXzabSG3h7Jy0 X-Received: by 2002:a62:1a8f:: with SMTP id a137-v6mr40414818pfa.190.1536154159062; Wed, 05 Sep 2018 06:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536154159; cv=none; d=google.com; s=arc-20160816; b=tXVyQ3CSAbKJlXSK47ME7y7L7QkZiqWWgcK0dwaMb5kxt75LPavryreXpM1igJzNTx 6MUp4qUYwgyYxEzjhF05AYcFj/LrDr8y2mNmOhRjuECuIxxq3JdqoMi6DP7tEyGoEN4z LFtggGVnKH85LMAZcVxXUJGwt3490PgfRDU2JCYnMVPY9Zub7kRj9yLjOaeDkc64JMJ0 /twqAN/CuljZrbWJbBf/Ysfgs1BxUH3Lj1epezTzBK4ECnybXkWSXHxc93f039xGQu+g SSxWTKVtjuuGf2nzBHUjf7ZUfo31suMMZRHl02L5I6BN8ZjCyP3aLbT0QEA5U0mM3cTI sLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=9ggGkgCMRbRluEm37TzQ7yWoq6C0w1ryCNpIB4pPpCw=; b=YKL6cKbm03vnvDOM77N8vRaexIKZIDnwYdyk3eyuH1kRTKZahki9gtWf/IdF2m2+yW dd/EaE/tLugmTHvFwY4wAlh4JVinIGbBmqQSdp2tYheHVjk8Bk9Ocggq6MMrTqwKqY6l rpJNqUd4qvqMnSMN9ZV1NoT086APJi3IeGg1uTpKZ9+1/dLZrqJT5hLS7xFwsEwBQz4s I9tY1AeS+AdqLZG/0dqv0I6P4pFxAuD1GgXv+6DXUXsG+eLKHA1leMvGyxmEMi8mYgcS LnsM1TjritxNlqJyuoyjAWXVBOX/YT+3l65peoHO9b2qL0Rw9I5At2RJtAWD/HlOzv5j 7Vfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1-v6si2026833pld.322.2018.09.05.06.29.03; Wed, 05 Sep 2018 06:29:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727676AbeIER4s (ORCPT + 99 others); Wed, 5 Sep 2018 13:56:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:40334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727145AbeIER4s (ORCPT ); Wed, 5 Sep 2018 13:56:48 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2EE13206BA; Wed, 5 Sep 2018 13:26:32 +0000 (UTC) Date: Wed, 5 Sep 2018 09:26:29 -0400 From: Steven Rostedt To: "Paul E. McKenney" Cc: Borislav Petkov , x86-ml , Peter Zijlstra , lkml , joel@joelfernandes.org Subject: [PATCH] tracing: Add back in rcu_irq_enter/exit_irqson() for rcuidle tracepoints Message-ID: <20180905092629.6ecb003b@gandalf.local.home> In-Reply-To: <20180905125941.GE4225@linux.vnet.ibm.com> References: <20180901173559.GC26871@zn.tnic> <20180901175442.GO4225@linux.vnet.ibm.com> <20180901184531.72ffb792@vmware.local.home> <20180902041639.GQ4225@linux.vnet.ibm.com> <20180904162611.6a120068@gandalf.local.home> <20180904205321.GQ4225@linux.vnet.ibm.com> <20180905082254.GA2237@zn.tnic> <20180905125941.GE4225@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Sep 2018 05:59:41 -0700 "Paul E. McKenney" wrote: > On Wed, Sep 05, 2018 at 10:22:54AM +0200, Borislav Petkov wrote: > > On Tue, Sep 04, 2018 at 01:53:21PM -0700, Paul E. McKenney wrote: > > > I must defer to Borislav on this one. Assuming it has the desired > > > effect, I am good with it. > > > > It did survive a bunch of reboots (the WARN would fire after boot > > finishes, normally) so I guess we can run with it and see how it works > > out in the next couple of weeks. > > > > Thanks guys! > > Woo-hoo!!! Thank you for testing this! > Here's the official patch if you want to add an Ack/review/tested-by: -- Steve From: "Steven Rostedt (VMware)" Borislav reported the following splat: ============================= WARNING: suspicious RCU usage 4.19.0-rc1+ #1 Not tainted ----------------------------- ./include/linux/rcupdate.h:631 rcu_read_lock() used illegally while idle! other info that might help us debug this: RCU used illegally from idle CPU! rcu_scheduler_active = 2, debug_locks = 1 RCU used illegally from extended quiescent state! 1 lock held by swapper/0/0: #0: 000000004557ee0e (rcu_read_lock){....}, at: perf_event_output_forward+0x0/0x130 stack backtrace: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.0-rc1+ #1 Hardware name: LENOVO 2320CTO/2320CTO, BIOS G2ET86WW (2.06 ) 11/13/2012 Call Trace: dump_stack+0x85/0xcb perf_event_output_forward+0xf6/0x130 __perf_event_overflow+0x52/0xe0 perf_swevent_overflow+0x91/0xb0 perf_tp_event+0x11a/0x350 ? find_held_lock+0x2d/0x90 ? __lock_acquire+0x2ce/0x1350 ? __lock_acquire+0x2ce/0x1350 ? retint_kernel+0x2d/0x2d ? find_held_lock+0x2d/0x90 ? tick_nohz_get_sleep_length+0x83/0xb0 ? perf_trace_cpu+0xbb/0xd0 ? perf_trace_buf_alloc+0x5a/0xa0 perf_trace_cpu+0xbb/0xd0 cpuidle_enter_state+0x185/0x340 do_idle+0x1eb/0x260 cpu_startup_entry+0x5f/0x70 start_kernel+0x49b/0x4a6 secondary_startup_64+0xa4/0xb0 This is due to the tracepoints moving to SRCU usage which does not require RCU to be "watching". But perf uses these tracepoints with RCU and expects it to be. Hence, we still need to add in the rcu_irq_enter/exit_irqson() calls for "rcuidle" tracepoints. This is a temporary fix until we have SRCU working in NMI context, and then perf can be converted to use that instead of normal RCU. Link: http://lkml.kernel.org/r/20180904162611.6a120068@gandalf.local.home Cc: x86-ml Cc: Peter Zijlstra Cc: "Paul E. McKenney" Reported-by: Borislav Petkov Fixes: e6753f23d961d ("tracepoint: Make rcuidle tracepoint callers use SRCU") Signed-off-by: Steven Rostedt (VMware) --- include/linux/tracepoint.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 7f2e16e76ac4..041f7e56a289 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -158,8 +158,10 @@ extern void syscall_unregfunc(void); * For rcuidle callers, use srcu since sched-rcu \ * doesn't work from the idle path. \ */ \ - if (rcuidle) \ + if (rcuidle) { \ idx = srcu_read_lock_notrace(&tracepoint_srcu); \ + rcu_irq_enter_irqson(); \ + } \ \ it_func_ptr = rcu_dereference_raw((tp)->funcs); \ \ @@ -171,8 +173,10 @@ extern void syscall_unregfunc(void); } while ((++it_func_ptr)->func); \ } \ \ - if (rcuidle) \ + if (rcuidle) { \ + rcu_irq_exit_irqson(); \ srcu_read_unlock_notrace(&tracepoint_srcu, idx);\ + } \ \ preempt_enable_notrace(); \ } while (0) -- 2.13.6