From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D22B9A0564; Fri, 12 Mar 2021 05:42:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E9604067E; Fri, 12 Mar 2021 05:42:04 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 81AB54014D for ; Fri, 12 Mar 2021 05:42:02 +0100 (CET) IronPort-SDR: 6COZyvJSZlmSJ+H76rtV/3ZGLU+hmJHMYXWwYDGgLuv00sRa2wdLiQJBqFi17az3QBR4nmqwOC OrxbjM0kTUuQ== X-IronPort-AV: E=McAfee;i="6000,8403,9920"; a="273823003" X-IronPort-AV: E=Sophos;i="5.81,242,1610438400"; d="scan'208";a="273823003" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2021 20:42:00 -0800 IronPort-SDR: UO8XTlvJLj+bA+b3i/rnPXUa3pnwbg1FywXpgln7XcQsyXsVREjcTRNvbnM8R0uzSSnhZhDfVV +H4CBobCwbVg== X-IronPort-AV: E=Sophos;i="5.81,242,1610438400"; d="scan'208";a="372564856" Received: from rmenon-desk.amr.corp.intel.com (HELO [10.166.30.253]) ([10.166.30.253]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2021 20:41:59 -0800 To: Tyler Retzlaff Cc: dev@dpdk.org, thomas@monjalon.net References: <1615496911-7050-1-git-send-email-roretzla@linux.microsoft.com> <20210312013414.GA6784@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> From: Ranjit Menon Message-ID: <7e84d8a3-45cc-4477-14cd-b595e1fdf1e9@intel.com> Date: Thu, 11 Mar 2021 20:41:58 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20210312013414.GA6784@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH] eal: avoid side effects in RTE_ALIGN_MUL_NEAR(v, mul) for v and mul X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/11/2021 5:34 PM, Tyler Retzlaff wrote: > On Thu, Mar 11, 2021 at 04:40:58PM -0800, Ranjit Menon wrote: >> On 3/11/2021 1:08 PM, Tyler Retzlaff wrote: >>> diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h >>> index 1b630baf1..640befee2 100644 >>> --- a/lib/librte_eal/include/rte_common.h >>> +++ b/lib/librte_eal/include/rte_common.h >>> @@ -345,9 +345,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) >>> */ >>> #define RTE_ALIGN_MUL_NEAR(v, mul) \ >>> ({ \ >>> - typeof(v) ceil = RTE_ALIGN_MUL_CEIL(v, mul); \ >>> - typeof(v) floor = RTE_ALIGN_MUL_FLOOR(v, mul); \ >>> - (ceil - (v)) > ((v) - floor) ? floor : ceil; \ >>> + typeof(v) _v = (v); \ >>> + typeof(v) _m = (mul); \ >> For consistency sake, can this variable be changed to '_mul'? > sure, i can do that. it will hit another tab stop below though. > i'll submit a v2 with the requested change. Ugh! In that case, let it be. If others insist on the change, we can do it. ranjit m. > >>> + typeof(v) ceil = RTE_ALIGN_MUL_CEIL(_v, _m); \ >>> + typeof(v) floor = RTE_ALIGN_MUL_FLOOR(_v, _m); \ >>> + (ceil - (_v)) > ((_v) - floor) ? floor : ceil; \ >>> }) >>> /** >> >> ranjit m.