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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3047DC77B73 for ; Wed, 19 Apr 2023 13:48:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbjDSNsD (ORCPT ); Wed, 19 Apr 2023 09:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232696AbjDSNsA (ORCPT ); Wed, 19 Apr 2023 09:48:00 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF9B51563E for ; Wed, 19 Apr 2023 06:47:56 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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