Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4018013pxu; Wed, 9 Dec 2020 06:30:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxC+oqLwZ2irpttM4f3AassdkDWuUQeJHpAo0Xp9/6EMYLdNN3WsRZG9v5dyCmEA601kLij X-Received: by 2002:a17:906:1e0c:: with SMTP id g12mr2350866ejj.115.1607524215065; Wed, 09 Dec 2020 06:30:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607524215; cv=none; d=google.com; s=arc-20160816; b=W+mU0FtCi0lm3a9otyy/9FcaPvjpFsxpRZQuBt3tI4mynw1YJVV1u/3ouXhUMse14Q 1/Kfm4jj5HAlqmbQpF66G1PuCjHYoi1/EkWKhtFNZ8jVIGONM2zhg2HZeCaO3PxJgMxZ yGH0Kqc9mriRa3aoy8fxqDrKj4zE+pOexRHBZ2EmaRHKnx9aD0ybFvabET8Q1HfDvCPb /4v3IDQXc5I9am5XwMbn5qEqmwEH46+kzTdmGjd1RoPAAq8ZXuioah1yOhkPNbuWI4Be xdjrfsvR3YgS/H1CSYZjN31FCMDbTRXzzRjM40r7e5DlVQQOEXN8xlAyJ3VvpPcUwSjn 1jGw== 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=idMlQTYOnMdWg066O+TrOvZ3wrc3r/NV0fxwJgGhHRA=; b=QplsGZM0NxhbtcmPEFKmFq9IelQaMZzCR6Fzk2mUzCt7q3AMf77fE6MW0LGEXwQVVB W6om67ZxrTUppIwtuG0n0Fgn9d7vX3Pa1hjAuKB4btn5phs6Ix8dZI7CuXdbXafURe0U +WQO/nZjmrTIfxATSvbhIagneCbRrNwBgr98jRDYr47nEdRPSYF57CSO4Yy/730JUxoE r0aU649tx2tPdqh7fVzHHvx7DMAKeQxl8sjKTuFb9vN88MLjKE/tScJWGInPHPgsH0mo J6ZTlkjriBx2RuWfmvjoKjrWg8Lh4Yt4sma5kju8wofEnOxQm6MRkFUZ3YqFRQRt0JUm Pp3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=nQApMpz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm26si913520edb.528.2020.12.09.06.29.50; Wed, 09 Dec 2020 06:30:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=nQApMpz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730285AbgLILMB (ORCPT + 99 others); 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