Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5948257pxb; Mon, 14 Feb 2022 11:25:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0+J3Z2lFSDHDpBS/2sc+x2d8J7zpprwdHx55qiF4+FIIICli1nP/yrLLri+T1LHLQHOAm X-Received: by 2002:a62:1b90:: with SMTP id b138mr607429pfb.4.1644866730411; Mon, 14 Feb 2022 11:25:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644866730; cv=none; d=google.com; s=arc-20160816; b=StQQvS3olslmOmwT3UMR7AWTwpiCfRLa+E+Lmd/SEHpRd5xcQf9ej8mws/2q6v5JFF yWzPGtwA3k5rpP4UM5IJI20eDtB10R9lL/y8BCdZUXvDg++cAKbz9T2+wQ0/II/b1LUT qqoeBr6RlF6r7b9KDQQ9CcHQO5tfj3ZT8cEifu52u/eVqW+g8PE4eldUxwJt744F1U5Y zH9PhWGlV2AmJ7tvytyEc8oZXHXJSIWrvrO7/tHruaCD+SwQpEYNKDeySnf4XpYnKz7B 3Dx66RJ5/IU1e2bvxze13iCHuGEqxlFtkslDre9HgKZILyrsseEvyPk1492Y7L8N2n0B KFnA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=t/xh7h782UBN/jZbD91JVD9rwY0PYE6Ef7A2XaPovz0=; b=sgAA2b4bTJHoF+fjkZPLRTn5CWqP5nJZWJ1OYAa4LZ2GaHc7XwDZ/qTdxR676/M75X ruRkJiktE61FUmgJ3r8exAxiPtc9J2GyvQnkjyJrSpAM/Gy+I/jFYHHdOV0y2//1GLHz sleX8D47tMPMN8gra8I2q9m8rBQNUWLI49mFrxYhmiAhelGK7F0YvNsA9dRnqDa26NzB 79oBfglt96uIFBx4AaU1Yo2o0JLWBlIoaBzLWmufFd4HJeQwt5WjJ6p38cGAvzr4CUg9 oI11YLCp/u1TwAxleyxIfwAYyvLXrixNAI42usEjTtRFhEcpqyuP/InfGzY+oJHZ3Dpj 9ymw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LDaIM6W4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e8si498676pgb.518.2022.02.14.11.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:25:30 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LDaIM6W4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE8F4DA858; Mon, 14 Feb 2022 11:16:11 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354595AbiBNNqD (ORCPT + 99 others); Mon, 14 Feb 2022 08:46:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354618AbiBNNpo (ORCPT ); Mon, 14 Feb 2022 08:45:44 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C5D575F4 for ; Mon, 14 Feb 2022 05:45:33 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21ECVusW014630; Mon, 14 Feb 2022 13:45:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=t/xh7h782UBN/jZbD91JVD9rwY0PYE6Ef7A2XaPovz0=; b=LDaIM6W45eWmucJPJxrvRoAEGE7zsy9TmhAUbW33wkwMCOBMB3FHWEpm8pQwb1eCjk07 o0MzcUO0R//2AbtKQLXTsFF+uZJqmWNWH5lTHU2hPzMsZL32N+5LP4nunFXMuADFM3Zw WV5Vu7u8/oUdF9P9K9Ble3hr1xejZUA4x2gfdWIibriBss6v9WgD/y1LePQvvNNq4FRF JIv0eA8gIsjbekgx9fu4dxtciSmJFR/1SQqntiTwGZfJABdsJUMjeU3EiKriNPMxjflv TzPxlbrUc2mfGjJnyZQPzt4/6qMslnFVk1VRl3uxRjIgpeLpW/yvHboAkaFIB4BeSOPJ Bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e6rt1624p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 13:45:18 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21EDQQEf032307; Mon, 14 Feb 2022 13:45:17 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e6rt1623q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 13:45:17 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21EDhnGj019890; Mon, 14 Feb 2022 13:45:15 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3e64h9nx3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Feb 2022 13:45:15 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21EDjCb336110832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Feb 2022 13:45:13 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA19C42045; Mon, 14 Feb 2022 13:45:12 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C8F584204F; Mon, 14 Feb 2022 13:45:12 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 14 Feb 2022 13:45:12 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id 7F15AE02E8; Mon, 14 Feb 2022 14:45:12 +0100 (CET) From: Sven Schnelle To: Steven Rostedt , Ingo Molnar Cc: linux-kernel@vger.kernel.org, Sven Schnelle Subject: [PATCH] ftrace: ensure trace buffer is at least 4096 bytes large Date: Mon, 14 Feb 2022 14:44:56 +0100 Message-Id: <20220214134456.1751749-1-svens@linux.ibm.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -0CZ3F6oPakx4SvErDd_hRaL7qjAqMzj X-Proofpoint-ORIG-GUID: RzYc1BmW-MYduAmjfnhD0JJV_T175gh4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-14_06,2022-02-14_03,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 suspectscore=0 priorityscore=1501 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202140082 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 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 --- 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); -- 2.32.0