Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp488485pxk; Wed, 23 Sep 2020 08:13:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzez//QBDEntGmCHbgX/5HHoTbOZDaTKtB5PNCPALDpVJgaZ0aIuo5/hU6uSMhU6sF7CjM6 X-Received: by 2002:a50:fa88:: with SMTP id w8mr10458494edr.179.1600874014422; Wed, 23 Sep 2020 08:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600874014; cv=none; d=google.com; s=arc-20160816; b=zwWjO7QAQLN2JU9WTPbw6iXQBS+dxB8VvWlFZMIamzXDvgf94Wzk5N3lJSZfP/2rXd wfHncd1OFaHVrpz1H9njfkK0HaKZnNpRwbRA7tNTLfpzHUamc07MuxEHrUuOGxMN/j63 PeFP5z/1KMNu+H/YgqTkGcMnNXkCLEzCYqne/gAu90bXp9T5LucbcuGXGC0txItlVASn nL7JPhoK1ejADMRwvF47JXkf0toEpZZTBtbun8X8cuN+ahQjtptrcwNhznckhqDLioef s/0MEV/zIthrHy0+ic2wsVfmD5xwD9v1zA9Ey+XABH+Stm+ZDT2YREgAvbmT2ddrwt23 dsDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=E83v/ucSMhfwTfzb6+rCLz1IyffRCv3VxbYq7yyWQFA=; b=gImWMFLw2DuFToNgXLAELaDsCmPP2jHDfLIGApkVCtqx2vxTKrtxq+1QGSenqXXnHA XbdYe3NKkbXqQbwHpAE+WBXDE2W9AB5Y7C5w0Q0BZrMzBFOLGW3U0NbTzX043SW8Hdpz M6uX7x3pWTHy/sHmYYt3X0kv12s+Ij9mMOCplm5pD7+HZot6w0f0vVcMxh2QwElyQae1 VV0XA3nnM8la53ZqbvEEPBuECRwL2nT09uaoUOyPhrrH5QFD9ZwbAY/oV1+vJIFDgj9u AR4ds+PtG0WigXsPjLfmsLqqMQcUUxfir3D58Z6ziEZujfzVJpoGE7jcIgfBYzWGrhcI XGeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=o7SaWIcu; 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=NONE 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 j16si55560edj.408.2020.09.23.08.13.08; Wed, 23 Sep 2020 08:13:34 -0700 (PDT) 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=o7SaWIcu; 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=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbgIWPLb (ORCPT + 99 others); Wed, 23 Sep 2020 11:11:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:46106 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIWPLb (ORCPT ); Wed, 23 Sep 2020 11:11:31 -0400 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=1600873890; 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=E83v/ucSMhfwTfzb6+rCLz1IyffRCv3VxbYq7yyWQFA=; b=o7SaWIcurg5lg7DJWZDVtpbqkcPhHlyKzFMtsbc5vWBM5uwvEmV25hy6eZV2eEp7B3IvBs r37XILVPHv7rWt0fNk88kei0U1F4TT996aWYVyq+8mD7doBDKIk2eAq4RY9M9g0BFBluwS xbNfRESUqKZUdcOnYoWfljIlouSqtSI= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6EFE3AB54; Wed, 23 Sep 2020 15:12:07 +0000 (UTC) Date: Wed, 23 Sep 2020 17:11:29 +0200 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 printk 3/5] printk: use buffer pool for sprint buffers Message-ID: <20200923151129.GC6442@alley> References: <20200922153816.5883-1-john.ogness@linutronix.de> <20200922153816.5883-4-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922153816.5883-4-john.ogness@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2020-09-22 17:44:14, John Ogness wrote: > vprintk_store() is using a single static buffer as a temporary > sprint buffer for the message text. This will not work once > @logbuf_lock is removed. Replace the single static buffer with a > pool of buffers. The buffer is used because we do not know the length of the formatted message to reserve the right space in the ring buffer in advance. There was the idea to call vsprintf(NULL, fmt, args) to count the length in advance. AFAIK, there is one catch. We need to use va_copy() around the 1st call because va_format can be proceed only once. See, va_format() in lib/vsprintf.c as an example. Is there any other problem, please? Best Regards, Petr