Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3257645imm; Fri, 10 Aug 2018 06:28:39 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy6mNpP7pnJPFFkUOxq6OD7EHpHYjkzSK6WIedkXASsfbsV+YQW8uGqbSaGs4BxCiEjE9d6 X-Received: by 2002:a63:c902:: with SMTP id o2-v6mr6546681pgg.118.1533907719192; Fri, 10 Aug 2018 06:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533907719; cv=none; d=google.com; s=arc-20160816; b=NtEgmEsL509vRLt405w9YW1DGzMlnD3q7XWg0GFvlPnIyUI4Zz7z/ZHBmdOSUXM0a9 UiLML2N0a4FHdtR51CF1T6l/JVFxRY6ALYAl0mrqFjRX0MhrMuldj/bkUQwHINPVGb+I GqzngoFdEMd4qxzFYg037nCO7k1NP0qNh6haWIJU2s5UQ1y7JLotwiq8Qy1/D4uLnJQq KAHf2bnA0MFTqPzKQLBzv+A7UrubWAL38CvE9XzFRedV8thd/DME/WZ92K8/6sJ8kSBi ZabbOxpqUjWZluzcH7uSXvJE4XwJ/JCQSYhiZhLjkQpCcb2QbvnluVwuisnOXYaCkl86 XaKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=tusA5xAlIzxwgbYzfV50sQn1WpDTr2pLF3kNCqXNVeI=; b=ziqwfGCZe1SsD3Nf9C1614OFTPF9m+i5MF8sQv3pcaFCkorGjndhoeI0ihsiFu6ctb NfGBrjqSPqMvReZvqKqPLrQ6Y7Ni36AmvpeZFmyxj9T6JnA8gLc2MYSRsN2jN4FxKMOu +5vh9xVF1CJmvU5WjL2CvtmhdqIdMrtGOyRMmisEu0LIe6mYyW8Fa6GlGxo+fB+sJ8JD trxdUXr1ADRo81I5MImpyRPwwwnXkDjX1Oco4ptxORlT7TK0OAC1eus79Hhl74d7HKpf gk4Fh+p+EqXFZvdZUtyZxL4llwnMKu/FPkxsFcD59OBKQCbIXteviVCVbxweb9lOHp/K Fhlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Cw4qYfN4; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63-v6si8998862pgd.425.2018.08.10.06.28.23; Fri, 10 Aug 2018 06:28:39 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=Cw4qYfN4; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728046AbeHJPb0 (ORCPT + 99 others); Fri, 10 Aug 2018 11:31:26 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:41059 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727543AbeHJPbZ (ORCPT ); Fri, 10 Aug 2018 11:31:25 -0400 Received: by mail-yw1-f67.google.com with SMTP id q129-v6so8483362ywg.8 for ; Fri, 10 Aug 2018 06:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tusA5xAlIzxwgbYzfV50sQn1WpDTr2pLF3kNCqXNVeI=; b=Cw4qYfN4VPXuIl9eHN07+sYdlySSwxxAtoNnZozAQ2KOlS2k+3AwnJbagSnIsXQlra OpdxxNdvvGVQH+2xZGLq1qUHLP9x5/rGKJ2DrOhWRKBZlijezNHB6vFt/KquuN9++G0Z kgoH+cr0QHCn6afIFJUC3FXIHPc89LQuOKrWFS5LLWiRv9/ysU49WqEtPDq8Z11X7Cmg Cm3LueGDByR4GRz34op0ikeREBzVXP4CZzDkuzm1zA1H/fr8YubUE8SiCLOdZpvPhRAU 0v0alwA55D/UYgw1Fbxb+0lraZKA4iXuTlXFGkY1ibnIyB2PShqeSlR/R8IdVuxZ/ewy eOHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tusA5xAlIzxwgbYzfV50sQn1WpDTr2pLF3kNCqXNVeI=; b=Dl1cU03hMm4HHnVmZnnzxpQQl+YraewoY9ll2APxtV2eUUeorSlHj/Gs1zpF5Y6NqL jF7O41rQaRms1nxhz0BVwE2ik9B7782IYrnnNW19dExcYxS2nvwsIFz/EfwkgwEzEr/+ Ncr78QKcIaYKfv6XlXSfXfkg1/oOuPQ9m0l2/d9PekmsmgFf3mUEUb870Ua+3sKdDFoN UiItqOwqMre9MzPOt5NP/LJ6WThumQh3PlEy0SBrBx4ll4hD/bnmo3KsKaWhkokBbjTd VkS6w2LDr4fLCIFRGpTiugx+GRddNHY0qGlc5geeKkjmU1usAubJJNS5hk+W1nDw0Tq/ eNIA== X-Gm-Message-State: AOUpUlGsPVf4AU6aN/m99+kL1iylxwnom6REZ8WK81GRY2ioINh5C92q /pw0ijyXUtucGKeBxAaYGty7ajZZkL8EtsVhAYUdzA== X-Received: by 2002:a5b:607:: with SMTP id d7-v6mr3609527ybq.281.1533906095111; Fri, 10 Aug 2018 06:01:35 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:3995:0:0:0:0:0 with HTTP; Fri, 10 Aug 2018 06:01:34 -0700 (PDT) In-Reply-To: <20180810215511.60d5882c8efd271c01043881@kernel.org> References: <20180806034049.67949-1-joel@joelfernandes.org> <20180806230536.ef217b2c2c008838606bedc3@kernel.org> <20180810215511.60d5882c8efd271c01043881@kernel.org> From: Joel Fernandes Date: Fri, 10 Aug 2018 06:01:34 -0700 Message-ID: Subject: Re: [PATCH ftrace/core] tracing: irqsoff: Account for additional preempt_disable To: Masami Hiramatsu Cc: "Joel Fernandes (Google)" , LKML , "Cc: Android Kernel" , Ingo Molnar , Steven Rostedt , Paul McKenney , Mathieu Desnoyers , Namhyung Kim , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 10, 2018 at 5:55 AM, Masami Hiramatsu wrote: [..] >> >> >> The other way to fix this is to just use SRCU for all tracepoints. >> >> However we can't do that because we can't use NMIs from RCU context. >> >> >> >> Fixes: c3bc8fd637a9 ("tracing: Centralize preemptirq tracepoints >> >> and unify their usage") >> >> Fixes: e6753f23d961 ("tracepoint: Make rcuidle tracepoint callers use SRCU") >> >> Reported-by: Masami Hiramatsu >> >> Signed-off-by: Joel Fernandes (Google) >> >> --- >> >> kernel/trace/trace_irqsoff.c | 26 ++++++++++++++++++++++++++ >> >> 1 file changed, 26 insertions(+) >> >> >> >> diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c >> >> index 770cd30cda40..ffbf1505d5bc 100644 >> >> --- a/kernel/trace/trace_irqsoff.c >> >> +++ b/kernel/trace/trace_irqsoff.c >> >> @@ -603,14 +603,40 @@ static void irqsoff_tracer_stop(struct trace_array *tr) >> >> */ >> >> static void tracer_hardirqs_on(void *none, unsigned long a0, unsigned long a1) >> >> { >> > >> > To ensure this function must not be preempted even if we increment preempt >> > count, I think you should check irq_disabled() whole this process, put below >> > here. >> > >> > if (unlikely(!irq_disabled())) >> > return; >> > >> > Since irq_disabled() will be checked in irq_trace() anyway, so no problem >> > to return here when !irq_disabled(). >> >> IRQs can never be enabled here. The trace hooks are called only after >> disabling interrupts, or before enabling them. Right? >> > > Even though, it should be verified or atleast commented on the function header. Ok. ftrace/core has been fixed since since so this patch is outdated and isn't needed any more, but I agree a separate patch doc comment would help make it clear about this fact. Both IRQ and preempt tracepoints work this way, they fire only within their critical section.