Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3659701pxb; Sun, 24 Oct 2021 07:55:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFUyWLDMYVzSkbNGLsn7t6HV8p4rcQhNHe94OccN9LS0IHeKUvtUN63KDekqgjQ/TRiriV X-Received: by 2002:aa7:cc96:: with SMTP id p22mr18209975edt.91.1635087352500; Sun, 24 Oct 2021 07:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635087352; cv=none; d=google.com; s=arc-20160816; b=RJxk1mNp8+nuWKtOCs1ollSkJeefEQg/T6LyiGKojRyLrboBEXpmyLH+464hdkxrKn qGnh82zQyh70i1Hh3fnJycoZmmnXTB/6EuZypJkabRHKmIpngz5v+R8RqL4Fgzwueu4p Ixqa1xPPD3KIeatv9UsHWVpeJtBiontXyo6b8UgcWdy7s5V/0T9g0M2m1bORHhckjYcT 7rYnmir5b/ILN4NxGxz9x+MeZCKhGmHFJ0yXzEt4rSUgZKEDVRiaxLu1sIUv2sxJ9qPx zXJ6uPv91xYwJYo2hGyfFZPD39pROhI3c+A+/Ka9/IZujZLl58NNeFV8Jo/2TCQ0O6zM CCDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:ironport-hdrordr:ironport-data; bh=2v5px+9pljeTorI97+Rq31m4bPLZiBAmlcn4Q0+UKH4=; b=PXxeP4f0aOBzm/4URyRN0ObswMlB395+gDZKimlKCbsanGkjZ1cw2WsPJ7moQFXoNQ 8GZeH/Vau5CyBJ+rlEH1CASnO9MVN04XzLK0uDBfo8IYIcFIlWYLNjUotvjIVHqT6Ji1 WCqfUB8fvT8cnreM5Xwv2DQFRKC8FYdSNkpc2jUgrJtjGs8eAPgQVrupiQZqyPinA5p1 qwvTSemENt+PxlT+95vsbWuUKwSzSCzifOFO3XD3t94sQ2ghu/YEN2+BQ8BwTGPmv2Y2 i/lEVjtfohxRWJGlRBK6Gxz/oloGNzGhQf7swwMM9bziEPsmr48A+9RCJne0o5xiYWVc zHpg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s3si2901290edx.532.2021.10.24.07.55.11; Sun, 24 Oct 2021 07:55:52 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbhJXOsp (ORCPT + 99 others); Sun, 24 Oct 2021 10:48:45 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:35521 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229674AbhJXOso (ORCPT ); Sun, 24 Oct 2021 10:48:44 -0400 IronPort-Data: =?us-ascii?q?A9a23=3AijwePqCMaYvKhRVW/1Tiw5YqxClBgxIJ4g17XOL?= =?us-ascii?q?fAgLrhmgnhTdTxmYdXjiOaPeJYTb3etx/O96zpk8F7ZWAx9UxeLYW3SszFioV8?= =?us-ascii?q?6IpJjg4wn/YZnrUdouaJK5ex512huLocYZkERcwmj/3auK49CEmifnRLlbBILW?= =?us-ascii?q?s1h5ZFFYMpBgJ2UoLd94R2uaEsPDha++/kYqaT/73ZDdJ7wVJ3lc8sMpvnv/AU?= =?us-ascii?q?MPa41v0tnRmDRxCUcS3e3M9VPrzLonpR5f0rxU9IwK0ewrD5OnREmLx9BFrBM6?= =?us-ascii?q?nk6rgbwsBRbu60Qqm0yIQAvb9xEMZ4HFaPqUTbZLwbW9TiieJntJwwdNlu4GyS?= =?us-ascii?q?BsyI+vHn+F1vxxwSnggZvEcpOKaSZS4mYnJp6HcSFPpyuluDUwre4EV4eBwEGx?= =?us-ascii?q?U7tQVJj4MZRGEnKS9x7fTYuttj8IsN8niOocWu1lvyDjYCbAtRpWra7/N/sNV0?= =?us-ascii?q?CsYicdJEfPffIweczUHRBDDezVOPEsaDNQ1m+LArmH/cjlZsBSRpII25XTeyEp?= =?us-ascii?q?6172FGNjSd9iiR8JYmkiVvGTP+Wj0GVcdLtP34TiC6XKEhOjUnT/hWZoWGaGks?= =?us-ascii?q?PlwjzW73mUODBgdVnO4rOO/h0r4XMhQQ2QY8zQjhbMu+0uvR9PmGRu1vBasuh8?= =?us-ascii?q?aRsoVEOAg7gyJ4rTb7hzfBWUeSDNFLts8u6ceXzc3/kGGksmvBjF1trCRD3WH+?= =?us-ascii?q?d+pQZmaUcQOBTZaI3ZaEk1euJ++yLzfRynnFr5LeJNZRPWscd0o/w23kQ=3D?= =?us-ascii?q?=3D?= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A92gykKjVkWzu96c9cMLqRfgU7XBQXuYji2hC?= =?us-ascii?q?6mlwRA09TyX4rbHLoB1/73LJYVkqNk3I5urrBEDtexLhHP1OkOws1NWZLWrbUQ?= =?us-ascii?q?KTRekM0WKI+UyDJ8SRzI5g/JYlW61/Jfm1NlJikPv9iTPSL/8QhPWB74Ck7N2z?= =?us-ascii?q?80tQ?= X-IronPort-AV: E=Sophos;i="5.87,178,1631548800"; d="scan'208";a="116342455" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 24 Oct 2021 22:46:20 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 1E6BA4D0D9DC; Sun, 24 Oct 2021 22:46:19 +0800 (CST) Received: from G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Sun, 24 Oct 2021 22:46:20 +0800 Received: from G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) by G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Sun, 24 Oct 2021 22:46:20 +0800 Received: from [192.168.122.212] (10.167.226.45) by G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Sun, 24 Oct 2021 22:46:19 +0800 Subject: Re: [PATCH 2/2] refscale: prevent buffer to pr_alert() being too long To: CC: , , , , , , , , Philip Li , "kernel test robot" References: <20211022105111.29455-1-lizhijian@cn.fujitsu.com> <20211022105111.29455-2-lizhijian@cn.fujitsu.com> <20211022231555.GG880162@paulmck-ThinkPad-P17-Gen-1> From: "Li, Zhijian" Message-ID: Date: Sun, 24 Oct 2021 22:46:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20211022231555.GG880162@paulmck-ThinkPad-P17-Gen-1> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-yoursite-MailScanner-ID: 1E6BA4D0D9DC.A260C X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lizhijian@fujitsu.com X-Spam-Status: No Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org on 2021/10/23 7:15, Paul E. McKenney wrote: > On Fri, Oct 22, 2021 at 06:51:11PM +0800, Li Zhijian wrote: >> 0Day/LKP observed that the refscale results become incompleted >> when a larger nruns(such as 300) is specified. >> It seems that printk() can accept < 1024 buffer at once. >> Print the buffer if its length exceeds 800 simply. >> >> CC: Philip Li >> Reported-by: kernel test robot >> Signed-off-by: Li Zhijian > Good catch! A couple of questions below. > > Thanx, Paul > >> --- >> kernel/rcu/refscale.c | 23 +++++++++++++---------- >> 1 file changed, 13 insertions(+), 10 deletions(-) >> >> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c >> index 2cbe2a2ba387..b1b9052010fd 100644 >> --- a/kernel/rcu/refscale.c >> +++ b/kernel/rcu/refscale.c >> @@ -604,7 +604,7 @@ static u64 process_durations(int n) >> char *buf; >> u64 sum = 0; >> >> - buf = kmalloc(128 + nreaders * 32, GFP_KERNEL); >> + buf = kmalloc(64 * 20, GFP_KERNEL); > This allocation (and the one below) is 1280 bytes rather than > 1024 bytes. Why the extra couple hundred bytes? Nothing special, so let's change 1024 or (800 + 64 ),which is sufficent as well ? > >> if (!buf) >> return 0; >> buf[0] = 0; >> @@ -617,13 +617,15 @@ static u64 process_durations(int n) >> >> if (i % 5 == 0) >> strcat(buf, "\n"); >> + if (strlen(buf) > 800) { >> + pr_alert("%s", buf); > Does the tools/testing/selftests/rcutorture/bin/kvm-recheck-refscale.sh > script also require changes to handle the partial lines? I missed that, i will take a look at it Thanks Zhijian > > Same for the later comparison against 800. > >> + buf[0] = 0; >> + } >> strcat(buf, buf1); >> >> sum += rt->last_duration_ns; >> } >> - strcat(buf, "\n"); >> - >> - SCALEOUT("%s\n", buf); >> + pr_alert("%s\n", buf); >> >> kfree(buf); >> return sum; >> @@ -648,7 +650,7 @@ static int main_func(void *arg) >> >> VERBOSE_SCALEOUT("main_func task started"); >> result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL); >> - buf = kzalloc(64 + nruns * 32, GFP_KERNEL); >> + buf = kzalloc(64 * 20, GFP_KERNEL); >> if (!result_avg || !buf) { >> VERBOSE_SCALEOUT_ERRSTRING("out of memory"); >> errexit = true; >> @@ -701,10 +703,7 @@ static int main_func(void *arg) >> if (errexit) >> goto err; >> >> - buf[0] = 0; >> - strcat(buf, "\n"); >> - strcat(buf, "Runs\tTime(ns)\n"); >> - >> + pr_alert("Runs\tTime(ns)\n"); >> for (exp = 0; exp < nruns; exp++) { >> u64 avg; >> u32 rem; >> @@ -712,9 +711,13 @@ static int main_func(void *arg) >> avg = div_u64_rem(result_avg[exp], 1000, &rem); >> sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem); >> strcat(buf, buf1); >> + if (strlen(buf) > 800) { >> + pr_alert("%s", buf); >> + buf[0] = 0; >> + } >> } >> >> - SCALEOUT("%s", buf); >> + pr_alert("%s", buf); >> >> err: >> // This will shutdown everything including us. >> -- >> 2.33.0 >> >> >> >