Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp462627pxb; Wed, 11 Nov 2020 08:00:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzc95xK7fAat7iuVRW92jwpHXFpwQIq+30q9F6WlW71Thpno+QDFNI0HhoTJV45V/XkYJmI X-Received: by 2002:a2e:90c5:: with SMTP id o5mr8497261ljg.136.1605110458187; Wed, 11 Nov 2020 08:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605110458; cv=none; d=google.com; s=arc-20160816; b=P0HuMHnPVqwDHechJ4zLAn9IrCmhOnRV5hXLI8av5meaBfclq1zlFhN0Yz+a2nhhv1 +tuJQO6K92Twk/r4rbOsmc2lgquX725oNU7MG4Ecmd6tB2t9qgSS9b7ZrHA64oxw6Dxs +5U0cmSFmlofcN9202G+k2wpyshzEXXpdyzxuxYYW5e/rpwg//jBddtWGP5+qBM+TNKn 8HB2oD/gT8xVsvnGvcPJgxOoZvX4kpFNjOnBEChFzJcnbReicw1EUJNtaX/7je3KX8Dt oUKp98P0kEaPCHnjuEwwvfS6ksEdcZHIg1MmC+rOeBBtJZFQ3mixd+XKpB7BmaTiS4zZ PhSw== 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; bh=OVpwhejvtuHJtc7sC30nQWwlmDu7ul3mhutrjzVDm4g=; b=aKJww5T8HPzUqXFIw//tJimK8QKtNsvv5L0+2MfJmmN/djA24OjjHF7iHdccgZggCr R5H2e+eKOaqHR+FGfVv7yPQB4yeDCPB31zOKlP9TYHLKn8gL+sSsU/9BB2TEJUNIRhcx RldiL1jgVVrl5562yH+kmeyF8pgfrAvqPU1OXpKDWy5CczSQrV/sh265ER3hTNk7XbuQ aK1q48cDimzD27ab1Qm27d+3/+we8Hifltti+Rn0BEVmqiOoxpKNukJYIVhOCWQee1Pt S1qbk0Zobh//wxf+SPwHOGdEKkr8+drWV1kPBkdU7qoOZ1lGSmx/Ot/pB4g2ymjwwue8 n8gA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si1621204ejy.598.2020.11.11.08.00.34; Wed, 11 Nov 2020 08:00:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727526AbgKKP6e (ORCPT + 99 others); Wed, 11 Nov 2020 10:58:34 -0500 Received: from foss.arm.com ([217.140.110.172]:56982 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727285AbgKKP6d (ORCPT ); Wed, 11 Nov 2020 10:58:33 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AB1A7101E; Wed, 11 Nov 2020 07:58:32 -0800 (PST) Received: from arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AE0233F6CF; Wed, 11 Nov 2020 07:58:30 -0800 (PST) Date: Wed, 11 Nov 2020 15:58:27 +0000 From: Dave Martin To: "leo.yan@linaro.org" Cc: Arnaldo Carvalho de Melo , Andre Przywara , James Clark , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Al Grant , Wei Li , John Garry , Will Deacon , Mathieu Poirier , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v8 06/22] perf arm-spe: Refactor printing string to buffer Message-ID: <20201111155826.GN6882@arm.com> References: <20201111071149.815-1-leo.yan@linaro.org> <20201111071149.815-7-leo.yan@linaro.org> <20201111155320.GM6882@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201111155320.GM6882@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 03:53:20PM +0000, Dave Martin wrote: > On Wed, Nov 11, 2020 at 07:11:33AM +0000, Leo Yan wrote: > > When outputs strings to the decoding buffer with function snprintf(), > > SPE decoder needs to detects if any error returns from snprintf() and if > > so needs to directly bail out. If snprintf() returns success, it needs > > to update buffer pointer and reduce the buffer length so can continue to > > output the next string into the consequent memory space. > > > > This complex logics are spreading in the function arm_spe_pkt_desc() so > > there has many duplicate codes for handling error detecting, increment > > buffer pointer and decrement buffer size. > > > > To avoid the duplicate code, this patch introduces a new helper function > > arm_spe_pkt_snprintf() which is used to wrap up the complex logics, and > > it's used by the caller arm_spe_pkt_desc(). > > > > This patch also moves the variable 'blen' as the function's local > > variable, this allows to remove the unnecessary braces and improve the > > readability. > > > > Suggested-by: Dave Martin > > Signed-off-by: Leo Yan > > Reviewed-by: Andre Przywara > > Mostly looks fine to me now, thought there are a few potentionalu > issues -- comments below. Hmm, looks like patch 7 anticipated some of my comments here. Rather than fixing up patch 6, maybe it would be better to squash these patches together after all... sorry! [...] Cheers ---Dave