Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2216741ybt; Sun, 28 Jun 2020 11:47:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycnSd5S7FWA800GcDpVHKi2bkJLv5cZ4sNt73OLE02aGtKdMC0UHJ6P0KhH5j7ebfiQ1+N X-Received: by 2002:a50:c181:: with SMTP id m1mr13602570edf.27.1593370067094; Sun, 28 Jun 2020 11:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593370067; cv=none; d=google.com; s=arc-20160816; b=brywAZ0jwi2tuKrkUG3u/UwVYFMn+QGl5D5QCxpjwUzyMtI8h5lcrkkRRJ0qe3WPXe Gm02kh3vTCio5pPCpQ/PaJDHTS2l+Za8nTf3EdwEhfyZgiCCvnWPGZhW7Y40y3bKsP8V ygNdB6gLkK/0jwBgBTOnC9PT7JPCsrhZdw+Na4aDsTGxLVmluxMncin9PphlLylLuKW+ QQ+mQCowBi2tEIR5KiPzV2V32Rx+oR1ZNgfiZHJTxpoO1UWU/ZCFc9AiqSnBBvUVux03 eCgZPWhQyK21ZwuO0Es+AuGVFYYqHQ6z9gq6mcu5zQ8NQxVjU3Xinz3N6j2DWmESc7w8 gr1A== 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=ScVfcSxQlNORq96er1wZBQ44g/TzKP46qmzYdIUl15k=; b=lJT4MnC/S7ijUB4ESlRFEB/Dd7v6x6bupy3j5kn0srHfRlJ2YkfINbDXZVJwTBoiNx anQbEfjgXyVqC7GeUgeabcg7/0rrrYfKdu+ZzbyhC4qXR7qP5qMzOzLq92kozCs3s0qJ RjE01v+Tx7x8NFzrDZXAahKs2PD7zdkL9Z/I4/NfuRxQ2oFVj3kewslycgiB7ec24Ub3 8TzDU6IaBtQyNxKbKrD1bKKSDKtWXG8jkVXlmC+cXwQAHg84s8UvEf+mSJNbtEHxD8C2 GhegwrC3LDoEYljCoTCJMVQP1T0zM5Uhnn7JKX5jnt9t+kbm86px7oAANDmNw5ta3s8W hEyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si4479989ejc.605.2020.06.28.11.47.24; Sun, 28 Jun 2020 11:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726752AbgF1SqU (ORCPT + 99 others); Sun, 28 Jun 2020 14:46:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:33544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726636AbgF1SqU (ORCPT ); Sun, 28 Jun 2020 14:46:20 -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 E5523206C0; Sun, 28 Jun 2020 18:46:17 +0000 (UTC) Date: Sun, 28 Jun 2020 14:46:16 -0400 From: Steven Rostedt To: Alexei Starovoitov Cc: Nicolas Boichat , LKML , Ingo Molnar , Andrew Morton , Kees Cook , Jason Gunthorpe , Daniel Vetter , Peter Zijlstra , Vinod Koul , Andy Shevchenko , Alexey Dobriyan , Tiezhu Yang , Thomas Gleixner , "Guilherme G . Piccoli" , Will Deacon , Douglas Anderson , Guenter Roeck , bpf@vger.kernel.org Subject: Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option Message-ID: <20200628144616.52f09152@oasis.local.home> In-Reply-To: <20200628172700.5ea422tmw77otadn@ast-mbp.dhcp.thefacebook.com> References: <20200624084524.259560-1-drinkcat@chromium.org> <20200624120408.12c8fa0d@oasis.local.home> <20200625035913.z4setdowrgt4sqpd@ast-mbp.dhcp.thefacebook.com> <20200626181455.155912d9@oasis.local.home> <20200628172700.5ea422tmw77otadn@ast-mbp.dhcp.thefacebook.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 Sun, 28 Jun 2020 10:27:00 -0700 Alexei Starovoitov wrote: > On Fri, Jun 26, 2020 at 06:14:55PM -0400, Steven Rostedt wrote: > > On Wed, 24 Jun 2020 20:59:13 -0700 > > Alexei Starovoitov wrote: > > > > > > > > > > > > Nack. > > > > I nack your nack ;-) > > ok. let's take it up to Linus to decide. I'm fine with that. > > > > > > > > The message is bogus. It's used in production kernels. > > > > > bpf_trace_printk() calls it. > > > > > > > > Interesting. BTW, the same information (trace_printk is for debugging > > > > only) is repeated all over the place, including where bpf_trace_printk > > > > is documented: > > > > https://elixir.bootlin.com/linux/latest/source/include/linux/kernel.h#L757 > > > > https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/bpf.h#L706 > > > > https://elixir.bootlin.com/linux/latest/source/kernel/trace/trace.c#L3157 > > > > > > > > Steven added that warning (2184db46e425c ("tracing: Print nasty banner > > > > when trace_printk() is in use")), so maybe he can confirm if it's > > > > still relevant. > > > > > > The banner is nasty and it's actively causing harm. > > > > And it's doing exactly what it was intended on doing! > > I disagree. The message is _lying_ about the state of the kernel. > It's not a debug kernel and it's absolutely fine for production. No it is not! It causes the trace buffer to be filled with crap that can not be easily disabled. That's the reason I only allowed trace_printk() for debug kernels. And the only way to prevent people from sticking it in their code and making an API out of it was for this banner. I refuse to remove that banner. It's my API! > > > > Now I do have an answer for you that I believe is a great compromise. > > > > There's something you can call (and even call it from a module). It's > > called "trace_array_vprintk()". But has one caveat, and that is, you > > can not write to the main top level trace buffer with it (I have > > patches for the next merge window to enforce that). And that's what > > I've been trying to avoid trace_printk() from doing, as that's what it > > does by default. It writes to /sys/kernel/tracing/trace. > > > > Now what you can do, is have bpf create > > a /sys/kernel/tracing/instances/bpf_trace/ instance, and use > > trace_array_printk(), to print into that, and you will never have to > > see that warning again! It shows up in your own > > tracefs/instances/bpf_trace/trace file! > > > > If you need more details, let me know, and I can give you all you need > > to know to create you very own trace instance (that can enable events, > > kprobe events, uprobe events, function tracing, and soon function graph > > tracing). And the bonus, you get trace_array_vprintk() and no more > > complaining. :-) :-) :-) > > We added a bunch of code to libbcc in the past to support instances, > but eventually removed it all due to memory overhead per instance. > If I recall it was ~8Mbyte per instance. That was couple years ago. I'd like to see where that 8 MB per instance came from. You can control the size of the instance buffers. If size is still an issue, I'll be happy to work with you to fix it. > > By now everyone has learned to use bpf_trace_printk() and expects > to see the output in /sys/kernel/debug/tracing/trace. > It's documented in uapi/bpf.h and various docs. Re-teach them, or are you finally admitting that the tracing system is a permanent API? This is the reason people are refusing to add trace points into their subsystems. Because user space may make it required. I see no reason why you can't create a dedicated BPF tracing instance (you only need one) to add all your trace_array_printk()s to. -- Steve