Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6055534rwl; Wed, 22 Mar 2023 06:05:20 -0700 (PDT) X-Google-Smtp-Source: AK7set/uIKJf63DA5fV0JJp2siU4x1BulQIUipZFoOsOYm5YKZ0sTk1DTzQntPGyILGSZqI+VhKN X-Received: by 2002:aa7:dc10:0:b0:501:c6e5:8735 with SMTP id b16-20020aa7dc10000000b00501c6e58735mr7011895edu.31.1679490320092; Wed, 22 Mar 2023 06:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679490320; cv=none; d=google.com; s=arc-20160816; b=I7SPxGXDs9KMzBpnVZdPU0dhQKjVActq37A3kC3YbTbGAkzQA7lRBOy8hA5cJccD7o tJPRbY7sNqKZur0gs18ni96c2PItEDdiGwym+wwrvl1cnGttUJhgEsYKK26VrAQQszQu 31fOrFskar2r896Rt/bPHmWaNDYpFC+uSA9/aBEMM+bj6G7OmYA2wxsyr7X/pjvf6zh5 eMiyba61lIBM8l3KX3QZjILRfItelifKcHZHgslUj43MoSHlQWoqDS5kdhn1SrX9t47S 2uVlNwuQmq3x5lErE8r9fAEgRROZFyfUQ/5iCjgm8p8dpof1icZinPgjAga1xh6Fu0yN T83Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6BRyU+JbkSdh5FU2QQ8gNeV3eQhFmOfGX6dsLMm751I=; b=O4FenEIre7hkYBySLA3Ox0GrTIDAzAzVImx5+xKlelmfGcARomiPmm83/M2h0grATL t2tVTRSH90A9BNRixnl33sdSupyvChVgykhHs0ZQ2zmDwp3QH83S+rUKzNxtDoHDaOLT uHN1+oS5vjsxRH9XSk4IakH+eiasqt2RYd5l4pM3yixcMqIIbOqwwFUYrLUSJ+cCrhZe zQZzkzA3iCQ+eBJcG62de8PwvuBtRl/7DgZtwG2s4+1d4Bt1xXILdT5Kk8aIrZWfFhQh /N69Ne5cBcAAD8vW706VYtEOvi3+onS/Av9iAWhnpcomU6+7L6Weocqt1Kh8fXgEIAn1 8LYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Wn4ZgGHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020aa7c40c000000b004bcedde1496si15864980edq.287.2023.03.22.06.04.31; Wed, 22 Mar 2023 06:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Wn4ZgGHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbjCVMxX (ORCPT + 99 others); Wed, 22 Mar 2023 08:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjCVMxW (ORCPT ); Wed, 22 Mar 2023 08:53:22 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 035C617CFE; Wed, 22 Mar 2023 05:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6BRyU+JbkSdh5FU2QQ8gNeV3eQhFmOfGX6dsLMm751I=; b=Wn4ZgGHpfD6yPJFUT5oLuFN3qw UfwHFLXgWP5rl/xFiyT4EcY81xma2D2cL1/AyfutYWo1Wv25FiR7Kz5v1/C3sJ1SlD/AvnbrWpipp gz3ao5le8asoZrMVWTAiI7VYVeHTSZ+XQVTwYj1bg0NLj6yCkkayJAQNlkiEWqvqtPplz+j9f7taf ErnrrG7r6ryAIf0drZhRYZaCpFt3Mh7YWOoEQfOvNtwNRcBdETtdYKBJhpBSR7//MhcP7QnXweZ/q SKQfFLELiKFR2xJn+5A+D6/HwjVSaO+Ar0niJ59rYCTr5osVIvnHQ2aSynYd/3hZiOfh+lBMV+OOT k49oq18g==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pexxc-0031Ii-3q; Wed, 22 Mar 2023 12:53:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id E0E0230030F; Wed, 22 Mar 2023 13:52:57 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4D34D205D08C3; Wed, 22 Mar 2023 13:52:57 +0100 (CET) Date: Wed, 22 Mar 2023 13:52:57 +0100 From: Peter Zijlstra To: Steven Rostedt Cc: Thomas Gleixner , LKML , Linux Trace Kernel , Masami Hiramatsu , Josh Poimboeuf , Ross Zwisler , Joel Fernandes , "Paul E. McKenney" , Miroslav Benes Subject: Re: [PATCH] tracing: Trace instrumentation begin and end Message-ID: <20230322125257.GA2357380@hirez.programming.kicks-ass.net> References: <20230321215121.71b339c5@gandalf.local.home> <87y1np824t.ffs@tglx> <20230322084834.37ed755e@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230322084834.37ed755e@gandalf.local.home> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 22, 2023 at 08:48:34AM -0400, Steven Rostedt wrote: > On Wed, 22 Mar 2023 12:19:14 +0100 > Thomas Gleixner wrote: > > > Steven! > > > > On Tue, Mar 21 2023 at 21:51, Steven Rostedt wrote: > > > From: "Steven Rostedt (VMware)" > > > produces: > > > > > > 2) 0.764 us | exit_to_user_mode_prepare(); > > > 2) | /* page_fault_user: address=0x7fadaba40fd8 ip=0x7fadaba40fd8 error_code=0x14 */ > > > 2) 0.581 us | down_read_trylock(); > > > > > > The "page_fault_user" event is not encapsulated around any function, which > > > means it probably triggered and went back to user space without any trace > > > to know how long that page fault took (the down_read_trylock() is likely to > > > be part of the page fault function, but that's besides the point). > > > > > > To help bring back the old functionality, two trace points are added. One > > > just after instrumentation begins, and one just before it ends. This way, > > > we can see all the time that the kernel can do something meaningful, and we > > > will trace it. > > > > Seriously? That's completely insane. Have you actually looked how many > > instrumentation_begin()/end() pairs are in the affected code pathes? > > > > Obviously not. It's a total of _five_ for every syscall and at least > > _four_ for every interrupt/exception from user mode. > > > > The number #1 design rule for instrumentation is to be as non-intrusive as > > possible and not to be as lazy as possible. > > And it still is. It still uses nops when not enabled. I could even add a > config to only have this compiled in when the config is set, so that > production can disable it if it wants to. > > Just in case it's not obvious: > > if (tracepoint_enabled(instrumentation_begin)) > call_trace_instrumentation_begin(ip, pip); > > is equivalent to: > > if (static_key_false(&__tracepoint_instrumentation_begin.key)) > call_trace_instrumentation_begin(ip, pip); > It is still completely insane. NAK.