From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0073.outbound.protection.outlook.com [104.47.32.73]) by dpdk.org (Postfix) with ESMTP id AEDB91B220 for ; Fri, 26 Jan 2018 06:05:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Sa3EvgXbzGU2x+zcY9Nzrc5ZvVhzjJ3rmJuOcnmYqck=; b=B2eBv/p+li6h1W05yjLwi+Pt3mHm9lUEc6zY0dM58+1LJBOGGHIbcuwSrw/G5g3CHqZDKp2BNFm/LZacy0RYYuOQED3VxlqZLtdw9wnPbJe9Eh6A6cuiHYAhGSdzxN7dF9bmrMPDBJ8iqALRvxQhylmDhaKvNDcc1gb7pepQOyk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by MWHPR07MB3471.namprd07.prod.outlook.com (10.164.192.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Fri, 26 Jan 2018 05:05:20 +0000 From: Pavan Nikhilesh To: thomas@monjalon.net, cristian.dumitrescu@intel.com, stephen@networkplumber.org Cc: dev@dpdk.org, Pavan Nikhilesh Date: Fri, 26 Jan 2018 10:34:49 +0530 Message-Id: <20180126050451.5953-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <1504032378-5483-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1504032378-5483-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR0101CA0012.INDPRD01.PROD.OUTLOOK.COM (10.174.220.22) To MWHPR07MB3471.namprd07.prod.outlook.com (10.164.192.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a8b8052-f7f4-4eb5-b98b-08d5647a678c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR07MB3471; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 3:CSPUfdjZt0GFJgF3WVFjv2EehTV6UoDuoCVROq9up3WE+qjyHowSrl3LABhBmn+AwuQTByVLzs3b6frFo9ZCcGiazlDRysFEczQkjLhHMhSont2PrxY0laYvBsHWA6B7KRGBbNt+aJEy8thbM38ar4AIUdn26GK2GV7ZpugLBEOxTGt8pLByO2dFj9q0nI7jez7wX/maWEKajgLa8jzukg8fABchqXh4kWeqG5xJ4J/JxiDlgeOvGY4+eoPVFwp3; 25:rTQHlr96+VC1emsAF41qkLP/wMr8qtFKk7OR+1CpKWaVLP5oGlP++F/BQb1uvu5dciorcvqDFvBifJT9MZiYfv2EQ+dWGkkIBDkYA9NlH/LPthKjCnmP9rB1UZD93En5dy1Vsip4WFQ+vomiU0nDezwG82FhlRlmF3Z9hXz6ZtCt1BTqDO7n1NUvN4bSrcvwTsCkJhNlmhuc2eJ2xbcwN4ksIfy+7f3aexylVWwX0tGMlsZXZvsIu6b+IKNfA5n4eA+D+rAvnLvScf5vCxtrqn/aFal/ralPmnGXjWRXrQ16I3nB/KU+AYFw4p2bAVQbehhAufVhF6yeEk9Ek+XBkA==; 31:IhxtCyS6aCjiB0ygjx3y5/tuyd9cZm7cHxZj+5i9FAt54chNfrW+nMtDLfReR0gTg9OdcpUkR0pJz00PaiQi0vL8OgX3mhfindv8oSKEGpArBGYXZ5c3JyK+kl6JrrH1TjACQVFXr4s0/mOKL9UfQRijufd9a23CiENb+QfwN/sZSc1A59n40VVrIVOcIs5yxg2pECxnZX/HC7O1aF39nWgfG8qLUYju742OnEB9mCo= X-MS-TrafficTypeDiagnostic: MWHPR07MB3471: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 20:zYK25eqabs0uCqDOeQVcxm/DBR+h/3v7XVP+bTNg7xsf/H3dYqgaZHS7rl2kWCuVIpkm07PQK7QAz5pfJEBj931VgoVw0fkKrNxEI5c+wA/t0X73EZnTqIQEBKXiwm50cJ64amm01Vd++HlrVFiKxYM/uiPLpiHtFpt9UCFJVG18CgS6I6kdgeSuPRCd/+TcBkWK8gHH7y+RbvZBQX9DBNBGEo85zxLeVvBdfnLtcdYeHV4rTTAtaUcQITQna6jfZ6sqQTpNEWkN/NWUv+9+UI9mkipUeyU65b7H6AVP9gNyedd2gKHSWzRJLcUyXIEYEYq2xnx/dQTlzAAGMrW0g0ktysAhywW0OtjGEA43K4ErK5hgyVEHlWB+/1qCwvOTOMLekTo6exGF1l5e4OzcAaKXbbrzqSGK3QwJjBwhkuCIUJVC7G438/Fk4BbVXVuE1Yjjwr1H7k9+zBfflhfgCZ4l890xfwsyLa7Bx2pta6jniGmpu7D2zrinCNIA3aV8kDjok0St/WjmEI3fwP5R8lZTzymJpV9gu+mDdMoOsrBP615Immjj+GG2hpzUXKf5Mq/tthYxNKJk+IEZm5cpjK/HaefQuUpb9HHjThltUDI=; 4:4PlUMQi5jSAvaN7n50Uj8a7VHy3rZiMg0Zt8n0NuaAqxu6SIbwsu7StCF7WmkmCSTSH6JEpMPBGushRR5u21ZmypSXklDhZJvFr43CBcf6jxoLW1OAeSbH3kBTIwNs4KYaw8prBMTpM9eWALK7U/tBsHE0myPzp/DjOMg/KQ5Lp3AnpWg8qJLH+k+wNCGqaxAE7zXqRbWwoahfaP5Em2W3fDndOoGYCVI0aIiTROMu+1gnh7Aq1BMr4E3XnxrFqj8Ds8y6u/gj2ADRZ7c7I4z6znUG4cTL6Oj+Do0UzaBL2i0Xw3nNP7InoursWliW2o X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(93006095)(3231023)(2400081)(944501161)(3002001)(6041288)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR07MB3471; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3471; X-Forefront-PRVS: 05641FD966 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(39850400004)(39380400002)(396003)(346002)(376002)(366004)(199004)(189003)(8676002)(5660300001)(8936002)(36756003)(50466002)(1076002)(26005)(6116002)(2906002)(81156014)(52116002)(42882006)(2950100002)(97736004)(16526019)(6666003)(68736007)(50226002)(81166006)(51416003)(76176011)(59450400001)(5009440100003)(186003)(105586002)(6512007)(3846002)(25786009)(6486002)(106356001)(16586007)(316002)(66066001)(53936002)(48376002)(386003)(7736002)(47776003)(72206003)(305945005)(6506007)(478600001)(107886003)(4326008)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3471; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3471; 23:8pvIkw000qV142ahs93mm8GFE3JzaVCRavrxyTAQ3?= =?us-ascii?Q?PtDYl+ylCzRqOKQqir0O6QJaqCWB1FcN5dic9j1bUhIAih6Hsc6pJ9BWRsOY?= =?us-ascii?Q?/MUqmadPp0nbcHU+PL6XiDt3AZHJNYWZfeqa93ofW/uLI5AiYBBiblLLyQRz?= =?us-ascii?Q?eM5xu71366E3GVB3weR9cmeBPjV5UiOvTV4yy75akpFwl72V+PZPLnOmxPMa?= =?us-ascii?Q?BmceERvi7DxkxrJd0+lELESkK6PqR84sYiW5/cxVpQg50Q+6Ujj0751vW1QJ?= =?us-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qa8KItOKjw+yC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2018 05:05:20.9012 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a8b8052-f7f4-4eb5-b98b-08d5647a678c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3471 Subject: [dpdk-dev] [PATCH v8 1/3] eal: introduce integer divide through reciprocal 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: , X-List-Received-Date: Fri, 26 Jan 2018 05:05:27 -0000 In some use cases of integer division, denominator remains constant and numerator varies. It is possible to optimize division for such specific scenarios. The librte_sched uses rte_reciprocal to optimize division so, moving it to eal/common would allow other libraries and applications to use it. Signed-off-by: Pavan Nikhilesh --- v8 Changes: - add SPDX license tags. v7 changes: - reworked u64 division (follows same flow as 32bit). - addressed review comments from v6 (Undo cosmetic changes to 32bit division) v6 changes: - remove cache alignment from rte_reciprocal_u{32/64}structures as they would be embedded in other structures. v5 changes: - fix test print strings v4 changes: - minor fix for test cases - fix u32 divisor generation v3 changes: - fix x86_32 compilation issue - fix improper licence in test v2 changes: - fix compilation issues with .map files - add test cases for correctness and performance - remove extra licence inclusion - fix coding style issues lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/common/Makefile | 1 + lib/{librte_sched => librte_eal/common/include}/rte_reciprocal.h | 0 lib/{librte_sched => librte_eal/common}/rte_reciprocal.c | 0 lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/rte_eal_version.map | 2 +- lib/librte_sched/Makefile | 2 -- lib/librte_sched/rte_sched.c | 2 +- 8 files changed, 5 insertions(+), 4 deletions(-) rename lib/{librte_sched => librte_eal/common/include}/rte_reciprocal.h (100%) rename lib/{librte_sched => librte_eal/common}/rte_reciprocal.c (100%) diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index c6940760f..028e81dd8 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -57,6 +57,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_elem.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_heap.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_keepalive.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_service.c +SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_reciprocal.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 96904dea1..ea824a3a8 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -16,6 +16,7 @@ INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h INC += rte_bitmap.h rte_vfio.h rte_hypervisor.h rte_test.h +INC += rte_reciprocal.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_sched/rte_reciprocal.h b/lib/librte_eal/common/include/rte_reciprocal.h similarity index 100% rename from lib/librte_sched/rte_reciprocal.h rename to lib/librte_eal/common/include/rte_reciprocal.h diff --git a/lib/librte_sched/rte_reciprocal.c b/lib/librte_eal/common/rte_reciprocal.c similarity index 100% rename from lib/librte_sched/rte_reciprocal.c rename to lib/librte_eal/common/rte_reciprocal.c diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 7bf278f3b..e50b73a69 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -64,6 +64,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_elem.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_heap.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_keepalive.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_service.c +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_reciprocal.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 7088b7230..730966407 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -206,7 +206,7 @@ DPDK_18.02 { rte_hypervisor_get; rte_hypervisor_get_name; rte_vfio_clear_group; - + rte_reciprocal_value; } DPDK_17.11; EXPERIMENTAL { diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile index 73c9d1a37..55d9c6989 100644 --- a/lib/librte_sched/Makefile +++ b/lib/librte_sched/Makefile @@ -26,10 +26,8 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_sched.c rte_red.c rte_approx.c -SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_reciprocal.c # install includes SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_sched_common.h rte_red.h rte_approx.h -SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h include $(RTE_SDK)/mk/rte.lib.mk diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index ad2f7c6d5..634486c80 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -14,11 +14,11 @@ #include #include #include +#include #include "rte_sched.h" #include "rte_sched_common.h" #include "rte_approx.h" -#include "rte_reciprocal.h" #ifdef __INTEL_COMPILER #pragma warning(disable:2259) /* conversion may lose significant bits */ -- 2.14.1