Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp536726pxb; Wed, 11 Nov 2020 09:42:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJznTEODOR6VI4UJq1EcAmTSorwYJpwPazV+wpAjaaW4rCtYgCoRPP2caYXuHrl2IKDTHYWt X-Received: by 2002:aa7:d2d9:: with SMTP id k25mr613247edr.310.1605116546358; Wed, 11 Nov 2020 09:42:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605116546; cv=none; d=google.com; s=arc-20160816; b=qr36J6ey4dtIvysgPP24aPDvzF17kZJsW1069DQQyv1sh+1UcBwtac5MTqTONHoPP9 0wIkVW018AtyhbsGGnP118mS+/DV12qrkuCJbaJHJLU6mvWHxHoAsP2sooZtxOg6Q/Ur LbSUVFtBDI3gn4HFOMgx1rahYY+LoNe1PjIb2GM4neGqAEv8F+GSzSgj2sSHTXEI1WGf vcwYmrU0kiFZgLV6wweHRS03/31z6EiO2nEMgSIzlRVrw8T0vMXYSHVF9/bLNZh4yiaW KWZfUF3HweHGfUAEu1dpKKDXmgfZai1GCpAdK2nP0ffScbk+pMPpgSE19yV1NcuyAO7l 9vhw== 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=i7Ylc8igrraxveVynEaPjyrp2n3k70MS3UUOb1PRm2k=; b=kbkWEivf8LpNRyPDZMNXm7kzhyVUXptDmZdfpZ7lCLbolZnrcc6EdT/DdlYxhZpows NDVbwmeBYRRx0wr1cmo9I8uvvVvzBrWqHWSZrVQwWZRhLxXN+IcNX+6bF6N3J3jO6PwA d9A7eMvoXofMY9TziFLYAWk0mUNXTsQY8SdKE3AEe2b7FUaakQHS+wiWftkoiF17RNo2 OOTeroYCdXW5n2gqiaA75HFHufNXAJ4nJlcnNoV1d7BTxP9w1E/tn/nYin1cDbFx9CJv dppuyvAAJNCkNzqlpzRNo7dXxjw72WIyXAjOlAQcN+FP44rVp1S77veZXVuxl4bSaQwq EMNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GQ8Ru8cU; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i24si1768666eje.42.2020.11.11.09.42.01; Wed, 11 Nov 2020 09:42:26 -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=@kernel.org header.s=default header.b=GQ8Ru8cU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbgKKRkO (ORCPT + 99 others); Wed, 11 Nov 2020 12:40:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:38432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbgKKRkO (ORCPT ); Wed, 11 Nov 2020 12:40:14 -0500 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B291206D9; Wed, 11 Nov 2020 17:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605116413; bh=9hcp2jmr5tN+kDYny1x/liXyhLaqh/1ZZx++7sd0jgQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GQ8Ru8cUQ1BaeC2YIxkYJXWgOc4DWwObR/z2TfF8KFLqa3zDjmVsxbLXB1BHI+me6 uaArfLIAjyfO0p574vcxGysJCRCDs7jN6ZQYRUQItIW5+hq8JeM8JCc4WrcwZJ5ymJ GeE9wVX+cekSU5V+rQ6+eUTmSEttgileLKorTXMU= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 2470C411D1; Wed, 11 Nov 2020 14:40:11 -0300 (-03) Date: Wed, 11 Nov 2020 14:40:11 -0300 From: Arnaldo Carvalho de Melo To: Dave Martin Cc: "leo.yan@linaro.org" , 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: <20201111174011.GB380127@kernel.org> References: <20201111071149.815-1-leo.yan@linaro.org> <20201111071149.815-7-leo.yan@linaro.org> <20201111155320.GM6882@arm.com> <20201111155826.GN6882@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201111155826.GN6882@arm.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Nov 11, 2020 at 03:58:27PM +0000, Dave Martin escreveu: > 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! I'll take a look and probably do that, as it is what Andre suggests. - Arnaldo