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 046EEA0544; Fri, 23 Sep 2022 10:25:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9042400D7; Fri, 23 Sep 2022 10:25:50 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 413F44003C for ; Fri, 23 Sep 2022 10:25:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663921549; x=1695457549; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=0BvG6dtaATiOhld7L1oQS+HOJvg0S7LsFLx7NnlEk5k=; b=npIesUXXxaBRKQmaYlRb2pmGIdWBtrXLJKd4v1YMOcVgf2oQHlwoGtyZ qp6nJHiQePe8WCrDvwTuJKQuOUdfIlekNC2u6dFxQmJFmxPwijVnRzdcr VPw6NwoyflgVjvwjk3C9LafZfHNenQZTM3pgyfhpsTsT4Yksym0Joo+Kn rAgKufa75xL+N3gwgfdQe6wV7eyCp7BDrA8CyheCUxuj4wCN7LpUlHDJ/ p/SjtevKlC2ZcSxQE79t2gDxWtFN9Y03aCQh+n9xnySlqpSMEB0l8l6qX Gp+bH97nFWVY/SXRp2t6CUADAnT4/irN6uQt7Wre5zN1JdRgdu3lERsqH Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="283639781" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="283639781" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 01:25:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="650871841" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga008.jf.intel.com with ESMTP; 23 Sep 2022 01:25:42 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 01:25:41 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 01:25:41 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Fri, 23 Sep 2022 01:25:41 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.43) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Fri, 23 Sep 2022 01:25:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jH+fs64k2zOlJFlC9m/harH/iO2iH9EWshSazzvrYAkcPLpWc3d/6wcMcezNtuKCLULjFq0F8CD1Gv6r3W2/yJ8qAcB2c+lhwREYJD4bfThMVXhuom7pBvvTUYrOln58btqbR2lm4d+SdGUfafB+FJcgd9+Ts0u/JDrO0x1EAZ/yWBdxyyME9u3DroWYiPt/gQmcnGyqkmEhdMiyKcej7Sox9ZDtKjGIJ1CoTJ0+X+nWqfJ/UtBOhc3V2ScQrbsvV0/+EOYJtSYfwkMzVm+L3AoNcYK9zTONTE6Tkl9lgvEngwc/4x1M0x0E9SJP8VVucFpbiD4qEiCKgQvPda8fYw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6FAh4YJTut+mmFASZFemExYKFfQSXS7QqEaMxkpSTFI=; b=Ihir/+w/Sj3PQEy2k8T1Zkh0OFuSLrR5wVW6DkI/UPNZljvMsNxyUQj5LYTUOI2slIdN7X/roz0Qc6DhXAJ0IQxP8E+NYaw3MfrjnWoqfqnKuh3i+/dOeusZLhrjXUMw1/WsYntaEN5GkF4E90baTVqkGbvgkcLqWHgtDCCBBcKewUxXUxgq5wfBj5FwcsRez7o/CImB4iQ10nFVK+EuyOokT2aJ2fg3rN0G2h7M9RuNqirh6efkGqDBfLOtlAdFvetRKz3CdHJwl3xSUxK2vR8so2GDERCAnVxlimgbX4NRY9Y/l/T9sVa1jXWL4ZeMV1eCMVhX1hyxYW6tqUT8Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) by PH0PR11MB5173.namprd11.prod.outlook.com (2603:10b6:510:39::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Fri, 23 Sep 2022 08:25:39 +0000 Received: from MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2]) by MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2%6]) with mapi id 15.20.5654.020; Fri, 23 Sep 2022 08:25:39 +0000 Date: Fri, 23 Sep 2022 09:25:32 +0100 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: , , Subject: Re: [PATCH v2] eal: Pointer alignment check improvements Message-ID: References: <20220921142830.71272-1-mb@smartsharesystems.com> <20220922114413.106291-1-mb@smartsharesystems.com> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220922114413.106291-1-mb@smartsharesystems.com> X-ClientProxiedBy: LO2P265CA0384.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::36) To MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR11MB1629:EE_|PH0PR11MB5173:EE_ X-MS-Office365-Filtering-Correlation-Id: e0b54ace-b829-444a-a803-08da9d3d3236 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G4VAoGFuh6tzxctynN7+HfKoCWVGDSNddMBR00O3xFMv1gnlJM8v4K/Vg/Ae+DfcYH2JrEF9/UGTd+CK45zf9wWwsfP0C+xBxHyyasnGEucPBl8Iwsd35NzOT6EHZz3K5obwt5sXglyM9bav3TRh8498N0szVYyeWwf7iTEreReBDbJf4AgB99LTAR93oP9tuEPfTMzXfRuVVvxKZbNTGwlwNDw32evJyYZmujSKiIHy16RVzqnRbKucJzYwI5W600+yhh6RArf9yiy8QggdOw+0B9RZ1WyHAhbQDTf9GvdMdYF3o6TSAnkmDJI/ydAbrFqdacQ1BQfNXSAZlJXrNDPHSeAkLy6wLyxVigmqXGvvDD9Qt4zSa8Wfxcl3W8Y7CairV/n+nCJjKnT2zLAOgEWaMB19hPQ8mccYdTEWBoURq+WX9CUp1lANi0WS2I10bfE3SGUfa1TUHgkRZaXJCjIe8FWld3z3gq+LJpTjvSlQ7Gw934miRWle/gz3Mj7IxFz1ckMJMSd4qqi2Df3Tla00mzSA6lnEK45kPBTux98+aN/SfM4HFQtQNrQfNAkYkD69sjyTmJFHJTHEuA5aJFiwjRvAIxpTUGt86RwlmFZQoY5SIDZlJtY7zsWkXmDljiRcevs9vsgPir3AMzOFMsGh+1x3JLKC5t5uhA1a29JaZeu5kHzfNKLbQryV2HDRvtNALpal3Q4rqW6NADnqVg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1629.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(366004)(39860400002)(136003)(396003)(346002)(451199015)(83380400001)(66574015)(6506007)(38100700002)(5660300002)(316002)(186003)(41300700001)(82960400001)(6916009)(44832011)(2906002)(66946007)(66556008)(66476007)(6512007)(26005)(6486002)(8936002)(4326008)(8676002)(6666004)(478600001)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?q9OKXpadcb1OYJe5qaniS7g+22L+pqQQW/bkWxiAM0pCXVDi5x+wSKYza4?= =?iso-8859-1?Q?5PUuUlYwjLh5Z7cGGBeEI0wlKVZrpr4zlUJWVHuJzJ2AiTqDcA4LLaaJBm?= =?iso-8859-1?Q?I7byAjrCHJ7EjX9oUwTRiSEH4EJI+q8wTmUxkXfdQUq61L7nnRm3Zxfe2/?= =?iso-8859-1?Q?DJw3mixoY7NWsweGSsucOejdQ1PlzpgIfR5w82VtvKk5l2p7Xn/AFCsDyh?= =?iso-8859-1?Q?NYrEln/IsgC9kSB8GAQGfvNXOIse1e064ZcVQJ2XUYjtMVuLoiPMFWTfgZ?= =?iso-8859-1?Q?bs+FrKlJmbXsra8WlQqv4eow0HCIgQ1reOWbiJbRXU1sX49YD01dzx4hvN?= =?iso-8859-1?Q?t8kXSY07pd88JVeCiXL1/qN60vLHRTvR6ykyR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q?n5awCTaoFp9lAhnDiyzYaciMExZmrhOoeO+bPrGJHlg2Q6/58J31IAky0w?= =?iso-8859-1?Q?vYj/9nL1nb4p552ovh/pjEIOuPDgGeV4TkhH3gXxaCNzWqP65SH4QGckyq?= =?iso-8859-1?Q?GUNoJCvXhcKVjHy8Bnn72B9BGxgwF3vLRnuXzRZxonmiQ/Vtlu1JXhuY+Y?= =?iso-8859-1?Q?2DagP7CXgTnuelTph4ZJBEmEy5wbTeMb52DjysRJqED1l5wTj9LK6qQEwo?= =?iso-8859-1?Q?W/eMdZeNdUrYkpXEkUk2u9idWn24NyYaeOEQb18Y3LqY4v9S5k1tdLhJB8?= =?iso-8859-1?Q?GLUXw5Gfbpw03T33W8qWcgBUtlq7JR4I61xOFFEjznj8RHHv9BaLwNigL4?= =?iso-8859-1?Q?s0OofCmmeIuLlnbCcClHCsRUaUryKt9kcWphsm+thik2RVXQFQ0tqhRA?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e0b54ace-b829-444a-a803-08da9d3d3236 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1629.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 08:25:39.0323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oQruUUwRsq8F0wMrnw9M1F6rhq83VzcZNTmEqJWDi+Y0YAQuAqph3Hp/LmRg5xTEa1Pn6cq8fvCIOAadUdavSVuvz9Jn7uUMeVNYlbVoP2w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5173 X-OriginatorOrg: intel.com 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 On Thu, Sep 22, 2022 at 01:44:13PM +0200, Morten Brørup wrote: > Checking a const pointer for alignment would emit a warning about the > const qualifier being discarded. > > No need to calculate the aligned pointer; just check the last bits of the > pointer. > > v2: > - Remove compiler attribute ((const)) from function; > it was a coding style issue. > > Signed-off-by: Morten Brørup > --- > lib/eal/include/rte_common.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h > index 2e22c1b955..ed81e0db0a 100644 > --- a/lib/eal/include/rte_common.h > +++ b/lib/eal/include/rte_common.h > @@ -404,9 +404,9 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) > * True(1) where the pointer is correctly aligned, false(0) otherwise > */ > static inline int > -rte_is_aligned(void *ptr, unsigned align) > +rte_is_aligned(const void * const __rte_restrict ptr, const unsigned int align) > { > - return RTE_PTR_ALIGN(ptr, align) == ptr; > + return ((uintptr_t)ptr & (align - 1)) == 0; > } > Acked-by: Bruce Richardson