Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4214331ybi; Mon, 29 Jul 2019 21:45:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbBX+5sgEQs53/AcEiaE62pg+L4E1sLi67ItJ4qEWBQbuM1Hm56WQgk2Z+CNeb2SUOpnBi X-Received: by 2002:a17:902:4683:: with SMTP id p3mr104700657pld.31.1564461905474; Mon, 29 Jul 2019 21:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564461905; cv=none; d=google.com; s=arc-20160816; b=wbE5lnPtpgeXu4xMUzi3t7LqlAX0pbdgSMJbwBWv4gVkRJWISeM8N7wCdpS7Gj1u3U Hvmw1GqY2fCARI1SgoxIUdfhUi8+uHffFRnkdXTG0NpDn9G7qksp7xy+jcBMi43ZxKs6 DgZn7AQu48Igkyyh72mtST8ihtIA4IvsYrnctvlTH3NQpgXM8qeuZTmJGS29K9T92Wh+ Gyxjv06jTMbvGQMvAI/zMiLLAdj3wVckdjo1C42dktyaVq2WAbufIcpRYaY615mVUOZT YzqkNRx2/fM4G9WXe6hHA9rhvTgbSW4LbTDwShnvN6iGcqO8EwsxroeSkBOk3Y0iUnwA laFw== 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=tLdvTZn5FFFirnl3nRVPA3k1VFN1PiL54SUfm5Pb59w=; b=M2bJsWeJM/D24IcrxC7xAaKsujGMfOtKAi95v2PV6WrweoR0ROu6+Y/sy2ddqzmJEP DLaZjeCBcgoUrkNqM2gx5zDisdvbarcD0zK0hhi5pf1Rdx4o76uBzOqXVy4xqztfKX7d cdVcuPGmbg4azTRMME0rAxaKMGvx3Z8STaffR6z3mJqWWWw+f32s4crrseD4lL/MH6jM 5j1aBIjJBFkuSqoFXpJ2ixk2QCFX3gmFJ/+eYRpFRWSzwqKxCCnz5Iv6Vn2RTZqGxmU1 QSAwOQWVMkKmHUNI99GRbbW/UyTTzXNoubGMHhNHz2WaBlhc9jXfY7wBhtDu6WN4ueqY NzbQ== 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 h186si30421053pge.110.2019.07.29.21.44.50; Mon, 29 Jul 2019 21:45:05 -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 S1730286AbfG3CPK (ORCPT + 99 others); Mon, 29 Jul 2019 22:15:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:38842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729164AbfG3CPJ (ORCPT ); Mon, 29 Jul 2019 22:15:09 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 208772064C; Tue, 30 Jul 2019 02:15:08 +0000 (UTC) Date: Mon, 29 Jul 2019 22:15:06 -0400 From: Steven Rostedt To: Eiichi Tsukata Cc: joel@joelfernandes.org, paulmck@linux.vnet.ibm.com, tglx@linutronix.de, peterz@infradead.org, mingo@redhat.com, fweisbec@gmail.com, luto@amacapital.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: Prevent RCU EQS breakage in preemptirq events Message-ID: <20190729221506.1aed7dfc@oasis.local.home> In-Reply-To: <2ceec933-503e-5d58-60b4-85b491b017d4@etsukata.com> References: <20190729010734.3352-1-devel@etsukata.com> <20190729112126.6554b141@gandalf.local.home> <2ceec933-503e-5d58-60b4-85b491b017d4@etsukata.com> X-Mailer: Claws Mail 3.17.3 (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 Tue, 30 Jul 2019 11:00:42 +0900 Eiichi Tsukata wrote: > Thanks for comments. > > On 2019/07/30 0:21, Steven Rostedt wrote: > > On Mon, 29 Jul 2019 10:07:34 +0900 > > Eiichi Tsukata wrote: > > > >> If context tracking is enabled, causing page fault in preemptirq > >> irq_enable or irq_disable events triggers the following RCU EQS warning. > >> > >> Reproducer: > >> > >> // CONFIG_PREEMPTIRQ_EVENTS=y > >> // CONFIG_CONTEXT_TRACKING=y > >> // CONFIG_RCU_EQS_DEBUG=y > >> # echo 1 > events/preemptirq/irq_disable/enable > >> # echo 1 > options/userstacktrace > > > > So the problem is only with userstacktrace enabled? > > It can happen when tracing code causes page fault in preemptirq events. > For example, the following perf command also hit the warning: > > # perf record -e 'preemptirq:irq_enable' -g ls Again, That's not a irq trace event issue, that's a stack trace issue. > > > >> > >> __visible void trace_hardirqs_on_caller(unsigned long caller_addr) > >> { > >> + enum ctx_state prev_state; > >> + > >> if (this_cpu_read(tracing_irq_cpu)) { > >> - if (!in_nmi()) > >> + if (!in_nmi()) { > > > > This is a very high fast path (for tracing irqs off and such). Instead > > of adding a check here for a case that is seldom used (userstacktrace > > and tracing irqs on/off). Move this to surround the userstack trace > > code. > > > > -- Steve > > If the problem was only with userstacktrace, it will be reasonable to > surround only the userstack unwinder. But the situation is similar to > the previous "tracing vs CR2" case. As Peter taught me in > https://lore.kernel.org/lkml/20190708074823.GV3402@hirez.programming.kicks-ass.net/ > there are some other codes likely to to user access. > So I surround preemptirq events earlier. I disagree. The issue is with the attached callbacks that call something (a stack unwinder) that can fault. This is called whenever irqs are disabled. I say we surround the culprit (the stack unwinder or stack trace) and not punish the irq enable/disable events. So NAK on this patch. -- Steve