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 B23CAC43334 for ; Wed, 20 Jul 2022 17:50:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234352AbiGTRuG (ORCPT ); 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 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