From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4BF92FFF89 for ; Tue, 23 Jun 2026 15:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782229761; cv=none; b=AcudheG9k9c5CJrCg0f5J0Fe726oIbCb4w+b8tKoSkE2xvsc7WzzZS22RcfXep56gFA4dpbbGLNUfzMupMQivtcw60fg0cd2UllhOzhWB00sp7qBVIi+CU//0Fykz8o8SFeBLmeEF+GloHDxyKHyQ7RC7NufGSqnJnfnCu3UZKw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782229761; c=relaxed/simple; bh=g9OjuwiWr9vNABcvV89aTygb82dl7YZP7O2hr7eKPA4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gNmsof32e9f1VnuQWnNtJmYQS+Wqe8c3VJwnD6tt9xDtlBo7VpWu98fCFq7hw5h/QnrgSbEDumRH4N+JF/MuA2S/GpgoGRO0e08K5HcCfBqSiM+6D/2kULWtrzNWPXtsERGR9+xs/U9ajKoMIxzLrVA3rHXEf0qOih/co88PG9w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=WToBBs/c; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="WToBBs/c" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49241896317so190505e9.3 for ; Tue, 23 Jun 2026 08:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782229757; x=1782834557; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nEBncOkZvwmf0mpGBSEvmRcxysNfgxHVM0De27/H3fk=; b=WToBBs/c481BBnRlI6zyEPk0kQ3GKh0VamraAzOyB0K8zhHa3/SEFf7YCy1hi2j2wz ufJzLTbx0HSi+LDZnpvu8s7MYO0mQUG8FmZONXY2af8LD8fLcbzFaMwbsBKZheMWrJsZ qGucYVf7mNAYF/VwfLHL93sMzOWEGeNzbQ3cGEXIZpfcdQrKPwj4JJUjdma3z2tzAr92 gJQonpEpgsEMf44ADuP4Ne+QkFiZ6Wdtc1OjfPXVyO3V0c2sWnqY4mU38dQHYhTfpY+C FvK8qvA2i5YdSBB7g6hU0YiN/77M113ArQz1gyYl5DAzolwR5c4ZXuW8oIM+rOJayHNE V1Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782229757; x=1782834557; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nEBncOkZvwmf0mpGBSEvmRcxysNfgxHVM0De27/H3fk=; b=i8Wa02hzs5fd/A6fpaN4r3Ll/S2aQ3aHVZgIB8HR3qkJF9ZcZg7TCeYWG69FSz7gya nQWHzybERbV1lnvEVnxgqNPO1mnkDQkcQS21pjqCTTFOlsaYtfnXWiPNEth2pFBRia9e plpMT9/IfqFPS6MrE714HAqN4ZkZavLY250rYeoxqKPhoiHjP8WnsCBeHA5z01JT6EKn L1fd2dryneJsugXUxX+GQVAahfw66uEGX7mHey+1CO+v9APXmD5WykJDWkEQFS2QJZWs VThFEkkOQgiU02/l2InDdFPhRgwzRJwDidZQD0DBSEp0Z+28+8X0qvI0fbpeenEKqmQZ SitA== X-Forwarded-Encrypted: i=1; AFNElJ/AI1/w3vN6AYrE+5LLfMB07mzjW/P2sz2Aka+N0wa3UktiPqBR1YY+0pNN5HD4Ae12DMHXBakUSDj2HTk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4hOWmZTbAjXyIEY1KT0Q37AiW5l4jZtSgmDyjZmEzwxH+/dgT 8xlyNrrT4MY927Zb8Vit9t4VrUj6fX3GvNG72t06jsyt68pMMLbXfgcOOnvv2VtRBlQ= X-Gm-Gg: AfdE7clagHKpXrcH/hEfUX8sSjU+y2f5vU1vLlOWWEzOFTuJGolCi9d/evbq8/P5pHJ tys7Z2PR2p8KlxFuW4XXTtkiaEnsiPKuExZ0YOxEml2M43xzR0D9HIffYonoblHKw8DqaG1B85a 9Am2SaoDA/F7U3euv1obaEjGa8eKVptSywEUHmQ3jRNPQy0unHHCEyI3CYuN9OFPqRG02vRzqyx dHu6twKgBvtGPgwAo6ikFyiuyBjTaGifNCs3Q6+ecDnq/n+sWIGaByr3tuR644koaKz8qpvXQni b4AQmhkYCBY6/U8YCRU7mXKGF9aiIg2EJb9uPhVvTO+7fzjORY31rFJfwz8EJKpbu1KFm5PkRJl 35lJCFRsAcCZfJ0x3PAN7OpnXJ0h6qYnpMbAXovtY/PgQEWke+nYByD7y89Dvuuln9y/LVYQzKt P4lyDfXeA8EhDGqBNtEWhe0ScVZw== X-Received: by 2002:a05:600c:3495:b0:490:e196:e8df with SMTP id 5b1f17b1804b1-4925b3aa15bmr52076835e9.23.1782229757310; Tue, 23 Jun 2026 08:49:17 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4924923914fsm313673405e9.6.2026.06.23.08.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2026 08:49:16 -0700 (PDT) Date: Tue, 23 Jun 2026 17:49:14 +0200 From: Petr Mladek To: Andrew Morton Cc: Sebastian Andrzej Siewior , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, sched-ext@lists.linux.dev, netdev@vger.kernel.org, "David S . Miller" , Andrea Righi , Arnd Bergmann , Ben Segall , Breno Leitao , Changwoo Min , David Vernet , Dietmar Eggemann , Eric Dumazet , Ingo Molnar , Jakub Kicinski , John Ogness , Juri Lelli , K Prateek Nayak , Paolo Abeni , Peter Zijlstra , Sergey Senozhatsky , Simon Horman , Steven Rostedt , Tejun Heo , Vincent Guittot , Vlad Poenaru Subject: Re: [PATCH 1/2] bug: Provide WARN_ON.*DEFERRED() macros for console deferred output Message-ID: References: <20260623142650.265721-1-bigeasy@linutronix.de> <20260623142650.265721-2-bigeasy@linutronix.de> <20260623081258.580e034fdb5b98f4f8dba44a@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260623081258.580e034fdb5b98f4f8dba44a@linux-foundation.org> On Tue 2026-06-23 08:12:58, Andrew Morton wrote: > On Tue, 23 Jun 2026 16:26:49 +0200 Sebastian Andrzej Siewior wrote: > > > Provide a deferred version of the WARN_ON() macro. It will delay > > flushing the console until a later context. It is needed in a context > > where the caller holds locks which can lead to a deadlock content is > > flushed to the console driver. > > An example would from a warning from within the scheduler resulting in a > > wake-up of a task. > > > > Deferring the output works by using printk_deferred_enter/ exit() around > > the printing output. This must be used in a context where the task can't > > migrate to another CPU. This should be the case usually, since the > > scheduler would acquire the rq lock whith disabled interrupts, but to be > > safe preemption is disabled to guarantee this. > > > > In order not to bloat the code on architectures which provide an > > optimized __WARN_FLAGS() define BUGFLAG_DEFERRED which is handled by > > __report_bug() and does not increase the code size. > > > > Provide the DEFERRED macros based on __WARN_FLAGS and __WARN_FLAGS > > macros. Extend __report_bug() to handle the deferred case. > > > > ... > > > > --- a/include/asm-generic/bug.h > > +++ b/include/asm-generic/bug.h > > @@ -229,7 +230,10 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga > > */ > > bug->flags |= BUGFLAG_DONE; > > } > > - > > + if (deferred) { > > + preempt_disable_notrace(); > > + printk_deferred_enter(); > > + } > > For some reason the comment over printk_deferred_enter() says > "Interrupts must be disabled for the deferred duration". Is that the > case for all the printk_deferred_enter() calls which this patch adds? Strictly speaking, "only" CPU migration must be disabled around printk_deferred_enter()/exit() call because the state is stored in a per-CPU variable. It means that preempt_disable() would work. I do not recall whether we mentioned interrupts by mistake or on purpose. It is possible that we suggested to disable interrupts because we did not want to deffer messages from unrelated (interrupt) context. Best Regards, Petr