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 X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B605C433DB for ; Tue, 23 Feb 2021 14:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD3F164DD3 for ; Tue, 23 Feb 2021 14:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232623AbhBWOjd (ORCPT ); Tue, 23 Feb 2021 09:39:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:52190 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbhBWOja (ORCPT ); Tue, 23 Feb 2021 09:39:30 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1614091123; 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=gEzw/fCqc7xDdmteohVpYXtaCfPO7dagzCJiczyV3Is=; b=P6wOu4KZypeE3B4fYsE42oKLZPm8z5xkL8/VnNXlXpusE6raRAX2yMk3NFK6zCImd9AG8H Ur4qcP8W65IBxBSoKuRgq5f35nArdtLA86qgeZW2qL7ITEZr4jn6+1WOdUYrJxbpo+t6u8 983MX+bz/tQWp0jYAhZIL8LmacgiyWM= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 748D9AF28; Tue, 23 Feb 2021 14:38:43 +0000 (UTC) Date: Tue, 23 Feb 2021 15:38:42 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk-rework 08/14] printk: add syslog_lock Message-ID: References: <20210218081817.28849-1-john.ogness@linutronix.de> <20210218081817.28849-9-john.ogness@linutronix.de> <875z2o15ha.fsf@jogness.linutronix.de> <87czwst5mb.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87czwst5mb.fsf@jogness.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2021-02-22 17:43:56, John Ogness wrote: > On 2021-02-22, Petr Mladek wrote: > >>>> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > >>>> index 20c21a25143d..401df370832b 100644 > >>>> --- a/kernel/printk/printk.c > >>>> +++ b/kernel/printk/printk.c > >>>> +/* Return a consistent copy of @syslog_seq. */ > >>>> +static u64 read_syslog_seq_irq(void) > >>>> +{ > >>>> + u64 seq; > >>>> + > >>>> + raw_spin_lock_irq(&syslog_lock); > >>>> + seq = syslog_seq; > >>>> + raw_spin_unlock_irq(&syslog_lock); > >>> > >>> Is there any particular reason to disable interrupts here? > >>> > >>> It would make sense only when the lock could be taken in IRQ > >>> context. Then we would need to always disable interrupts when > >>> the lock is taken. And if it is taken in IRQ context, we would > >>> need to safe flags. > > > > Note that console_lock was a spinlock in 2.3.15.pre1. I see it defined > > in kernel/printk.c as: > > > > spinlock_t console_lock = SPIN_LOCK_UNLOCKED; > > > > But it is a sleeping semaphore these days. As a result, > > register_console(), as it is now, must not be called in an interrupt > > context. > > OK. So I will change read_syslog_seq_irq() to not disable interrupts. As > you suggested, we can fix the rest when we remove the safe buffers. I do not have strong opinion any longer. The disabled interrupts should not change anything, except theoretically for the parisc emergency console. Maybe keep the disabled interrupts there until we have a better solution for parisc. Best Regards, Petr