Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4390851imc; Mon, 25 Feb 2019 04:12:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IbKw5tQqYEsZfvcY5NjpfWvlL5+TiH6TSFe9A7xiMk+COLvVIOpQLVs4gUZcq1TXEiqFMPN X-Received: by 2002:a63:e40b:: with SMTP id a11mr16866832pgi.259.1551096737637; Mon, 25 Feb 2019 04:12:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551096737; cv=none; d=google.com; s=arc-20160816; b=J3+N7cE2Qedbmb70e3AEq0m7+JOnKSceHuxALebz/m8lHV9WoHfyUP7TIybMPaQrbq sWz6RuL0vvgfyZSUv74q+9HFXjNvcvEVPjO497lNVmX+DhqvGc8o2RFoQ/1a1QKniVjl gbZ7Il5ZqwcEemjtYdsb5odpA2wJXOPrLQHLlM8hbBD5XU1SaHanZGbli1XKCfTUVROR M+RkPXKZq2nM4A1aoSkzxgLCEvVci6IjuFGH50kV22k2Jq1a6hMgFx40kTl01rN2tzIi +QYi9oHZN8jql30Y4+nYx3bIAmJKuhJxhxAnDbQ6Svpb1utFALV4K7LWsYfPQ1nte4G1 SHhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=5QBXoQG2H/ogfkbsMx1vFto9SGM/KmDWTwaXSHt7KTw=; b=SLyAet6fEMgYWFIc0jdYESJE9dnB7Capo7ZHTe4moReFolve2GXH7PBVxCAM/Wrneh X7nGRaWu3ucS2bBAJSFt0px3x6kKO262AYEcfjBkrftDyzErN62x6FGWxZeX2DbbEDQh zAjenvlR0avbPUopDM5qnXAZMVCiCynf8ss2UkLHCDT43dEhXkx7SFCkCLeN5uUvzisy WFJ3iNyN0TLaOYagve3MqbrKlmVuvCdYdbHVII/a9HCfxPMb2/5VN2Aw1cKLPNRSdZHS 4RpRl+ybUwz1pshwfM5G0VOOzBEmbAlBDOcqZrXViyyrO6+dNyywN5wRH3a3UgMuPCFA hABQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s198si5994759pgs.582.2019.02.25.04.12.02; Mon, 25 Feb 2019 04:12:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726881AbfBYMLK (ORCPT + 99 others); Mon, 25 Feb 2019 07:11:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:47142 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726701AbfBYMLJ (ORCPT ); Mon, 25 Feb 2019 07:11:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 10BA1AEE8; Mon, 25 Feb 2019 12:11:08 +0000 (UTC) Date: Mon, 25 Feb 2019 13:11:07 +0100 From: Petr Mladek To: John Ogness Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Sergey Senozhatsky , Steven Rostedt , Daniel Wang , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , Alan Cox , Jiri Slaby , Peter Feiner , linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC PATCH v1 10/25] printk: redirect emit/store to new ringbuffer Message-ID: <20190225121106.oig7s6odqikcn4xw@pathway.suse.cz> References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-11-john.ogness@linutronix.de> <20190220090112.xbnauwt2w7gwtebo@pathway.suse.cz> <8736oijgpf.fsf@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8736oijgpf.fsf@linutronix.de> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2019-02-20 22:25:00, John Ogness wrote: > On 2019-02-20, Petr Mladek wrote: > >> vprintk_emit and vprintk_store are the main functions that all printk > >> variants eventually go through. Change these to store the message in > >> the new printk ring buffer that the printk kthread is reading. > > > > Please, are there any candidates or plans to reuse the new ring > > buffer implementation? > > As you pointed out below, this patch already uses the ring buffer > implementation for a totally different purpose: NMI safe dynamic memory > allocation. I have found an alternative solution. We could calculate the length of the formatted string without any buffer: va_list args_copy; va_copy(args_copy, args); len = vscprintf(NULL, fmt, args_copy); va_end(args_copy); This vsprintf() mode was implemented for exactly this purpose. Best Regards, Petr