Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5641672imw; Wed, 20 Jul 2022 09:30:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uo0a+iOvb+ep2q3ZXGgVBoe35wWgWc0X+15bdFcJQJvMfE6xtl4+DSKyT1oeq3WFl8QVYY X-Received: by 2002:a05:6870:f719:b0:10b:f9da:9ab7 with SMTP id ej25-20020a056870f71900b0010bf9da9ab7mr3081065oab.169.1658334602005; Wed, 20 Jul 2022 09:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658334601; cv=none; d=google.com; s=arc-20160816; b=gs5FvuWxaoqu1rRnDCt6lD6IlNo6Uz1MDpSK9HYwDubUFd/T6e+v2YMmye4fwAHFt/ kBzvmdGcO8ohXL9W/aHpsmWpINgn4Ry806NlJM1mKm/w1ln/n0fAc+DxmmomfHWjCf+r ixBnIWQOsm3fh3wJcem8DdnMAApk8QSkTB9cvhVCmWliAOkxE7ro51ZyzG3wIqZ1WAxS t/KFsF22KlMOAVhdhu0mpHJGrIeOrtqsmJR5LnT5t2TxNXD7s+gcEdI1k8XEuzsJLXp6 8czKDrfBmw9wyJjasmY10CJPpdq87dDsik6N7aGbZlr5GrqftN2gYTmbRiPJIRwowsl7 ho0Q== 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=4leS/OzPg367ECXwYMnkpYl32ug6Wj+K9VKgkcusHe4=; b=QqY+IaM6s43ITQNZVfW2bBBrKRItt7p7tx1rDmVApJx90s1OuosiKF+csgI0wbo5Rw spiQBZK5WVCssqVqtYfBKpYEdqyJasTCN4SlmVaANN6vqOKv9naagvdh6IJd0r+NlruQ Q6UxT5HGG1mwGFe8TiSFxNkJoPPgzJKcf2JS4e+ZnzRUmeITH8epgwJy0CXc4nnriuuo Qy0U7fcsU3W16NQaOKcYR15DZkX4F5Tv3wXvf/7dEE5c4dQn/Ixy7/+XTZUnjzb+s2P0 UJ0T4Bl6928PX3S6rERb1SR7xmjYZqDCRSMhKm5VhGp9CbtSaczz7xRTggqKZMWiE6EQ YvcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1BFfPKBk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 t14-20020a056870638e00b0010206821c3asi18561473oap.263.2022.07.20.09.29.48; Wed, 20 Jul 2022 09:30:01 -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=1BFfPKBk; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S237152AbiGTQ0r (ORCPT + 99 others); Wed, 20 Jul 2022 12:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiGTQ0q (ORCPT ); Wed, 20 Jul 2022 12:26:46 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C816186F8 for ; Wed, 20 Jul 2022 09:26:45 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1658334404; 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=4leS/OzPg367ECXwYMnkpYl32ug6Wj+K9VKgkcusHe4=; b=1BFfPKBkMv2/TTXrAQH++IcMA8eDm9Gyfvmot9J3Np+yuectOGHvqUVURel/y3K9RAnOuF SF62GcFiVZGoOs6BUvtCWeToY78wIDaTsIrMAJlqP8WJCxKHyTbvNSQOVFHf+ynOgifi+1 67n9aWq1AeA6eqhDRDhFsKDvJPg39hQdOOGGZM6N4jgRUVoWZkehZsGqe8Ac3i9lI60hpB TC/gmCWRGluxNIeYDAMTHHW8QN9rpyINie6MZ62kli10ekPVPwyH/WP/uiTE4oedb8SaWa R2qqex/Wewdlr2yJsr+TvBKe5QBR8St8g4dy7dtBQd2xo9T4xiH476RiR73sWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1658334404; 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=4leS/OzPg367ECXwYMnkpYl32ug6Wj+K9VKgkcusHe4=; b=aCTJaUthsSyqt7NcMPk1l8USpV/cEXRcrHJZaLLFUVDi1XBXRIFlQbezuUSFRi6S8dj2hW yx8/nRfP6AzqEjAA== To: Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner Subject: Re: [PATCH] printk: Skip console drivers on PREEMPT_RT. In-Reply-To: References: Date: Wed, 20 Jul 2022 18:32:43 +0206 Message-ID: <87y1wn3g3g.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 Hi Sebastian, On 2022-07-20, Sebastian Andrzej Siewior wrote: > printk might be invoked in a context with disabled interrupts and or > preemption and additionally disables interrupts before it invokes the > console drivers. This is behaviour is not compatible with PREEMPT_RT. > > Disable console printing until the return of atomic consoles and the > printing thread. This allows to retrieve the log buffer from user space > which is not possible by disable printk. > > Signed-off-by: Sebastian Andrzej Siewior > --- > kernel/printk/printk.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > --- 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(); > + return; > + } Note that if @console_may_schedule is 1, then we are in a sleepable context and could print. But since that is not very often, it is probably better to just have it off all the time as you propose. John Ogness