From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCA66C433FE for ; Wed, 30 Nov 2022 18:12:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D292E6B0072; Wed, 30 Nov 2022 13:12:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CB2336B0073; Wed, 30 Nov 2022 13:12:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7A436B0074; Wed, 30 Nov 2022 13:12:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A460D6B0072 for ; Wed, 30 Nov 2022 13:12:33 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 734A1C0412 for ; Wed, 30 Nov 2022 18:12:33 +0000 (UTC) X-FDA: 80190903786.09.64A3F48 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf27.hostedemail.com (Postfix) with ESMTP id BA9EA40009 for ; Wed, 30 Nov 2022 18:12:32 +0000 (UTC) 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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669831953; a=rsa-sha256; cv=none; b=tnSU4Wk6ZsRhcidJR+h4rMMpJwor3pQV87oqs2Tll801ck0niMAnflDWPMSDpojTluPd1N bPNzCsbQZYmFv0HaqeqIIbjz+fz07H5obVSDXjbsXFwnGdcXsO2SgcJaij0oplbgidEQRO dTtn73ZHG1IlLwSYUExURgEz7jPG2tM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=hZFtK5YB; spf=pass (imf27.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669831953; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zlPQLAGlmwY4o7JcXhwU2s+c287QM312H56RNlPzmj0=; b=0Z9x3cJF6DuLIvU24s/agw6iFMAeyYsyUtWOCDh4fCQQODGN8xSLlgWQjfvucxPnFLtIMs 7Br00dpNQONMBKYLX41XUzlrU1gVro9AzgxmlR3XDPHW12mpDbZLHciHT4tytYKS8mcUY8 hoKWhVlf1F3F8E+IB9pFreaieYjw3bI= X-Stat-Signature: jb13dgbhnwzbybp875zb9df11f39ga59 X-Rspamd-Queue-Id: BA9EA40009 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=hZFtK5YB; spf=pass (imf27.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam05 X-HE-Tag: 1669831952-29800 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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