From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FA14A0350; Wed, 24 Jun 2020 12:03:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22B061D906; Wed, 24 Jun 2020 12:03:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 511B81D8D9; Wed, 24 Jun 2020 12:03:08 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05OA26X8025140; Wed, 24 Jun 2020 03:03:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pfpt0818; bh=Y10+5W3BMQOOjjAvMZt5LG5r//pLamxLPj/h2xPc3nA=; b=y1Q1J2dWM3VrSRTptlo7RDJ41cL+zAKZ6BJ0jY2Y9GBG76ztmWG6CaEGpj+Sd7Ry0h/D sR7KYHgTCFEfKS7d5Rn6S9HkHSsIY2PAF4bhaiQln0MavMf2ZX7a4vGXx7qT5sjY7Qvi xxVEvyswF0UBuDe41yGLKOILkUP4Fk7b5S9or73HfRF0mKCGUpZwPDagpwMui4GPuZ5s YVTnwIU8A696yyjmdbhLnXzMqoQppZpn4YsVEDML9hjpvdFEFU0nRcj426vYxtnmBe/2 7HuEyQxvMUzT0FrGwZEYnXvH0ZftkZayDm47AYCc9L8KZ3iJIQJwm5QK3d61DqM3fVzY uw== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 31uur1a8sq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Jun 2020 03:03:07 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 03:03:03 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.106) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 24 Jun 2020 03:03:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PSJzmwvlyKdffJD1qLUthcynG6/2RISbUWf0LNkFLC1ltI9XcG9/r8+6Tqlrtl3unnSCgV7i0/wcCLC0M9b8+IEPEYBGwOo2aCClIY1YbXpiGiDM4FWcu3eFgEN5Ukde50b+PEoA8jjwx4rv4zYjD04Xq/j0xF+1Axc3Uy9G1uTW/88ecyXWihGxOcH1gVilBm8NiRArL4c/ufoJUVMwhq5Jm36gGkiGZBDNID36vz3FQKU4sfD8lAMhA/epDJnY6TBdQL0k5mD8IymFmfNExIgrqOcsOixmtSEdPTefy3QX5RL19uNmfEegKDGVcCWzp5gbQ+PpbmIThZti/rYlwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y10+5W3BMQOOjjAvMZt5LG5r//pLamxLPj/h2xPc3nA=; b=NMsYU/ldAnH+i8v2ku+Q1dIaoU+fcnURl38/RwKX2AIN60f3VFMfE1dCoLGgORHwTJzZT+HTB9v6/X7CtgI7Jx5H1RxiR+GqLZdGukRQNY2eUgfQSk/xwzbpMDfdpxiQmLq+waRJatjXl7srs9TPI6OVnAjLGROJJq42WOSLMzaC0zH6Dn7+CD8Duq/KcyZBzBgUbdD97MIZHtgguF85mhRjw6f7rzZ0DJIDeQVj/WchF849INrnNPFWjW4U95OfmsG+j5Iiw1n8Ev5D9D3xulqWQMEgOSuHA4Weatv0x2vwPYbSyhuUSGGvFjClM1o/Q/yuvkmyTp48PdFXdQOFcQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y10+5W3BMQOOjjAvMZt5LG5r//pLamxLPj/h2xPc3nA=; b=l0+k8tatRsqNH1mve1VZyyIZKYyiKqHBDGKVHxHTB/KRSeXGfymcR5JjgSkLpV6dpFrPqB0iS1VqU94XrtwxpD55hpe2pZwKG+YciEbOODEvNhHU0PUC1ByVXjVZ1Lx5Lk93nRqbVK6i9rs1vWwDRPMZelSP5SjYycVi4hPuYx0= Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=marvell.com; Received: from MWHPR18MB1070.namprd18.prod.outlook.com (2603:10b6:300:a5::11) by MWHPR18MB1149.namprd18.prod.outlook.com (2603:10b6:300:a5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Wed, 24 Jun 2020 10:03:02 +0000 Received: from MWHPR18MB1070.namprd18.prod.outlook.com ([fe80::e895:bdac:e157:2ed2]) by MWHPR18MB1070.namprd18.prod.outlook.com ([fe80::e895:bdac:e157:2ed2%11]) with mapi id 15.20.3131.020; Wed, 24 Jun 2020 10:03:02 +0000 Date: Wed, 24 Jun 2020 15:32:49 +0530 From: Harman Kalra To: Thomas Monjalon CC: , , , , Message-ID: <20200624100248.GB73382@outlook.office365.com> References: <1591730225-15300-1-git-send-email-hkalra@marvell.com> <2094499.cageA7459N@thomas> <20200624082429.GA73382@outlook.office365.com> <2473627.Zvk6BpfnDP@thomas> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2473627.Zvk6BpfnDP@thomas> User-Agent: Mutt/1.10.0 (2018-05-17) X-ClientProxiedBy: PN1PR0101CA0015.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::25) To MWHPR18MB1070.namprd18.prod.outlook.com (2603:10b6:300:a5::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from outlook.office365.com (115.113.156.2) by PN1PR0101CA0015.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21 via Frontend Transport; Wed, 24 Jun 2020 10:03:00 +0000 X-Originating-IP: [115.113.156.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6658a77-9803-43f7-880d-08d81825c803 X-MS-TrafficTypeDiagnostic: MWHPR18MB1149: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-Forefront-PRVS: 0444EB1997 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6lFK6QCm7MMFoLlSQiv+L4Gy7GKu6A6dmUzkHadPr6C172YxByU0kr8P7P0AH9mnGFYitybsPv7um1mkHot3FdfXYHExihpSuuphmFffMGw+UkUpFrP+ytzlTuH00BRtnL949+H14i6J3RvDA34m1+2HNbfXyTwvxqAGI4G4vyfhV/3pJ47kCJw/+XU2D8CRl5J9BdPjcWKJZ0Aoct715DS3M030J8mrw3yA6Ps0qI/SoCtbsGny6eGwJz25TfwFcxrhI1G+kJImcAR+F/yH40UKg7Gp70iXCoaQ+IEE5LNngzd5wHBgt6GdMo1MIg8lR9C1DgSucXqDd8e9dVWZ8g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR18MB1070.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(346002)(376002)(136003)(39850400004)(396003)(478600001)(86362001)(55016002)(9686003)(6666004)(4326008)(1076003)(6506007)(8676002)(7696005)(55236004)(186003)(8936002)(26005)(2906002)(16526019)(52116002)(83380400001)(5660300002)(956004)(316002)(66946007)(66476007)(66556008)(6916009)(33656002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: E/LGYS5BTWqTbqodqXGUms2eG2o7VWVifEOO3tt8Pe48WtpW84jZF0wYCSKuStsBup7dOd2C7EOCFA8XHR5gv5dyVxwQ8QP/KkKOfAn34CjNTl5Gi0QD3/+FihKpEu447bVkvhcRrnyowtvYAzbxqA5fISfDRhLvzgSJjYaCoP93LI/SIzFxQAgDHpJiw2wpL1bleodFBOyHRL0JO2HCwG73ZBSuZJu2wC/t6wWZsQx17dP0iViOya3AhzPWOF/WfcLROD8S4Wykdf7w/2Qx0R24DSGbuAFlAs1P+rdz8QYQYg0/JAcZ6cQqge8kpth/OfS60uLs4hGjWZCMC/gL7tnwbInZ7SXuCJSul9i8Tt/5VSY612nsW8xAdk330XLwCC9pb+v5brK++ybcPqJlWkMOwHuSXBwoKvwT7SlvM9VkWWDijI6NMos6LkTdfT6VXvmoLdrw+egp2/F41azxx8MN82/vGgc05eySz7sOVwg= X-MS-Exchange-CrossTenant-Network-Message-Id: b6658a77-9803-43f7-880d-08d81825c803 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2020 10:03:02.5034 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1coHT+MpNPE49QMGXE42VKJRBKFxm/kOTZ1j9k95EiouWvm9muGC9it/2l2pos7DD+ICEdyWStLVQnFUT8MtiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR18MB1149 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-24_05:2020-06-24, 2020-06-24 signatures=0 Subject: Re: [dpdk-dev] [EXT] Re: [dpdk-stable] [PATCH] eal: fix macros to align value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 Wed, Jun 24, 2020 at 10:30:18AM +0200, Thomas Monjalon wrote: > 24/06/2020 10:24, Harman Kalra: > > On Wed, Jun 24, 2020 at 10:13:18AM +0200, Thomas Monjalon wrote: > > > 09/06/2020 21:17, Harman Kalra: > > > > Found an issue while using RTE_ALIGN_MUL_NEAR with an > > > > expression, like as passed in estimate_tsc_freq(). > > > > RTE_ALIGN_MUL_FLOOR resulted in unexpected value in the > > > > above function as division has more precedence over > > > > substraction. > > > > > > The only change I see is adding parenthesis around v. > > > Am I right? > > > > Yes, parathesis are required if an expression is passed. > > I think the commit log needs to be updated. > I don't see the relation between > "division has more precedence over substraction" > and > "parathesis are required if an expression is passed" By "division has more precedence over substraction", I tried to highlight the issue which resulted in unexpected value, but yes it is sounding confusing. I will reword the commit message and send V2. > > > > > > #define RTE_ALIGN_MUL_CEIL(v, mul) \ > > > > - (((v + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > > > > + ((((v) + (typeof(v))(mul) - 1) / ((typeof(v))(mul))) * (typeof(v))(mul)) > > > [...] > > > > #define RTE_ALIGN_MUL_FLOOR(v, mul) \ > > > > - ((v / ((typeof(v))(mul))) * (typeof(v))(mul)) > > > > + (((v) / ((typeof(v))(mul))) * (typeof(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; \ > > > > + (ceil - (v)) > ((v) - floor) ? floor : ceil; \ > > > > }) > > > > > > > > > > > > > > > > > > >