Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2726667ybh; Mon, 9 Mar 2020 11:44:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtZvWUwxQukt9b9PV1HCH2+t51pC5UffpuW1cnCLheEnpjLhe6E/dE6Z1qjNf9g2Yj39fLk X-Received: by 2002:a9d:64d4:: with SMTP id n20mr13115261otl.193.1583779470155; Mon, 09 Mar 2020 11:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583779470; cv=none; d=google.com; s=arc-20160816; b=kpDSlT2Glr+QEBsxwvqNUzZIJJjo3rXcWHReRr5dXIunnKTRWGdy4ZgbfsfAsTeJeb zVKhNitAG0BEnNrUrkiI5XQev2U2R5H7FvgfPbTNe7uk5Iqv9UzbhqACiio+AdqqUoYx u8KM2z/v4HfhSFaGTnqqV5Dn7MD0q6tt11rfPLvXDLZk/1BdhYD5I4Wsg6gWVlhaXe4m /RnSK0lsSb4zR1y2zFQx4Ecrp6Ms0PmuPOId3UJiIveloq+pvy/ydYncFa5Z+/mkgFnz nL9+/IWypXggm0ArFEsoXueqjTUQm6nzwLt2NM1S12i3VDp6KQJKaJ+A4JYcDkUFZ7J7 uGQg== 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 :in-reply-to:references:mime-version:dkim-signature; bh=B1cHoYe2u9DgToST9hIQjGF/Rfj9S0TnVh78F/vig4c=; b=vhKXagxpt0pVsWen44V+jaV/7gTuInsHpPo0wGSay1puwOwUDW15f6s9jvutVNEfV3 2QkADnKuTZZR+vwsfrtI/QCxwF/T/enR2zpdmWhJnsuMxoQwVq1wxkQsaUFFuw9xed6D Jm9zX1eIZoIAN0kVamVxWCJ00o/ckfCl3qzuBDM/YX6i20+1D+Ds4m2iLGUiToAD3N24 3cJyiKtjfotZHFy2526SoZLgUASzGIRC+xkXlfBNGATXet3E1RA/kck+YtWpx5Z2uC+f nqpauT/zUtbETK2Y3fnuzdF+HM1QSbo1rRHdnCs19Cc/viEn0p+UBs+nqZ3AMPutKB9d SysQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=OhCbVkDB; 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 v19si6360535otq.57.2020.03.09.11.44.17; Mon, 09 Mar 2020 11:44:30 -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=@joelfernandes.org header.s=google header.b=OhCbVkDB; 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 S1727387AbgCISmm (ORCPT + 99 others); Mon, 9 Mar 2020 14:42:42 -0400 Received: from mail-il1-f193.google.com ([209.85.166.193]:44962 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727334AbgCISmm (ORCPT ); Mon, 9 Mar 2020 14:42:42 -0400 Received: by mail-il1-f193.google.com with SMTP id j69so9638949ila.11 for ; Mon, 09 Mar 2020 11:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B1cHoYe2u9DgToST9hIQjGF/Rfj9S0TnVh78F/vig4c=; b=OhCbVkDBy0ULrp7f5nJtRTxtwLXpCDrKy9CwNdVkF+E9kFFQCoodqc/q8eaGTUvXeU waOxFZr4ccv4BliwKQhUJmvX66JnDRetyd/KZYgSSMyzXmH4EA/KagRjSnxdYwx4osT8 wTNvMvXOcvTQR71UyszaDexVi9ZuPJUMWs5lo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B1cHoYe2u9DgToST9hIQjGF/Rfj9S0TnVh78F/vig4c=; b=KsJHbIXvKziPuLqeVY/V71IiDfMl59wphfVXnxmgJX1XVG27ewCNEuBy7uMOI3dN3Q ye/sZaz4MxzOLWg2eiVKDY/Po153v8Sq8ZKSXp466DS1SFA03Bivn8R4wthBAkEZocEY NGAjMwat0hWj/hWl2q61HA10Ee1TMpAA1dMhd86n5vj0ow2KSFVbBCZkdcFZ09nx/Guu F+SyNhOEqgO28ONqnBnNeC8AmHhVgvjN03u3r4WWrjOFZ15qvRyFpy62vQZakys+ycVI EOfAaSbHD5T6RIM97mWEXAvpqTtl+8l4X+OiP65g6ovHa/GmileUlleuXZOeyL7IW5Vv 74/w== X-Gm-Message-State: ANhLgQ0BWuYSD5/HqFeLzhqtoifjlyNOh5/DaVbX+oZlhLBGndroJHNH NUGwvr4ArRti8uGVXddanm4rms0225iW22qGtDJgoewQnHvJmQ== X-Received: by 2002:a92:8901:: with SMTP id n1mr17948317ild.176.1583779360390; Mon, 09 Mar 2020 11:42:40 -0700 (PDT) MIME-Version: 1.0 References: <87mu8p797b.fsf@nanos.tec.linutronix.de> <20200309141546.5b574908@gandalf.local.home> In-Reply-To: <20200309141546.5b574908@gandalf.local.home> From: Joel Fernandes Date: Mon, 9 Mar 2020 11:42:28 -0700 Message-ID: Subject: Re: Instrumentation and RCU To: Steven Rostedt Cc: Thomas Gleixner , LKML , Peter Zijlstra , Masami Hiramatsu , Alexei Starovoitov , Mathieu Desnoyers , "Paul E. McKenney" , Frederic Weisbecker , Daniel Bristot de Oliveira , Valentin Schneider 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 Mon, Mar 9, 2020 at 11:15 AM Steven Rostedt wrote: > > On Mon, 09 Mar 2020 18:02:32 +0100 > Thomas Gleixner wrote: > [...] > > #3) RCU idle > > > > Being able to trace code inside RCU idle sections is very similar to > > the question raised in #1. > > > > Assume all of the instrumentation would be doing conditional RCU > > schemes, i.e.: > > > > if (rcuidle) > > .... > > else > > rcu_read_lock_sched() > > > > before invoking the actual instrumentation functions and of course > > undoing that right after it, that really begs the question whether > > it's worth it. > > > > Especially constructs like: > > > > trace_hardirqs_off() > > idx = srcu_read_lock() > > rcu_irq_enter_irqson(); > > ... > > rcu_irq_exit_irqson(); > > srcu_read_unlock(idx); > > > > if (user_mode) > > user_exit_irqsoff(); > > else > > rcu_irq_enter(); > > > > are really more than questionable. For 99.9999% of instrumentation > > users it's absolutely irrelevant whether this traces the interrupt > > disabled time of user_exit_irqsoff() or rcu_irq_enter() or not. > > > > But what's relevant is the tracer overhead which is e.g. inflicted > > with todays trace_hardirqs_off/on() implementation because that > > unconditionally uses the rcuidle variant with the scru/rcu_irq dance > > around every tracepoint. > > > > Even if the tracepoint sits in the ASM code it just covers about ~20 > > low level ASM instructions more. The tracer invocation, which is > > even done twice when coming from user space on x86 (the second call > > is optimized in the tracer C-code), costs definitely way more > > cycles. When you take the scru/rcu_irq dance into account it's a > > complete disaster performance wise. > > Is this specifically to do with the kernel/trace/trace_preemptirqs.c code > that was added by Joel? Just started a vacation here and will be back on January 12th. Will take a detailed look at Thomas's email at that time. Adding some more folks (Daniel, Valentin) who have used the preempt/irq tracepoints. I agree we should reorder things and avoid these circular dependencies, it bothers me too. I am happy to help with any clean ups related to it. Let us definitely discuss more and fix it. Thanks. - Joel