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 50827C77B73 for ; Wed, 19 Apr 2023 13:48:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82DCA900003; Wed, 19 Apr 2023 09:47:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DF1D900002; Wed, 19 Apr 2023 09:47:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AF46900003; Wed, 19 Apr 2023 09:47:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5B49B900002 for ; Wed, 19 Apr 2023 09:47:59 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2A9C7A027A for ; Wed, 19 Apr 2023 13:47:59 +0000 (UTC) X-FDA: 80698269078.13.5481401 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 76338140018 for ; Wed, 19 Apr 2023 13:47:57 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=RlKCya9H; dkim=pass header.d=linutronix.de header.s=2020e header.b=S4Gey5r+; spf=pass (imf09.hostedemail.com: domain of john.ogness@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=john.ogness@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681912077; 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=2W7cHF0CcQVLza/dOUxMzsRdhC8wDgpB3UnYTaoj0vs=; b=IA/IdAyrgBFM5cal+PqVMtujQh0GIA5wOoMAY4/ugCklcaSJ5yyzsOzSvlMOMFFINhwhUd EBPwtROfSFBA6Hb3KHklhP5oSYE2nDTMBkoeiviQqLuKBPVWYtxFzy6jnUFYRUBjC9AogQ 1HHCrPgAmf+xDPy5jQGpiYEwyE+7pr0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=RlKCya9H; dkim=pass header.d=linutronix.de header.s=2020e header.b=S4Gey5r+; spf=pass (imf09.hostedemail.com: domain of john.ogness@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=john.ogness@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681912077; a=rsa-sha256; cv=none; b=QpHpWpULOp/wWmdH1qslUt5LmNJDCBNZsSqASWs3bzIpselqZjimPHskdLhRDL1xkCNcCr 5e8t3e9YEh9aPZs1viA2+IdCeG7SJ/MUBtHzov4Undh7HrlVzLEst2bFfHUUrjLl5wyvg/ 6rtHLWGS1GGKqiv+7C9h1396M4gTfQI= From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681912075; h=from:from:reply-to:subject:subject: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=2W7cHF0CcQVLza/dOUxMzsRdhC8wDgpB3UnYTaoj0vs=; b=RlKCya9H4v6vfKb4ZlndgGiZ6y4i7HdLu76HXvUl/ZK4Gf15RKzQvxcO2GzJb34GOj4kh0 YAoNMgyipj36kVv5+WgrR9WBihM2SHd8Qca5Mbtk3MhLFwkkTcAnyL1/A8ET+chnYkMrgI X2qdNp7NDjwHEc2YytyIiW5puHnEDYIHEWai84FhWvnGEMpu1ZHMUCrSgn4cxnlYx0vVUy D26pT5RMgNX8iZFofod51y/kKfi7OFIJOTeqN8pHW616TdfG57UNFYhfr2aOupcUn1iIop nS0lg7Qnf8x2L/clpniNiMCI5OkM2OuVniSpvEQCKToQONuoBNgg28kP2JBt5g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681912075; h=from:from:reply-to:subject:subject: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=2W7cHF0CcQVLza/dOUxMzsRdhC8wDgpB3UnYTaoj0vs=; b=S4Gey5r+1JkeRHNygoE3P0PENGILKoD31pw52OQPTkzuvzjuURP5x0GZUB7AWF4s5LrQyX v2KXGiMiWWZGcLAw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] printk: Enough to disable preemption in printk deferred context In-Reply-To: References: <20230419074210.17646-1-pmladek@suse.com> <87r0sg5jin.fsf@jogness.linutronix.de> Date: Wed, 19 Apr 2023 15:51:56 +0206 Message-ID: <87edog56jv.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 76338140018 X-Stat-Signature: hh8hajkphrtpfqo8gjmsym4rjziqxqyf X-HE-Tag: 1681912077-222644 X-HE-Meta: U2FsdGVkX18KTYlIBtfisGVaVue/ihBVAxriKgMlbnFCQKdtvwygZR23i4Legmouxt9c+YVj10c4dlI9+nw8qDEE7ldJVkeKZpsIXAunELTaGDPPN5ZL7OJMuyZYJ9SEYYZXZXaZcpINGOwvPXXl+iWrwV6khCN/9zUEKx7nR479sMUebzNZRDcCsR6GskTN20htp2VKVa3uWt7XuVRiZ0ovZGmQHP6Jnmv4hIGeZG8uGe8YvHnCGa9R+tUG2BoOeCqm0k2s2JkroR6w2r4p7EfcF8FYvgGoocutENArqJJlQLh4TkcW29ysAg8oXh8+z6ky/AvtSj7uKtyMS04oZscnveCd+eEL+nCodmzw3tUlLkbHrw84iKoRZP4T237by71vkIyTM+5/fXMYa9KA3BrJeyU1C0ajfu/3VxlNUPy6GBZ6x7OIdooIZ9nsAiFguJ6STZQt50dMLeUqxA9kSiqYbaKfCHJxsn544pAymfOSb6qMmbvNZehEuVnSUgCHiHFXnHbuu6URlMhUdKQJPSM0H/QyYv1cxqvh3vY6yJaebfKVninj/2pOwU8ApxFiCfwsqIL5MMFuIH4Xia5rXs5jZ+SeIFpjijWPb1rkAoeZXA8Uof6j5SBah+DW7/e2EjnfTDYw5qP0xNWCCQlUDhC9bfIOKDa6bS96Fbv0SQoOpkfKIc0pakWwiFFg0hVIAZG1Kh71PfSOGIOOC3lLEKI5Anpqa9wAhiN1CACGCm7hz45kMBePlOrryhZMVAOtgrDQ2vmY7o+6ByV7iIvIl06VBnRGjhFNLqiLqcfMYBJyGWtW0kRQDwCiaSQTSAjXKqJZ7fbGdM24nbeldlyarNuhAGyG8V3KIh0cK4PIPQmJqbyTQGKMNLLE1A2+brRrZJituRoS/Vgt2lrLidnneSnYCqvW+pM4vQIoVKkI8i++AdrIjKA5EJd8HY4FZl9PSKDVXcc/RTAYoUC+l8o aICURi/v fjBazdXkWu5+2ePt+fWyPIySA63iFcuOIHItM6RzuCFGWEQnvaz662x6ISO0Wk0wCUdKswFjkP2G7dNjeyfCBgrjC8xSq+vYe4YiuHp8cV3hoXcV2I2l7hUjykpulIoFP7M6r 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 2023-04-19, Petr Mladek wrote: > A solution would be to make this more clear in the comment. > Something like: > > /* > * The printk_deferred_enter/exit macros are available only as a hack. > * They define a per-CPU context where all printk console printing > * is deferred because it might cause a deadlock otherwise. > * > * The API user is responsible for calling the corresponding enter/exit > * pair on the same CPU. It is highly recommended to use them only in > * a context with interrupts disabled. Otherwise, other unrelated > * printk() calls might be deferred when they interrupt/preempt > * the deferred code section. > */ I an happy with this comment. I saw Michal's follow-up suggestion, but would prefer this one. It is a more technical desciption of the issue and clearly recommends that the user should disable interrupts. If you use this comment: Reviewed-by: John Ogness > Another solution would be to stay on the "safe" side and keep the > comment as is or even enforce disabling interrupts by the API. > > I would personally just improve the comment. It is good to describe > the situation correctly. We could always add restrictions when > there are problems in practice. Agreed. John