Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp2686238imi; Mon, 25 Jul 2022 05:38:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1suCH7/YRiBB+QN9GaolHpVoyyqBsxZ/adZ0FWhKSaGFhS94BQtUrFAhDssxZB/T4ZkVTTo X-Received: by 2002:a17:907:6d8e:b0:72b:95d9:ee94 with SMTP id sb14-20020a1709076d8e00b0072b95d9ee94mr10272633ejc.465.1658752728902; Mon, 25 Jul 2022 05:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658752728; cv=none; d=google.com; s=arc-20160816; b=d7FoctUK+/gcsI/xXr4BmN2PnX/wXFFa54OPWBxrpvb2l6z9vz5Lxwxj2J1vwg3psy xuLMC5JNj4cMZX03yyQF1kY5jPEAofnE7OQbHNBRUhTftMyxkFKWJPghbl11i+160ZFv lE4XjPTULymuiwTM39CdCCzNOVJwuGfX7qp3HmCVGrA85db86YWseh7lvbmJbLbO6b4A gFsf9goKrfQ5ZdeorYAa2dUUrJxa6nnnwOV00zYw25cqhpNDK5LIu+WUkcRLaGYrX7FU rM6N+MVg8ab4TFSpbp3W6M/HD1ZGoVgvZM2B0pl44zYb1OChpS0MX12dX7fyGEF2Y1P8 kgCQ== 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=5Djhp/kj6T5Dlta/dAFi83yMTsDZOdx2mCFb0oJGeuo=; b=JFjoW/HPNjD6nc6LQnCo9tpNnHyWNKBVrnQoZLaw9DNNQq/BUx7Gcecnn0VsgI/JEC 9KwY7vWIZEEZvmXhey7Qt2/BEHE7/YnMS6zRRPKtEkvamKCR3WmpESS77WB5w1AzNU9d sjiWsH8LE3pBeERHgO+wNjlvh8ftG6LP2iFE9wSXF+xRrZde5bk3DoWYqw6iC3LIY63C hcLasWx+++KnChEc9Cur1qn5I6UXJz9HqRtBkwd397cY1tsjSvIccqHBv2KzVMJWPJxi LuDIes025uKN5Ks7i9gucKqOVwdvjFLWx5o3kRfcGgkEjbw9zoPZAEUSa6at8vntjazB b9Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=smASnO5n; 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 f20-20020a056402329400b0043bcab96193si10053516eda.535.2022.07.25.05.38.22; Mon, 25 Jul 2022 05:38:48 -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=smASnO5n; 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 S234936AbiGYMaO (ORCPT + 99 others); Mon, 25 Jul 2022 08:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234113AbiGYMaM (ORCPT ); Mon, 25 Jul 2022 08:30:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE37CFE2 for ; Mon, 25 Jul 2022 05:30:09 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 07C7620124; Mon, 25 Jul 2022 12:30:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1658752208; 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=5Djhp/kj6T5Dlta/dAFi83yMTsDZOdx2mCFb0oJGeuo=; b=smASnO5nClMmRn44SKR3UHMcTznlkTTqxrwiYBmd8y6eN8EvZ90gaONNA1SigZ3AZToDVj jBDFQFGrZLE9uXYSlDZx1XnZRhmApdiq/dzdv3aD4m3L2il/HY7IOsAXRmE8zdCm85D1ku eMTvbzhjlrDsLA7UZvK4O4eWZbG1rY8= Received: from suse.cz (unknown [10.100.208.146]) (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 AE54C2C152; Mon, 25 Jul 2022 12:30:07 +0000 (UTC) Date: Mon, 25 Jul 2022 14:30:04 +0200 From: Petr Mladek To: Sebastian Andrzej Siewior Cc: John Ogness , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner Subject: Re: [PATCH v2] printk: Skip console drivers on PREEMPT_RT. Message-ID: References: <87y1wn3g3g.fsf@jogness.linutronix.de> <87ilnrn06u.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 Fri 2022-07-22 19:03:49, Sebastian Andrzej Siewior wrote: > On 2022-07-22 14:39:44 [+0200], Petr Mladek wrote: > > On Thu 2022-07-21 08:50:38, 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. > > > > Maybe I do not understand it correctly. > > > Or is is somehow specific to the console drivers called from printk() > > directly? > > You can't acquire a sleeping lock with disabled interrupts and or This is what I have missed. It might be obvious for people living by RT kernel. But spinlocks do not sleep in normal kernel. So I did not get that the spinlocks are the culprit. Please, make it more obvious in the commit message, for example: --- cut --- Console drivers use spinlocks that might sleep in PREEMPT_RT. As a result they must not be called with interrupts enabled... --- cut --- > > > 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. > > > > I guess that this is for RT tree because the kthreads and the atomic > > consoles are still not in the mainline. > > I would like to have this applied to the v5.20 upstream tree and then > revoked once the missing bits have been merged. Based on what I see, > there shouldn't be any road blocks. Huh, I do not think that it is a good idea. There are neither atomic consoles nor printk kthreads in upstream. The patch effectively completely disables the consoles in PREEMPT_RT. All consoles will be _empty all the time_. Also the consoles were never tested with interrupts enabled. I am pretty sure that interrupts has to be disabled in some locations, for example, when sending some data sequences on the ports. Are we sure that they are always explicitly disabled inside the drivers? This is one reason why we reverted the console kthreads in 5.19-rc4. AFAIK, John is doing some inspection of all drivers. That said, I am going to leave the decision on John. I am not sure what are the expectations of RT users in mainline. From my point, this patch does not make much sense. IMHO, it will not make mainline usable with PREEMPT_RT. Any serious RT user will need to revert it and apply a better printk solution from the out-of-tree RT patchset. Best Regards, Petr