From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0071.outbound.protection.outlook.com [104.47.41.71]) by dpdk.org (Postfix) with ESMTP id 64B83378E for ; Tue, 5 Sep 2017 12:49:16 +0200 (CEST) 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=jpsfyXh2CMvJbI/T94GTIlwCDdUIdUq3YqzIJKddKa0=; b=ZaTkTo0ND3Q5MJgsckxm7tdG2P5hCJR1sCvGh3NlHj26RDgDGYSRA70Xt+PfoRvwJp0sOLfc5E423pHL/862w+gO8Zlznp9DASZZ9fq5GOmmdrA8ZL0Y+/yXFCPWpuvoQxmn7BGRiEpk2jDiqLR4yAJg/s8qo8F1d7ItZFGvGCE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Tue, 5 Sep 2017 10:49:13 +0000 From: Pavan Nikhilesh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, stephen@networkplumber.org, Pavan Bhagavatula Date: Tue, 5 Sep 2017 16:18:51 +0530 Message-Id: <1504608532-18598-2-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504608532-18598-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1504608532-18598-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR15CA0070.namprd15.prod.outlook.com (10.174.254.32) To CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b6d49ed-667f-4342-fdd6-08d4f44bbfee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 3:kp+lp5mHDe3KMavMFvAN2xv0r6Ymvgxy6DdIpqrWgapn+0zqj1l5klSrM1Eb6rqKSx4E5Wa7za+OYqUPHM62bSBioxkFw782whhgg/xJSJWc1VmLVmdGkRAse09q54MiPCIKzgKO5BQpHlL+32zb7r1PVUOe5bqvEJ7dOhxsBdI/16DePonz9obpUtl59Gvn2vg3WWzg+cikbZsLL7P9jvjsTIZDvPR7wd+akQ7a09pgcXs3WxheUA6AZUPmntIW; 25:UFJfKlfgXeSOyfQaoE+KhpTLhkOuvxc23ZfewkxppD08A5NaKk6hIiOAPjgPcQy4a0SI3kP8BUUme12eYiB8tcyh5R9dXk9DnM/C2f6gf6hKP526OAhGkFcy8pkKfQ45ie+42uOLRKPgOXGq0MZm3P5QMyBSN3I5iqxJEAqvEpAP85YoLzVTW74+N+uQEqLFPwld5FHSoLf6t3Kbtwn/pEI3j7+nOAow7zd/Jad5JB1Zbm9ziM5E3OZFRsaDz2rKnGlk0MM4tHvR9ZXq7PZHvrVo6j/C4xJe59haEYraedTng+XpgXXd2D2R56kCn6cl4b3Cq32M8AQItty7Ks8sbQ==; 31:5TexQFP2IeVQ4jFCCx9fnaHRDc33NqrvaF1wrfCewpy5H9SQ2FdmgPSn7qtW/N6VMYd16NRCbgOVnztPcSSrZZAfdNOeW4ISj83KadhMopj5jf4QbIitHmM4JsbYcBolLyPAOAoFQc9qcTWec6x1+5GXrZ6gHAlaxY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exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(93006095)(100000703101)(100105400095)(3002001)(6041248)(20161123555025)(20161123560025)(20161123558100)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3461; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3461; X-Forefront-PRVS: 0421BF7135 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(50466002)(72206003)(69596002)(48376002)(305945005)(66066001)(97736004)(478600001)(107886003)(4326008)(110136004)(8936002)(53936002)(6512007)(6306002)(81156014)(5660300001)(8676002)(68736007)(7736002)(25786009)(966005)(81166006)(36756003)(50226002)(42186005)(5003940100001)(105586002)(2361001)(33646002)(101416001)(53416004)(6116002)(189998001)(3846002)(2950100002)(6916009)(42882006)(2906002)(5009440100003)(50986999)(47776003)(6486002)(76176999)(6666003)(6506006)(106356001)(2351001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3461; H:PBHAGAVATULA-LT.caveonetworks.com; 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; CY4PR07MB3461; 23:kGSEzB3bouCHcUqMmeNqC2f1aW2DvnnWp5oAwWBe+?= =?us-ascii?Q?5eih8fEJ136zmmNPpfbEjGLxiloaj+W/GCMqLtaMkioFZ+P+Ewiy8ufqhwI9?= =?us-ascii?Q?X42I0R/ca8azh9cuEotZwmcaNIqPa6FAi6Zpa3QQUoo176uRt07tW3ty+1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nXB+LZogRg7g0o43Cy974Vnl/mN68SFSLWRAqLRKF3gRmOEQebdiqbhoIGTd08VWuV0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2017 10:49:13.0292 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3461 Subject: [dpdk-dev] [PATCH v4 2/3] eal: add u64 bit variant for 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: Tue, 05 Sep 2017 10:49:17 -0000 From: Pavan Bhagavatula Currently, rte_reciprocal only supports unsigned 32bit divisors. This commit adds support for unsigned 64bit divisors. Rename unsigned 32bit specific functions appropriately and update librte_sched accordingly. Signed-off-by: Pavan Nikhilesh --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 3 +- lib/librte_eal/common/include/rte_reciprocal.h | 111 +++++++++++++++++++++-- lib/librte_eal/common/rte_reciprocal.c | 116 +++++++++++++++++++++--- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +- lib/librte_sched/Makefile | 4 +- lib/librte_sched/rte_sched.c | 9 +- 6 files changed, 220 insertions(+), 26 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 90d7258..59a85bb 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -241,6 +241,7 @@ EXPERIMENTAL { DPDK_17.11 { global: - rte_reciprocal_value; + rte_reciprocal_value_u32; + rte_reciprocal_value_u64; } DPDK_17.08; diff --git a/lib/librte_eal/common/include/rte_reciprocal.h b/lib/librte_eal/common/include/rte_reciprocal.h index b6d752f..801d1c8 100644 --- a/lib/librte_eal/common/include/rte_reciprocal.h +++ b/lib/librte_eal/common/include/rte_reciprocal.h @@ -22,22 +22,117 @@ #ifndef _RTE_RECIPROCAL_H_ #define _RTE_RECIPROCAL_H_ -#include +#include -struct rte_reciprocal { +/** + * Unsigned 32-bit divisor structure. + */ +struct rte_reciprocal_u32 { uint32_t m; uint8_t sh1, sh2; -}; +} __rte_cache_aligned; + +/** + * Unsigned 64-bit divisor structure. + */ +struct rte_reciprocal_u64 { + uint64_t m; + uint8_t sh1; +} __rte_cache_aligned; +/** + * Divide given unsigned 32-bit integer with pre calculated divisor. + * + * @param a + * The 32-bit dividend. + * @param R + * The pointer to pre calculated divisor reciprocal structure. + * + * @return + * The result of the division + */ static inline uint32_t -rte_reciprocal_divide(uint32_t a, struct rte_reciprocal R) +rte_reciprocal_divide_u32(uint32_t a, struct rte_reciprocal_u32 *R) +{ + uint32_t t = (((uint64_t)a * R->m) >> 32); + + return (t + ((a - t) >> R->sh1)) >> R->sh2; +} + +static inline uint64_t +mullhi_u64(uint64_t x, uint64_t y) +{ +#ifdef __SIZEOF_INT128__ + __uint128_t xl = x; + __uint128_t rl = xl * y; + + return (rl >> 64); +#else + uint64_t u0, u1, v0, v1, k, t; + uint64_t w1, w2; + uint64_t whi; + + u1 = x >> 32; u0 = x & 0xFFFFFFFF; + v1 = y >> 32; v0 = y & 0xFFFFFFFF; + + t = u0*v0; + k = t >> 32; + + t = u1*v0 + k; + w1 = t & 0xFFFFFFFF; + w2 = t >> 32; + + t = u0*v1 + w1; + k = t >> 32; + + whi = u1*v1 + w2 + k; + + return whi; +#endif +} + +/** + * Divide given unsigned 64-bit integer with pre calculated divisor. + * + * @param a + * The 64-bit dividend. + * @param R + * The pointer to pre calculated divisor reciprocal structure. + * + * @return + * The result of the division + */ +static inline uint64_t +rte_reciprocal_divide_u64(uint64_t a, struct rte_reciprocal_u64 *R) { - uint32_t t = (uint32_t)(((uint64_t)a * R.m) >> 32); + uint64_t q = mullhi_u64(R->m, a); + uint64_t t = ((a - q) >> 1) + q; - return (t + ((a - t) >> R.sh1)) >> R.sh2; + return t >> R->sh1; } -struct rte_reciprocal -rte_reciprocal_value(uint32_t d); +/** + * Generate pre calculated divisor structure. + * + * @param d + * The unsigned 32-bit divisor. + * + * @return + * Divisor structure. + */ +struct rte_reciprocal_u32 +rte_reciprocal_value_u32(uint32_t d); + +/** + * Generate pre calculated divisor structure. + * + * @param d + * The unsigned 64-bit divisor. + * + * @return + * Divisor structure. + */ +struct rte_reciprocal_u64 +rte_reciprocal_value_u64(uint64_t d); #endif /* _RTE_RECIPROCAL_H_ */ diff --git a/lib/librte_eal/common/rte_reciprocal.c b/lib/librte_eal/common/rte_reciprocal.c index 7ab99b4..2024e62 100644 --- a/lib/librte_eal/common/rte_reciprocal.c +++ b/lib/librte_eal/common/rte_reciprocal.c @@ -31,18 +31,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include - -#include - -#include "rte_reciprocal.h" +#include /* find largest set bit. * portable and slow but does not matter for this usage. */ static inline int -fls(uint32_t x) +fls_u32(uint32_t x) { int b; @@ -54,14 +49,14 @@ fls(uint32_t x) return 0; } -struct rte_reciprocal -rte_reciprocal_value(uint32_t d) +struct rte_reciprocal_u32 +rte_reciprocal_value_u32(uint32_t d) { - struct rte_reciprocal R; + struct rte_reciprocal_u32 R; uint64_t m; int l; - l = fls(d - 1); + l = fls_u32(d - 1); m = ((1ULL << 32) * ((1ULL << l) - d)); m /= d; @@ -72,3 +67,102 @@ rte_reciprocal_value(uint32_t d) return R; } + +/* Code taken from Hacker's Delight: + * http://www.hackersdelight.org/HDcode/divlu.c. + * License permits inclusion here per: + * http://www.hackersdelight.org/permissions.htm + */ +static inline uint64_t +divide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) +{ + const uint64_t b = (1ULL << 32); /* Number base (16 bits). */ + uint64_t un1, un0, /* Norm. dividend LSD's. */ + vn1, vn0, /* Norm. divisor digits. */ + q1, q0, /* Quotient digits. */ + un64, un21, un10, /* Dividend digit pairs. */ + rhat; /* A remainder. */ + int s; /* Shift amount for norm. */ + + /* If overflow, set rem. to an impossible value. */ + if (u1 >= v) { + if (r != NULL) + *r = (uint64_t) -1; + return (uint64_t) -1; + } + + /* Count leading zeros. */ + s = __builtin_clzll(v); + if (s > 0) { + v = v << s; + un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31)); + un10 = u0 << s; + } else { + + un64 = u1 | u0; + un10 = u0; + } + + vn1 = v >> 32; + vn0 = v & 0xFFFFFFFF; + + un1 = un10 >> 32; + un0 = un10 & 0xFFFFFFFF; + + q1 = un64/vn1; + rhat = un64 - q1*vn1; +again1: + if (q1 >= b || q1*vn0 > b*rhat + un1) { + q1 = q1 - 1; + rhat = rhat + vn1; + if (rhat < b) + goto again1; + } + + un21 = un64*b + un1 - q1*v; + + q0 = un21/vn1; + rhat = un21 - q0*vn1; +again2: + if (q0 >= b || q0*vn0 > b*rhat + un0) { + q0 = q0 - 1; + rhat = rhat + vn1; + if (rhat < b) + goto again2; + } + + if (r != NULL) + *r = (un21*b + un0 - q0*v) >> s; + return q1*b + q0; +} + +struct rte_reciprocal_u64 +rte_reciprocal_value_u64(uint64_t d) +{ + struct rte_reciprocal_u64 R; + + const uint32_t fld = 63 - __builtin_clzll(d); + + if ((d & (d - 1)) == 0) { + R.m = 0; + R.sh1 = (fld - 1) | 0x40; + } else { + uint64_t rem; + uint64_t multiplier; + uint8_t more; + + multiplier = divide_128_div_64_to_64(1ULL << fld, 0, d, &rem); + multiplier += multiplier; + + const uint64_t twice_rem = rem + rem; + if (twice_rem >= d || twice_rem < rem) + multiplier += 1; + more = fld; + R.m = 1 + multiplier; + R.sh1 = more | 0x40; + } + + R.sh1 &= 0x3F; + + return R; +} diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 2070cba..2671627 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -246,6 +246,7 @@ EXPERIMENTAL { DPDK_17.11 { global: - rte_reciprocal_value; + rte_reciprocal_value_u32; + rte_reciprocal_value_u64; } DPDK_17.08; diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile index 569656b..a2fd6f3 100644 --- a/lib/librte_sched/Makefile +++ b/lib/librte_sched/Makefile @@ -54,6 +54,8 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_sched.c rte_red.c rte_approx.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched_common.h rte_red.h rte_approx.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_sched_common.h rte_red.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_approx.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 3b8ccaa..7bb6d51 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -228,7 +228,7 @@ struct rte_sched_port { uint64_t time_cpu_cycles; /* Current CPU time measured in CPU cyles */ uint64_t time_cpu_bytes; /* Current CPU time measured in bytes */ uint64_t time; /* Current NIC TX time measured in bytes */ - struct rte_reciprocal inv_cycles_per_byte; /* CPU cycles per byte */ + struct rte_reciprocal_u32 inv_cycles_per_byte; /* CPU cycles per byte */ /* Scheduling loop detection */ uint32_t pipe_loop; @@ -677,7 +677,7 @@ rte_sched_port_config(struct rte_sched_port_params *params) cycles_per_byte = (rte_get_tsc_hz() << RTE_SCHED_TIME_SHIFT) / params->rate; - port->inv_cycles_per_byte = rte_reciprocal_value(cycles_per_byte); + port->inv_cycles_per_byte = rte_reciprocal_value_u32(cycles_per_byte); /* Scheduling loop detection */ port->pipe_loop = RTE_SCHED_PIPE_INVALID; @@ -2147,8 +2147,9 @@ rte_sched_port_time_resync(struct rte_sched_port *port) uint64_t bytes_diff; /* Compute elapsed time in bytes */ - bytes_diff = rte_reciprocal_divide(cycles_diff << RTE_SCHED_TIME_SHIFT, - port->inv_cycles_per_byte); + bytes_diff = rte_reciprocal_divide_u32( + cycles_diff << RTE_SCHED_TIME_SHIFT, + &port->inv_cycles_per_byte); /* Advance port time */ port->time_cpu_cycles = cycles; -- 2.7.4