Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2756685rwb; Wed, 30 Nov 2022 10:24:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7cIslFr6O9zFcm/iJdM7cxRlkvAW+4KsgPERuMq9ZeKUDothG4pPZffBpsht1QV9S/Pq+a X-Received: by 2002:a17:906:f895:b0:7bb:5d78:2c36 with SMTP id lg21-20020a170906f89500b007bb5d782c36mr26632067ejb.362.1669832690881; Wed, 30 Nov 2022 10:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669832690; cv=none; d=google.com; s=arc-20160816; b=a3cI23TmdhNWIQZXZ3JHIH+eBrlIgLgUzxcfPAXxKXbZRfYeA8Z5oItr5ckGcv2wB/ Mrhzz9fvL87M8QMEFNRLbMzXHJFea8XSxemFK+3ZAZxmMdXt/KsCXDDZMDUSArkvgiRU Qupj8kbRLdv9zOeBllZ0FoPfovt2/K7kbLajFo5sMsVlITmsYXH3yBky2b+NQVj9hqW/ 7Ee1Q/JrCyRjYMTOmMe3XaDAqQVq6V0sRkl1K1vT6XUcXdhvorG1u+K0uDnw+p2mMoJP WHxCJUClCBAi7FXdt1cdMK0O4OP3Y+gCyo9OOv8HAlWXRG/1fAIowTytclT1NXEihntM Nk4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zlPQLAGlmwY4o7JcXhwU2s+c287QM312H56RNlPzmj0=; b=oNPoEy1mbc5r6ReVK+rSK9nFtrKTqPBKjDDFukzQ2OfrjV3IJyi8TAtq5UJzxmW4av LeKtqxoY0c5T0x8MOyhwteLPG37Z96POVG3iC1jpQAQrvhKbHOfOj11fx7AzaEkTvC7F 5PFSZLoT67TOXqgK6vMQ+YtR9EqI1sCLACsN3XtkpZGRIrD4N8uT4L9qxiDNSeNY178c Yru82u+EwE4bsae/uNWGVVIxTQpMHQFzzeDDyfw0+10FlnAwNADUf2XB5hhutnN9iOYQ 9cpuIugkiW9NsjZaqdTLOa90Ueb2Xzr2RjRK3J971OuNmDTLPnGll1AIJF8Jt6RdYLD2 DLrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=hZFtK5YB; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a170906040c00b0073daf6b44a5si1559429eja.775.2022.11.30.10.24.28; Wed, 30 Nov 2022 10:24:50 -0800 (PST) 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=@suse.com header.s=susede1 header.b=hZFtK5YB; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbiK3SMi (ORCPT + 84 others); Wed, 30 Nov 2022 13:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbiK3SMf (ORCPT ); Wed, 30 Nov 2022 13:12:35 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90FADC79 for ; Wed, 30 Nov 2022 10:12:32 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 1E59C1F37C; Wed, 30 Nov 2022 18:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1669831951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zlPQLAGlmwY4o7JcXhwU2s+c287QM312H56RNlPzmj0=; b=hZFtK5YBVVvSh8SP9G3Khp+j+fBLRiAB3Th627uROetC/rhRSvvbIl5UlSZoxPqG6il/ya /Nu8ftgObh8FFL3MSKvNoKX0efnnpKKzVu1lYSXBaicHFDzrS1Ta9tML2VuYPEkI5/feE5 MuB1uIkikpTCCyktZCWkmk4IK+Twd3w= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C74FA2C14F; Wed, 30 Nov 2022 18:12:30 +0000 (UTC) Date: Wed, 30 Nov 2022 19:12:27 +0100 From: Petr Mladek To: kernel test robot Cc: John Ogness , oe-lkp@lists.linux.dev, lkp@intel.com, Thomas Gleixner , Linux Memory Management List , linux-kernel@vger.kernel.org Subject: Re: [linux-next:master] [printk] 8fc5f5fc7f: WARNING:at_kernel/printk/printk.c:#console_flush_all Message-ID: References: <202211302326.2915f85f-yujie.liu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202211302326.2915f85f-yujie.liu@intel.com> 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 On Thu 2022-12-01 00:57:06, kernel test robot wrote: > Greeting, > > FYI, we noticed WARNING:at_kernel/printk/printk.c:#console_flush_all due to commit (built with clang-14): > > commit: 8fc5f5fc7f52a733fcc8b3939d172b9248e63871 ("printk: introduce console_list_lock") > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master > > in testcase: boot > > on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G > > caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace): > > > [ 0.000000][ T0] ------------[ cut here ]------------ > [ 0.000000][ T0] WARNING: CPU: 0 PID: 0 at kernel/printk/printk.c:116 console_flush_all (printk.c:?) When I checked out the commit 8fc5f5fc7f52a733fcc8b3939d172b9248e63871 ("printk: introduce console_list_lock") then kernel/printk/printk.c:116 is: 114 void lockdep_assert_console_list_lock_held(void) 115 { 116 lockdep_assert_held(&console_mutex); 117 } 118 EXPORT_SYMBOL(lockdep_assert_console_list_lock_held); It is used in #define for_each_console(con) \ lockdep_assert_console_list_lock_held(); \ hlist_for_each_entry(con, &console_list, node) that is used in static bool console_flush_all(bool do_cond_resched, u64 *next_seq, bool *handover) { [...] for_each_console(con) { that is called without console_list_lock(). Hmm, we could not take console_list_lock() here. It would violate lock ordering. console_flush_all() is called under console_lock(). And console_list_lock() is taken outside of console_lock() in register_console(). Fortunately, we do not have to do it. for_each_console() is still safe under console_lock() at this stage. And later patches will switch it to for_each_console_srcu() that will not require console_list_lock(). So, the solution is to remove the assert in for_each_console() in the commit 8fc5f5fc7f52a733fcc8b3939d172b9248e63871 ("printk: introduce console_list_lock"). We need to add the assert later when removing the console_lock() synchronization of @console_list in register_console(). Best Regards, Petr