Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp846602iog; Wed, 15 Jun 2022 13:46:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tA4i2+imzuL1P1Efx0MnwW1s303Z/GIJT6cftwir3teLYBgaNlpmzo3Yx7gj6LqKhnw0gQ X-Received: by 2002:a17:90b:1b08:b0:1e7:71de:7714 with SMTP id nu8-20020a17090b1b0800b001e771de7714mr1313176pjb.214.1655326008716; Wed, 15 Jun 2022 13:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655326008; cv=none; d=google.com; s=arc-20160816; b=Bw6eqOpmkdmN1/jIBxtmZv5oNmwfFoBng36/6YpmHb+qAnekC8ClCxYrZjxwWqrWt/ gwGsxT/2+1/IjqJ6BCYUlmD8zJ50jOV9INT6EBHMphKI2AAlzfxHWjaw6xJGA7gNu6fz H/ef/evq0pdrPbz5jeAgbRU6REd2482DqAJS/L8W/rgvV8cYU125YaLZc79njbzDLhFX ObYA0fsjBdwuyr+M7rxw+hkH7pyFwxKDGgt3aq6f+m+TqqEkDZeNFKEq2PQ7VQ1bhUhR 65T4pUVFNAMIMGBa7rryNYcOxZtipMGou+pO2ThIzin0upz1i2h1DJOcn4NOIbstg06z e5BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8r+hzet5t8kQ9FT7Pu1Ip98hiFGbKJdzOlAKlpJMkVk=; b=oVNJFMB+DtAYG15Ymju+pGkaNsTHhC9GitDxH3i+Bkxs+lKgKSGOXh6qzhOU61INE+ oLByVL7IWZdp2JzJofEKaQLzP/BWe82UKtwX1vVlaL38pj1UjZqI24+2hFmc/eF7p7tP eNt42sueq6wjT98zCjotJ8Lo2I4U9SAxQzt4Tasc+V8vX1droKFwaqu8Uw/gvLl9TcjN EjPNt33SKeLH5nqcCWB5H9RgWNKMQgxroYHHSZXGqoMTHZFRHdZ4sWb4Q89id5ZGssaR MOtDTIETU23Jvole8GjRO5buBWgY+hR2YQbiYakeN2jHTexQerY143K7Z0IdAgzGdKSy oUcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CyC4ObBI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv8-20020a17090b11c800b001dfde430e6bsi93802pjb.16.2022.06.15.13.46.36; Wed, 15 Jun 2022 13:46:48 -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=@gmail.com header.s=20210112 header.b=CyC4ObBI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346194AbiFOU2a (ORCPT + 99 others); Wed, 15 Jun 2022 16:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346477AbiFOU21 (ORCPT ); Wed, 15 Jun 2022 16:28:27 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4E7B35ABE; Wed, 15 Jun 2022 13:28:26 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id s12so25471393ejx.3; Wed, 15 Jun 2022 13:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8r+hzet5t8kQ9FT7Pu1Ip98hiFGbKJdzOlAKlpJMkVk=; b=CyC4ObBITCEx03cJ+jHHKSflHxNM9MjGRpdEtxv5uX1nBpELCY85SMAVyymEE7lhxj noa/brlVupI+G847Uer/1UtQOYKhP4AQJcUX9tm3dle2pFVKBnYcxrAd0vCVo04Lmb+f w4UcRyvQUyz9AfxIpx49xKWt/zfKoO4g8gyaSMyk5qWokALZqJKtB8sstf6UHZZpxBQp 72gwHpcFohzN6o/QP+/l+xcc4Z4Uko8WuVhHc/uCCcsqvsCdHxsCCOUZ8SqmubdaMAJz sX74eaqiVVp3aFw3lJYG3MPWIflWgY8myiSBd5caGXpM0wnaPNjDez+qIMnpdgu8D7a6 31kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8r+hzet5t8kQ9FT7Pu1Ip98hiFGbKJdzOlAKlpJMkVk=; b=lI07+NgjeixnKejTCGN4yfz476Z8JOB8vhKrZ9IOJuAO3SyDnD1ayu0fUPe9uE0Mfo VLgAYNMAGK3b7gocIg0uh2lIf5alvKdP9CS61t4T/UcVfOZkWzXS1nYLsUj9FqTO5E7P ri2rBFqO50eKqQ8ecwFwG+ViH3HPTGURIk8QPf72wCCew/o7F9cfv4kN82zmm0v9dcbQ tDvwKP1QvQrEGlxViSMONWPx3xliJ3qYIopTIV7+fdQpRIrGcByovFghlxLvKl7x9KDB bULJObPw8sYU1NCpWO4IN3G39hCCJwM/zCqcUu59EeC67qtJeYliQxsgmwbH+TAi+3dk eNIQ== X-Gm-Message-State: AJIora8jf1Pv15tE1MiMfIeEf/mImZyzGiMwx9AfCKdjPrvmuLK9H4PQ TqL0FxVge9YJfHLPZzXRkk6ie3RaySktQQwu4qIlb43gLJs= X-Received: by 2002:a17:907:c29:b0:704:fbb:1943 with SMTP id ga41-20020a1709070c2900b007040fbb1943mr1447349ejc.486.1655324905282; Wed, 15 Jun 2022 13:28:25 -0700 (PDT) MIME-Version: 1.0 References: <20220615003733.16447-1-zhouzhouyi@gmail.com> <20220615051521.GH1790663@paulmck-ThinkPad-P17-Gen-1> <20220615135220.GI1790663@paulmck-ThinkPad-P17-Gen-1> <20220615190936.GA713726@paulmck-ThinkPad-P17-Gen-1> In-Reply-To: <20220615190936.GA713726@paulmck-ThinkPad-P17-Gen-1> From: Zhouyi Zhou Date: Thu, 16 Jun 2022 04:28:14 +0800 Message-ID: Subject: Re: [PATCH linux-next] RFC: torture: add pr_flush to flush the results to console To: "Paul E. McKenney" Cc: john.ogness@linutronix.de, pmladek@suse.com, dave@stgolabs.net, Josh Triplett , linux-kernel , rcu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thank Paul and Petr for your efforts! On Thu, Jun 16, 2022 at 3:09 AM Paul E. McKenney wrote: > > On Wed, Jun 15, 2022 at 06:52:20AM -0700, Paul E. McKenney wrote: > > On Wed, Jun 15, 2022 at 08:36:54PM +0800, Zhouyi Zhou wrote: > > > On Wed, Jun 15, 2022 at 1:15 PM Paul E. McKenney wrote: > > > > > > > > On Wed, Jun 15, 2022 at 08:37:33AM +0800, zhouzhouyi@gmail.com wrote: > > > > > From: Zhouyi Zhou > > > > > > > > > > currently tools/testing/selftests/rcutorture/bin/torture.sh reports > > > > > false positve because of kthread printing. > > > > > > > > > > Commit "printk: add functions to prefer direct printing" (2bb2b7b57f812) > > > > > have added functions to prefer direct printing activated for the primary > > > > > import messages. > > > > > > > > > > Meanwhile adding printk_prefer_direct_enter/exit to > > > > > torture_cleanup_begin/end still can't eliminate the false positives > > > > > for a hundred percent. > > > > > > > > > > This patch add pr_flush to torture_cleanup_end because the latter > > > > > is sleepable. > > > > > > > > > > Reported-by: Zhouyi Zhou > > > > > Signed-off-by: Zhouyi Zhou > > > > > Tested-by: Zhouyi Zhou > > > > > > > > Just the one Signed-off-by suffices. ;-) > > > Thank Paul for your guidance ;-) > > > > > > > > > --- > > > > > kernel/torture.c | 1 + > > > > > 1 file changed, 1 insertion(+) > > > > > > > > > > diff --git a/kernel/torture.c b/kernel/torture.c > > > > > index 789aeb0e1159..b51e42463a67 100644 > > > > > --- a/kernel/torture.c > > > > > +++ b/kernel/torture.c > > > > > @@ -878,6 +878,7 @@ void torture_cleanup_end(void) > > > > > mutex_lock(&fullstop_mutex); > > > > > torture_type = NULL; > > > > > mutex_unlock(&fullstop_mutex); > > > > > + pr_flush(1000, true); > > > > > > > > But in this case, the kernel keeps on running, correct? So won't the > > > > output appear over time? All of printk()'s kthreads are still running > > > > after all. > > > I am doing research on linux-next following your guidance on my Dell > > > PowerEdge R720 server: > > > #git clone https://kernel.source.codeaurora.cn/pub/scm/linux/kernel/git/next/linux-next.git/ > > > #cd linux-next > > > #./tools/testing/selftests/rcutorture/bin/torture.sh > > > after about 14 hours, the test result show that there have been about > > > 17 failures, I examine the corresponding console.log, and find the > > > failures are caused by following reason: > > > before the message output by > > > rcu/lock/scf_torture_print_module_parms(cur_ops, "End of test: > > > SUCCESS") has reached serial console, torture_shutdown invoked > > > kernel_power_off(), > > > > Ah, got it! And good show tracking this down, by the way. > > > > Does this workaround commit on -rcu do the trick for you? > > > > 704ae8dcda84 ("torture: Flush printk() buffers before powering off") > > > > The printk() guys are looking at fixes within the printk() system > > as well: > > > > https://lore.kernel.org/all/87tu8pgcj0.fsf@jogness.linutronix.de/ > > https://lore.kernel.org/all/YqdSw%2FfJvnkRbjvc@alley/ > > And Petr has posted a more official fix, which I have queued on -rcu > for testing at branch pmladek.2022.06.15a. I am very happy to see the official fix, and start test it on my Dell server by invoking ./tools/testing/selftests/rcutorture/bin/torture.sh It will take 12 hours for the above script to finish if the other guy who shares the server with me doesn't use it heavily ;-) Thanks Sincerely yours Zhouyi > > Thanx, Paul > > > > so the message "End of test: SUCCESS" has not chance of reaching > > > console.log of host machine. > > > > > > Then I add printk_prefer_direct_enter/exit to > > > torture_cleanup_begin/end, again I invoke > > > #./tools/testing/selftests/rcutorture/bin/torture.sh > > > after about 14 hours, the test result show that there have been about > > > 5 failures, > > > > > > Then I add a debug statement after > > > rcu/lock/scf_torture_print_module_parms(cur_ops, "End of test: > > > SUCCESS") which sends the debug string ("hello world") to > > > uart_console_write directly, again I invoke > > > #./tools/testing/selftests/rcutorture/bin/torture.sh > > > There is "hello world" in console.log but no "End of test" strings. > > > > > > So I guess even with printk_prefer_direct_enter/exit to > > > torture_cleanup_begin/end, our main shutdown thread has failed in > > > competition for console lock (printk.c): > > > 2401 if (console_trylock_spinning()) > > > 2402 console_unlock(); > > > > > > Then I add pr_flush to torture_cleanup_end > > > #./tools/testing/selftests/rcutorture/bin/torture.sh > > > after 14 hours > > > all 49 tests are success > > > > > > > > Or do you have a use case that requires that the output appear sooner > > > > than it does? If so, please let me know what that is. > > > Thank Paul for your patience, > > > ./tools/testing/selftests/rcutorture/bin/torture.sh is the only tool > > > that I use. > > > > > > I am very interested in this topic, and very glad to do further > > > experiments under your guidance ;-) > > > > Or are you already running with that commit or one of those patches? > > They are working reliably for me (so far, anyway), but maybe more is > > needed in some cases. > > > > Thanx, Paul > > > > > Sincerely yours > > > Thanks > > > Zhouyi > > > > > > > > Thanx, Paul > > > > > > > > > } > > > > > EXPORT_SYMBOL_GPL(torture_cleanup_end); > > > > > > > > > > -- > > > > > 2.25.1 > > > > >