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=-9.3 required=3.0 tests=BAYES_00, BUG6152_INVALID_DATE_TZ_ABSURD,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,INVALID_DATE_TZ_ABSURD, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 CBA51C4363D for ; Wed, 23 Sep 2020 14:36:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84195206FB for ; Wed, 23 Sep 2020 14:36:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yOyV2uWs"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kwk7s2Xb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726667AbgIWOg0 (ORCPT ); Wed, 23 Sep 2020 10:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgIWOg0 (ORCPT ); Wed, 23 Sep 2020 10:36:26 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE07AC0613CE for ; Wed, 23 Sep 2020 07:36:25 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1600871784; 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=Ui7hpnIyys5luJxbofLseLzGkNTuHdJO8ux+tEPyvJU=; b=yOyV2uWsIg9LUUjzUTl8eu5WA+0E5YuR9NvSp/L/orUvArKuUK4t7MWZ18I015rqWpXCpu Mex4GpXHKlZO74/FEmY5Zy8+FfermPCNUt6ox3rQNzmkY/3djLcsiPiPc2nRbz5IFFRdjD wla9M7WWfDpzj0LDSiA1r5jJ6B4mXh7Gm61QdKCltSlbN8XrA2j6XzJHXBo10ZxHkxQCle 3xGPUeZ+4MyHB/G8VjaXfsTUe5H7zXA6yq4oWEOWuL8MOXBsmVA+S4SSCvniEJzokIecDG 0Da9kwgPcGr68S5ct9bs2zRDviWeY61XtyKoHjXqPqhUOnd3392iMlJisn4Msg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1600871784; 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=Ui7hpnIyys5luJxbofLseLzGkNTuHdJO8ux+tEPyvJU=; b=kwk7s2XbtBU8ItKHtNn5xC2hVF5Fbgm/Y51llw0Wj6+oONG0HOIYNUQ2lu6eLPOywh2VMz LcTk3Y7sQh5AQICg== To: Petr Mladek Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk 1/5] printk: get new seq before enabling interrupts In-Reply-To: <20200923141723.GA6442@alley> References: <20200922153816.5883-1-john.ogness@linutronix.de> <20200922153816.5883-2-john.ogness@linutronix.de> <20200923141723.GA6442@alley> Date: Wed, 23 Sep 2020 16:42:23 +0206 Message-ID: <87r1qszhjs.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 2020-09-23, Petr Mladek wrote: >> After copying all records to the dynamic ringbuffer, setup_log_buf() >> checks to see if any records were dropped during the switch. However, >> it needs to check before enabling interrupts since new records could >> arrive in an interrupt, thus causing setup_log_buf() to erroneously >> think that it had dropped messages. > > Have you seen the problem, please? > >> Signed-off-by: John Ogness >> --- >> kernel/printk/printk.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c >> index 1fe3d0cb2fe0..00bc1fce3299 100644 >> --- a/kernel/printk/printk.c >> +++ b/kernel/printk/printk.c >> @@ -1181,12 +1181,12 @@ void __init setup_log_buf(int early) >> */ >> prb = &printk_rb_dynamic; >> >> + seq = prb_next_seq(&printk_rb_static) - seq; >> + >> logbuf_unlock_irqrestore(flags); >> >> - if (seq != prb_next_seq(&printk_rb_static)) { > > I can't see how these two values could get modified after enabling interrupts. > > + @seq is set in the for-cycle before the interrupts are enabled. > > + @prb is updated before the interrupts are enabled. So that > the static buffer should not longer be used after that. You are correct. This patch should be disregarded. John Ogness