Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp228168rdb; Fri, 6 Oct 2023 01:22:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMZYic8blAVAD1Z/Sw5nG/hDE2FOmYmkhcErThnvULClrEdiFptVcU08J6fgg8/Qvr4TlM X-Received: by 2002:a05:6a21:789c:b0:15c:b7ba:e8e0 with SMTP id bf28-20020a056a21789c00b0015cb7bae8e0mr8417996pzc.51.1696580548892; Fri, 06 Oct 2023 01:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696580548; cv=none; d=google.com; s=arc-20160816; b=t79X8w1M99wZt4+tqKvuSSxvGPrm2AS5hG1KgPixhVfKoohC4uOK/98tkToaOFVdZs /mh4OWOlsrBwH3WkWHQXt4s44sN7SBDZyde5uyISx3qbOMcJfugkcQpKfsRWwe2argu0 g1IcscEzPp6zBf3+4FDsSVFjqDJffyBUDQduGPjxkaL45qwhG7PiHQypRqrizTlNQ04y i5YqgmLUySUJUc4RyS2tefPhXy91md8LfmFc3ZC21HcsYOkx7EJe2Dmndu9eBW4qql31 eJJnpiVp2KHdUc9Gt4pLNSqTAG8AvFy032IG5hWLPd/OdCBOtLredEvKooYAkv1QKn2O vUtA== 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:date:subject:cc:to:from :dkim-signature; bh=u6SBGQGzlYESoIH6xOm7vdZvHrnG75JguFK7bNCgoCE=; fh=Rkem9DZLVtB3ZM00Hf1TNke3sV6aftsNytr1Ms93Wzw=; b=OQ4Z+sbaqpqIJYniys/JuKGwN09Wk4FekpicjTenj8tOW8fszt430Q4twlM2vKfdPH eWkQO7Rrfad6/p9KUXKjXeGU1XmzN8F7ydslx/5Nd9cJrClGrbwHGXzykY3zYJRElCez KZxi1f+QV9dRZd5Ny1L9gCdhlI/GboFY771wrC44/aK/MsVrX4PNt0ijOkl+FJb8dqbT fAgpTS12PZcagnmTr9z/cBJLAO8XBB7TlYLfJf7zJ+AMKNo3oU6NgqBXG6O1xY5lBwpG JhUt4DIPf6roErqw90U8njz3NXei3ofctohG4rwXDzwHwT6TXP87uK0wzzLPdBHNYYi2 lFkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=KdQ4PKYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 76-20020a63004f000000b005859aa3da1esi3300964pga.492.2023.10.06.01.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 01:22:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=KdQ4PKYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0FC2082E53F1; Fri, 6 Oct 2023 01:22:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230492AbjJFIWY (ORCPT + 99 others); Fri, 6 Oct 2023 04:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjJFIWU (ORCPT ); Fri, 6 Oct 2023 04:22:20 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17CA8E9 for ; Fri, 6 Oct 2023 01:22:19 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id BDF481F45F; Fri, 6 Oct 2023 08:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1696580537; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u6SBGQGzlYESoIH6xOm7vdZvHrnG75JguFK7bNCgoCE=; b=KdQ4PKYaOyDahDV/SMQI7xizMeFE7j1Wku2izmCQSu9FjD7VG6TcP3EvnN4oXvtBYxb//s FdCA3LXgujZ43Mt/5/Tv4RFlu9DypqY+Sorgq2cc9B8X8O1DEhDz5Cy1I7uQLsHZhTODbw xkx9hEfyCzLi3XBNB5ABfjvKx55e4Is= Received: from alley.nue2.suse.org (pmladek.udp.ovpn1.nue.suse.de [10.163.31.190]) by relay2.suse.de (Postfix) with ESMTP id 6993D2C142; Fri, 6 Oct 2023 08:22:17 +0000 (UTC) From: Petr Mladek To: John Ogness , Sergey Senozhatsky , Steven Rostedt Cc: Thomas Gleixner , Todd Brandt , linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH v2 1/2] printk: flush consoles before checking progress Date: Fri, 6 Oct 2023 10:21:50 +0200 Message-Id: <20231006082151.6969-2-pmladek@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231006082151.6969-1-pmladek@suse.com> References: <20231006082151.6969-1-pmladek@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 01:22:28 -0700 (PDT) From: John Ogness Commit 9e70a5e109a4 ("printk: Add per-console suspended state") removed console lock usage during resume and replaced it with the clearly defined console_list_lock and srcu mechanisms. However, the console lock usage had an important side-effect of flushing the consoles. After its removal, consoles were no longer flushed before checking their progress. Add the console_lock/console_unlock dance to the beginning of __pr_flush() to actually flush the consoles before checking their progress. Also add comments to clarify this additional usage of the console lock. Note that console_unlock() does not guarantee flushing all messages since the commit dbdda842fe96f89 ("printk: Add console owner and waiter logic to load balance console writes"). Reported-by: Todd Brandt Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217955 Fixes: 9e70a5e109a4 ("printk: Add per-console suspended state") Co-developed-by: Petr Mladek Signed-off-by: Petr Mladek Signed-off-by: John Ogness --- kernel/printk/printk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 7e0b4dd02398..0b3af1529778 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -3740,12 +3740,18 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre seq = prb_next_seq(prb); + /* Flush the consoles so that records up to @seq are printed. */ + console_lock(); + console_unlock(); + for (;;) { diff = 0; /* * Hold the console_lock to guarantee safe access to - * console->seq. + * console->seq. Releasing console_lock flushes more + * records in case @seq is still not printed on all + * usable consoles. */ console_lock(); -- 2.35.3