Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp477714iog; Wed, 15 Jun 2022 06:15:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v/8aJ0zKo7/zu1u69m2CXE8mBOUbPFlZF38n3dFXHQctS/24Jp8IgCa+SpFPTZ9boGzHEF X-Received: by 2002:a17:90b:20b:b0:1e3:290c:c2ad with SMTP id fy11-20020a17090b020b00b001e3290cc2admr10278812pjb.163.1655298943657; Wed, 15 Jun 2022 06:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655298943; cv=none; d=google.com; s=arc-20160816; b=y0Vlp3cUVOtA6C9r6j1kH2JCL/UFCgbZEUmlkrbvWF7yGIfTzkw2e109DQcGksMXDP H/40lEO4d26c3jF23iPoOE5DYCDDjBpjtt3F+qB7jC+4qKaAIrWVDv80l3uYexJb64IO skU1K+Rne8NIcsNd4lmDVphKuFymDo1VHiLGg0NHlSH2FMtIUeDobV4wDSRvaSaWvp1R MLKcMMvYzHqVe+l9droIOJMi1gbw1p+nOJ68aI8jU/sjAkdwipjfJOw9wnKCGNtwzAn6 RCqnuqB7eusXnpQqRqO+/IzAN8hKxk2pDuhZXDXXgfx66qq3bFghetGnDDwwq+kV6YlF cYCw== 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=U/WQo9UxHiAIQSpHuTEJOdPrvxBtqOsfkDuOHXT4fi8=; b=gilkWMae1lS7F/fV0YTnvwM4WE88rfGbf4vOHKD8yJcp1rOmxoByIE8NHsAzZBfOaB ppZjAJ1nggb5E/fMRzOUAeEQybQ0En20qvP6RPW0jQKnDWMyIv16kgte1jiKRR4tOOoS tv0nLB0OnyJ849OPVRiy56HWDV1ana/bwS3x4jEUszwZdoe+tbhtDedIz4Xq8G1u8Yw4 FJT2mfgNhlNohdo586q+TtLAL2thQErQ+x9QTvn/EdqxmcBaNG8forSS8Y//+oqKiHcY YaDos0hOQmNKqaqVaxQDO6w+7lPId7iA0y3puh9GEzbRzJB3JynF+h4+HvxYMKqlX+oz RhxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mynfaxJn; 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 b11-20020a170902d50b00b001582ce97029si18871841plg.122.2022.06.15.06.15.29; Wed, 15 Jun 2022 06:15:43 -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=mynfaxJn; 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 S1348785AbiFOMhM (ORCPT + 99 others); Wed, 15 Jun 2022 08:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244779AbiFOMhK (ORCPT ); Wed, 15 Jun 2022 08:37:10 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87ABB31383; Wed, 15 Jun 2022 05:37:09 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id m20so22907933ejj.10; Wed, 15 Jun 2022 05:37:09 -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=U/WQo9UxHiAIQSpHuTEJOdPrvxBtqOsfkDuOHXT4fi8=; b=mynfaxJn8Yi4N5AnFgJURBMSq6edLrV6kfdVtE/cTBvkdGR+1pymZMt5tGuslErUc2 fRWug5XbN8UZArtXaKxYC3oA4rAwvVN2XAfs/LE1iG9Rz3rIxQGoamNeSjojOF4IJnMR 6gktE1M0kPpQlCQDrshBcfIUd1PwGbANqs7GxEgEPq2m4lA9LdIQ65vRI4ZSsY3SUVIA 2NxU16tB//7HH+axMHn1ncxoepAmd6+Z4qnqqHgtn11LjRzJS9SRA95u28jWQCH2mJwk bo+dhvfMOTVGOfxr8jFs4NUIkWSsTVuKFjK4UNBkcI7RYBw3TDIZdzDNRxtc4HDzNY+g RK1g== 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=U/WQo9UxHiAIQSpHuTEJOdPrvxBtqOsfkDuOHXT4fi8=; b=RfQ3ZhwdmaDJS0fxFZWUxmr88hweV5VW9qbhgjrYnV6rb2Lk7gq1bfB8WcJ0Xt8abb z+obPJc1KPr4wBtj9gYTa3NveKrb4dxzoOzCFk6nhRQ/13arazg8L4Eipc71YGf2UUsm 8TZdF//1C1cP9Z/Zt8R4Mp4XTGDi/Fwb8Psdz97XBxCsZvZVGh3HIXjEARfdIn0M9ilD h202RYnBUTn/Yid+Ra1vnJ6/h36kCrBRg6JnapbIGLN6Y8pQi+/oISpJZF4bVPNGL7ts 7nm+DIv4aouU+v4vvHswn+XzAX0RM2HBm5j8R3lWXGZfJAIr7j3v2i6xavy2fBY/3FfJ knTA== X-Gm-Message-State: AJIora+0uIXTzBXEmSfb5vc4BV962AkmV+MjaHKlPxmTvHs3Yqval6BN lSLhOdkA9OzhWXEwsNXEnomSls1CAznQoiByC1k= X-Received: by 2002:a17:906:73d2:b0:716:14a4:43d with SMTP id n18-20020a17090673d200b0071614a4043dmr8559822ejl.434.1655296627996; Wed, 15 Jun 2022 05:37:07 -0700 (PDT) MIME-Version: 1.0 References: <20220615003733.16447-1-zhouzhouyi@gmail.com> <20220615051521.GH1790663@paulmck-ThinkPad-P17-Gen-1> In-Reply-To: <20220615051521.GH1790663@paulmck-ThinkPad-P17-Gen-1> From: Zhouyi Zhou Date: Wed, 15 Jun 2022 20:36:54 +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 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(), 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 ;-) Sincerely yours Thanks Zhouyi > > Thanx, Paul > > > } > > EXPORT_SYMBOL_GPL(torture_cleanup_end); > > > > -- > > 2.25.1 > >