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_CR_TRAILER, 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 71FEBC4361B for ; Wed, 9 Dec 2020 11:12:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3954D233A1 for ; Wed, 9 Dec 2020 11:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730475AbgLILMB (ORCPT ); Wed, 9 Dec 2020 06:12:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:33800 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727806AbgLILMA (ORCPT ); Wed, 9 Dec 2020 06:12:00 -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=1607512274; 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=idMlQTYOnMdWg066O+TrOvZ3wrc3r/NV0fxwJgGhHRA=; b=nQApMpz5aWNn5UDhJeBZH/0d17YWczfYbeEnihhv068beOj3pjv3dC1E6toUr3nOQ5QhfQ oUn+yjRH4t2n4xVjHMsgpwjo5VbqLDFZhHOEazcOQXGnyl4kYVwZD7aiGZXkr7Eh9h1/Dg 4xSqnH44iD9wb0ckO/YjvDSa5B5LlTg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 78108B113; Wed, 9 Dec 2020 11:11:14 +0000 (UTC) Date: Wed, 9 Dec 2020 12:11:13 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH next v4 2/2] printk: remove logbuf_lock writer-protection of ringbuffer Message-ID: References: <20201209004453.17720-1-john.ogness@linutronix.de> <20201209004453.17720-3-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201209004453.17720-3-john.ogness@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2020-12-09 01:50:53, John Ogness wrote: > Since the ringbuffer is lockless, there is no need for it to be > protected by @logbuf_lock. Remove @logbuf_lock writer-protection of > the ringbuffer. The reader-protection is not removed because some > some variables used by readers are using @logbuf_lock for > synchronization: @syslog_seq, @syslog_time, @syslog_partial, > @console_seq, struct kmsg_dumper. > > For PRINTK_NMI_DIRECT_CONTEXT_MASK, @logbuf_lock usage is not removed > because it may be used for dumper synchronization. > > Without @logbuf_lock synchronization of vprintk_store() it is no > longer possible to use the single static buffer for temporarily > sprint'ing the message. Instead, use vsnprintf() to determine the > length and perform the real vscnprintf() using the area reserved from > the ringbuffer. This leads to suboptimal packing of the message data, > but will result in less wasted storage than multiple per-cpu buffers > to support lockless temporary sprint'ing. > > Signed-off-by: John Ogness Reviewed-by: Petr Mladek Best Regards, Petr