Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5726327imw; Wed, 20 Jul 2022 11:11:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uFA7+U4bIGJCqE4uoPNVno3pKPkSQ91/dJxp7nhp4OeeON1AUkvib6PQ7BSu4J85QKiBvv X-Received: by 2002:a4a:b401:0:b0:35e:de93:43a9 with SMTP id y1-20020a4ab401000000b0035ede9343a9mr13854569oon.80.1658340695837; Wed, 20 Jul 2022 11:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658340695; cv=none; d=google.com; s=arc-20160816; b=v28sG399yWw7vIhifSU9gv/eCOjeZG7Otioi17dLW9g9jFQJZheIh46ws+n1g4tsLT X1j3nCl39Fg5AVRLpWwX8ScS0+dAiOb6Jsu0WpcSZRdh3Bt9Mo138LIcnjedFRL5QFFp PzpUy2tAymoyQ6uCLExolYBsonUgI3pRqNceUKlXlVLcPfSdzZD2UlR69A9cFgEDA00w MBaYyNF5cYUZ2OH9/XqcyW5C4ujuEgV4ellqum1ZbkR/BYMvuKgRVkfgUShguYcGYGJz GdBqHfdZVQ6ISuClm6abdbO0FC7b+Yv9Tv82qsGT6q1Kz/zTl/GCeDJMzr0uQQKErPdJ sDKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=VUm5aTaIdNRBFOr1j7UUNjxF47G/uhDPjNYTrsInFNw=; b=UXwVmGa7oj99JrnzNBSioyBzyEMt3JLsB3cIAeVCDe3fIZQBHzGAxzhVDGS1UTfh2B /SjnAIILjCEQWnrSsIgdADLRKQ2Jh4clTBsC04AYqtgmvBq5oTOlqFE2iOWWwncgPBCm dTLYrUcMZRxqj6ILvnoPZWONawGVQWcaLAc/WaTCG0r+CYA3j0DQW3GNvM6YDkUQeXuK 7gXmNehX00fQ7L3N2hDXneKuUnnelv6PcXTrqGqD+uBj60JMuJ078rrS3nEXHI0A/wBN naJUbuY9mIE1qGD/3vcIyu45zPC18YsO0xjuoRHtFUFj+GzYb9ELQY8t00WSb3eWO4Q8 27DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nQ17EscH; dkim=neutral (no key) header.i=@linutronix.de header.b=sAUa8E5P; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e32-20020a9d2aa3000000b0060c27481d88si14063660otb.277.2022.07.20.11.11.22; Wed, 20 Jul 2022 11:11:35 -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=@linutronix.de header.s=2020 header.b=nQ17EscH; dkim=neutral (no key) header.i=@linutronix.de header.b=sAUa8E5P; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbiGTRuG (ORCPT + 99 others); Wed, 20 Jul 2022 13:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231373AbiGTRuF (ORCPT ); Wed, 20 Jul 2022 13:50:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C201E52DF8 for ; Wed, 20 Jul 2022 10:50:03 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1658339402; 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=VUm5aTaIdNRBFOr1j7UUNjxF47G/uhDPjNYTrsInFNw=; b=nQ17EscHCyVIWoLBhCVLmzNsEzx0F9kZrsxMtUKmiG+iPfy+zfdsj57v+9s1iMs0fDlQUv PrsS8Kx/Opg5TS56YM+7MsZf+H6aVt2kIn/AnDUpVTaWjUgbfiC98T2KdOJy9Oz6saPuqD Oj0hCwKpL3vMpxUp/qns3T+l34jFVOpHq7PWdRptk0Tci5iG6dxOe9p9kfYY86vM1rW50/ CZBvPxa6sPl0BDO2QRsSo76QxSak4JU8iEvjyX0IKS1yalPBMtdmSnTmEbtb+4RXH8kwrM SGlLVoqkQFhkZ+drBafU/ocz2qVmR0j0sfEgHf7t5eyTa8bhZNgg5MYVjrhueA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1658339402; 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=VUm5aTaIdNRBFOr1j7UUNjxF47G/uhDPjNYTrsInFNw=; b=sAUa8E5PDV1adgTLlIG83vSbdrGTNzf+WZlhXM6jrP8Ls+Q04JRXAkJ9WVn4Our+XNnygA 2O+7a2hpuvbOuUBg== To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner Subject: Re: [PATCH] printk: Skip console drivers on PREEMPT_RT. In-Reply-To: References: <87y1wn3g3g.fsf@jogness.linutronix.de> Date: Wed, 20 Jul 2022 19:56:01 +0206 Message-ID: <87ilnrn06u.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 2022-07-20, Sebastian Andrzej Siewior wrote: >> > --- a/kernel/printk/printk.c >> > +++ b/kernel/printk/printk.c >> > @@ -2843,6 +2843,16 @@ void console_unlock(void) >> > } >> > >> > /* >> > + * On PREEMPT_RT it is not possible to invoke console drivers with >> > + * disabled interrupts and or preemption. Therefore all drivers are >> > + * skipped and the output can be retrieved from the buffer. >> > + */ >> > + if (IS_ENABLED(CONFIG_PREEMPT_RT)) { >> > + up_console_sem(); >> >> This should be: >> >> __console_unlock(); > > Why? Because that is the official function that performs the console unlocking. With upcoming patches, that function does more. But even without those patches, by directly calling up_console_sem() you are leaving @console_locked set. The @console_locked variable is used by the vt code to validate correct console locking. I realize you are just copy/pasting from the condition above (checking @console_suspended), but that condition is special. When consoles are suspended, we still allow @console_sem to be locked/unlocked, but without changing the locked status of the console. See suspend_console() and resume_console() if you really want to see the gory details. John