Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6024862pxb; Mon, 14 Feb 2022 13:23:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZW4cqAH9iweXxDjxzjS8J/f58znmzmKfrrOBlL7FmDYnAIBo2FtFqj3/zvMGFhgs+Eu9+ X-Received: by 2002:a17:902:b60a:: with SMTP id b10mr170041pls.86.1644873789362; Mon, 14 Feb 2022 13:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873789; cv=none; d=google.com; s=arc-20160816; b=pJxW9RSGJsOaYOrWu6zKtaShxb0P6oO1ZjzKHx/0pdkaxuAUU4XJ6LD9MI9uA9SJTb GeC8RQB+XmqM0QYX5ZokhrGUn9KR415PHWqQDWw3almmkHgE50gn+1la24e53XFk0GDD KzzCPGvnZ/uuOb1Qq6jDvu7lMFxxQYnS29ZwgK3wPqmSkKaiFInbk5QdmOKacO+2HsRG /F8QvXI/jZJyCQFihLYM1qUMIxD5sVxQFGARGXIny40vn+jmkDt0KNsp5Nj734Bsb2NM 0cOsGls40K7L4p2bG47ou7uhaj0OGnemvBCH/LCp0U7CivB3Pf3g3yVGiU6HQ9AzzVkN KzqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=gDIgdT9+bdErigHU9+rnuRIleHXlmFkXt3VvDpVYYEg=; b=GzqG/3IcpeZ0r8B+jCHNGAFYnHGnQnOlzOmTLw+izslfBmGLZgr7iSxMxsrjqmPZ0d /ddJRuNPodHg7cfsMEjcaHW5MPyEZ6bg+dQcudKCBI6nmRjoHQJLBHu/AI3S4VA/qryi oM3qfi2toAhowKMGumWlPZIdnAS6XyHkK87BBOrlnWOmPXGudI2FvDJNlpP8cb01QoSp +IRhpG6NuSlGqKl6bmvfh4+ZZIsMl8JTU8yzbnoPUy8KspbYFbMP7Gu4Tm+WU4meshJa gVqX2BILavFM3QGmX7X3xCeDjf7VVA/o3XptLj6lVx6SgOrsi0IPYdBYAMrX94Gveo7N rSmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id oj18si7003571pjb.68.2022.02.14.13.23.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:23:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BF5C5237409; Mon, 14 Feb 2022 12:39:40 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239443AbiBNSnK (ORCPT + 99 others); Mon, 14 Feb 2022 13:43:10 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:56896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238772AbiBNSnJ (ORCPT ); Mon, 14 Feb 2022 13:43:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF6B6AA6C for ; Mon, 14 Feb 2022 10:42:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3660360F45 for ; Mon, 14 Feb 2022 18:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33092C340E9; Mon, 14 Feb 2022 18:42:40 +0000 (UTC) Date: Mon, 14 Feb 2022 13:42:38 -0500 From: Steven Rostedt To: Sven Schnelle Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ftrace: ensure trace buffer is at least 4096 bytes large Message-ID: <20220214134238.20255872@gandalf.local.home> In-Reply-To: <20220214134456.1751749-1-svens@linux.ibm.com> References: <20220214134456.1751749-1-svens@linux.ibm.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, 14 Feb 2022 14:44:56 +0100 Sven Schnelle wrote: > Booting the kernel with 'trace_buf_size=1' give a warning at > boot during the ftrace selftests: > > [ 0.892809] Running postponed tracer tests: > [ 0.892893] Testing tracer function: > [ 0.901899] Callback from call_rcu_tasks_trace() invoked. > [ 0.983829] Callback from call_rcu_tasks_rude() invoked. > [ 1.072003] .. bad ring buffer .. corrupted trace buffer .. > [ 1.091944] Callback from call_rcu_tasks() invoked. > [ 1.097695] PASSED > [ 1.097701] Testing dynamic ftrace: .. filter failed count=0 ..FAILED! > [ 1.353474] ------------[ cut here ]------------ > [ 1.353478] WARNING: CPU: 0 PID: 1 at kernel/trace/trace.c:1951 run_tracer_selftest+0x13c/0x1b0 > > Therefore enforce a minimum of 4096 bytes to make the selftest pass. > > Signed-off-by: Sven Schnelle Thanks, I'll queue this up for the next merge window. -- Steve > --- > kernel/trace/trace.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index 7c2578efde26..3050892d1812 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -1474,10 +1474,12 @@ static int __init set_buf_size(char *str) > if (!str) > return 0; > buf_size = memparse(str, &str); > - /* nr_entries can not be zero */ > - if (buf_size == 0) > - return 0; > - trace_buf_size = buf_size; > + /* > + * nr_entries can not be zero and the startup > + * tests require some buffer space. Therefore > + * ensure we have at least 4096 bytes of buffer. > + */ > + trace_buf_size = max(4096UL, buf_size); > return 1; > } > __setup("trace_buf_size=", set_buf_size);