Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1355062rwp; Thu, 13 Jul 2023 09:35:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjqCo1W+9EW2n7bUpI7DF2i9GlJ7BpPFFo1+6/zxZlB8grnGQMS6VpH0Ran3NrrLrL2xEb X-Received: by 2002:a17:90a:ab01:b0:261:632:976d with SMTP id m1-20020a17090aab0100b002610632976dmr1214436pjq.27.1689266104164; Thu, 13 Jul 2023 09:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689266104; cv=none; d=google.com; s=arc-20160816; b=ePU1ezcVxpCZ4/Fyo3egJIAM2tn36+5VhJfeFEkyoNEp1c/mFKN2NItWVvwVW28jHR mrakFC51MvUKGH7YNsiZAMTvGCzBp89tmEcODSvzT3iFc3fVQ0Q5LXWfbSt1wcYjDpMI Oe6Ut/k8DkaczV7M9rR1N142KD1z5VNrJ2ZJ3qMScrqm3M2AxrJnKiY5W1FC7HBZ1xMA zXFyvpNiA9/NVbAQuasVJgsKXFrbjoTE07UxxzeePfjtZsr/fsymOnQWGVaUH8aYTYUB ouFJfo2/tO7J0TDWDXU4hmhdToKRqGTuqppTpjiQLVPrJK3k1SjVsZ4WHjpQxNFx2ZnT +5BA== 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=vieFlGRJliA/zMR7IuToxQRSElESzoAG4oj4phb1Az4=; fh=ls8ltNtDhnoM3BvuddfC4PilBKET911nME6qbqrUGBk=; b=s+kMkchZLQG6oP4o6WLtwFjokVIlzOoPfJAdyQTWFJy/6QwXMG7gZRX8C1rrIRWjU2 hxf6cnCYWzBYzoyHI2A76fF8asBEdM09/K+DIFLKO5mCFi00uhxKWzz1s0jkoKc8zDn5 +nHzBNZCwQ3sYXimete5REYBnnFxCbtIDNvK9ZGOhM9mdbCyejYv3jQJng/wnbwplSPO MCmxVbcVM/bmrji4dRRndilmXAwGmIjAyfujBo6D25+GD4/kKgfnBd4S958WFokZFDsW JWjXVLl/nvMH45qh6dG/N5PiUTDl+lWeQJ89Is8L4U3Gx7+ekqJZ4V5zPikeSDjZh6b3 O0iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=idBen+g6; 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 l193-20020a6391ca000000b0055ac5d0fc79si1848890pge.648.2023.07.13.09.34.51; Thu, 13 Jul 2023 09:35:04 -0700 (PDT) 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=idBen+g6; 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 S235116AbjGMPxS (ORCPT + 99 others); Thu, 13 Jul 2023 11:53:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233575AbjGMPxR (ORCPT ); Thu, 13 Jul 2023 11:53:17 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07D222702 for ; Thu, 13 Jul 2023 08:53:14 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A85C62215A; Thu, 13 Jul 2023 15:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1689263593; 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=vieFlGRJliA/zMR7IuToxQRSElESzoAG4oj4phb1Az4=; b=idBen+g6Wvpuk6gU38PxDBkNI/jWfDLwn5Rq6+IqopFT4QmodBetRYPDzVHV7D2sSS+oD8 4HtRyiuaMqLNejSLPXxVtQAKJMOkddJ7JUZy/wRxv+fHJe8ZHGPWIY9z7Pxb0De2UJbu8d jDmMQVmexf/GDq69GwTL8lodZY4v8s0= Received: from suse.cz (pmladek.udp.ovpn2.prg.suse.de [10.100.201.202]) (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 4E6382C146; Thu, 13 Jul 2023 15:53:13 +0000 (UTC) Date: Thu, 13 Jul 2023 17:53:09 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH printk v2 4/5] printk: Add per-console suspended state Message-ID: References: <20230710134524.25232-1-john.ogness@linutronix.de> <20230710134524.25232-5-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230710134524.25232-5-john.ogness@linutronix.de> 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,T_SCC_BODY_TEXT_LINE 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 Mon 2023-07-10 15:51:23, John Ogness wrote: > Currently the global @console_suspended is used to determine if > consoles are in a suspended state. Its primary purpose is to allow > usage of the console_lock when suspended without causing console > printing. It is synchronized by the console_lock. > > Rather than relying on the console_lock to determine suspended > state, make it an official per-console state that is set within > console->flags. This allows the state to be queried via SRCU. > > Remove @console_suspended. Console printing will still be avoided > when suspended because console_is_usable() returns false when > the new suspended flag is set for that console. > > Signed-off-by: John Ogness Looks good to me: Reviewed-by: Petr Mladek I have double checked the history. suspend_console() was added into v2.6.18-rc1 by the commit ("Add support for suspending and resuming the whole console subsystem"). The above commit added "secondary_console_sem". It was taken by acquire_console_sem() instead of the normal "console_sem" when "console_suspended" was set. It means that the normal "console_sem" really was not taken. The "secondary_console_sem" was removed in v2.6.29-rc6 by the commit ("PM: Fix suspend_console and resume_console to use only one semaphore"). It solved races between code taking "console_sem" and code "secondary_console_sem". This commit kept the handling of "console_locked". It was not set when console_suspended was set even though "console_sem" was actually taken. IMHO, it was a bug in the commit removing "secondary_console_sem". But it probably never caused any issues. Anyway, this patch makes "console_locked" handling sane. And if some tty code relies on the insane logic then it should get fixed. Best Regards, Petr