Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp147498pxk; Thu, 24 Sep 2020 01:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0GEIjP9Aq8RgYlg31YgTYyTqg1w7F7nKLaMp3TLzPx3OLfKNoJX8MPv3nsiICuG8jHb/W X-Received: by 2002:aa7:cf98:: with SMTP id z24mr2417957edx.241.1600937269348; Thu, 24 Sep 2020 01:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600937269; cv=none; d=google.com; s=arc-20160816; b=ACr/8hkHNHx8lyqy8mqYXSwsfpubyxNdvdsYVt8ci8xMCREq0irNEOYst3BQyICmS0 xsxztxZENHe4SzdWzBD+pCdcJc3BmoZ+CsCJWNdYA5W64Voe4LHMjQRuUSGoMzZSi7cG IeY5jYUYlk7lHRGL96P2iuqUlNVetpIFxcE5CksFMkHQYEaNQh4f0q+fWbnzL9usj4Tv thwYrb++UkLdBG9egFJ+ThneQwI3J7MyXFuFxNpFII2hikpdQTIN6aIDcCmZe/Pcem9y dqBkdRgwGss5tt4Ztqql3ZP8JdcEe8PeBIFAi3/I4J9VD1PJ8oLY3AIH6IMqLczgB0G0 DzRQ== 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=LiDYwk9lySi3d8BWgZSBd7bGIz2hU9PObtVbPv44pU0=; b=q6p4gOHY8plLWN3hpahlu4CI6ZqB/hdgbyDHSfPvEAeDhNaAoQOL5CRQdNCZmdyWHA Kasb6Flv4ZgYYQm5Bfmfo3exWtRg0QjQbuFQOlDUp4qnU5fPOUWwyvlWez2NEIGIW92A 9YqsRusrOOk/RpeV+Stg5YIG4QQnq9U2pN7db9+t8UxTeC+2AeR92iBwFvB4Jxxw4CCK EZnnRKwy3MIsCQFageSBd6091iwBUMKMbLsb2vmRo1mpV+jDgSb3NtzBe8Pbg2KtusOK IDGBB8DLzvdodgUlwwQTGrw87fFINit2pXJO4oqhr++56scIUy9Oh+mFiWfd58pM3/4e 850A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=qRbvu818; 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 x23si1601716ejb.588.2020.09.24.01.47.25; Thu, 24 Sep 2020 01:47:49 -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=qRbvu818; 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 S1727256AbgIXIp5 (ORCPT + 99 others); Thu, 24 Sep 2020 04:45:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:50566 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726387AbgIXIp5 (ORCPT ); Thu, 24 Sep 2020 04:45:57 -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=1600937156; 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=LiDYwk9lySi3d8BWgZSBd7bGIz2hU9PObtVbPv44pU0=; b=qRbvu818hxb4yQXYEV6arBnycD4gPXoawp779lJY5QVHURh4kC+3d4wN4aM9tKR16SzLl6 npXu34KsVvaEvmIm60mGfnbYEio2ElAPs7oB5CEl23vZc32ZiGCUKbAgGIzxu4Y8ethp/X DPPYc78oNBZZwdXp91VbUq0oC7VyIl4= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 40316AD6B; Thu, 24 Sep 2020 08:46:34 +0000 (UTC) Date: Thu, 24 Sep 2020 10:45:55 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: John Ogness , 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: <20200924084555.GJ6442@alley> References: <20200922153816.5883-1-john.ogness@linutronix.de> <20200922153816.5883-4-john.ogness@linutronix.de> <20200923151129.GC6442@alley> <20200924054058.GE577@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200924054058.GE577@jagdpanzerIV.localdomain> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2020-09-24 14:40:58, Sergey Senozhatsky wrote: > On (20/09/23 17:11), Petr Mladek wrote: > > > > AFAIK, there is one catch. We need to use va_copy() around > > the 1st call because va_format can be proceed only once. > > > > Current printk() should be good enough for reporting, say, "Kernel > stack overflow" errors. Is extra pressure that va_copy() adds something > that we need to consider? The thing is that vsprintf() traverses the arguments using va_arg(). It modifies internal values so that the next va_arg() will read the next value. If we want to call vsprintf() twice then we need to reset the internal va_list states. My understanding is that va_copy() is the only legal way when we are already nested inside va_start()/va_end(). See also the commit 5756b76e4db643d8f7 ("vsprintf: make %pV handling compatible with kasprintf()"). Best Regards, Petr