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 1FEDCA046B for ; Fri, 28 Jun 2019 06:35:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D5CFC4CA6; Fri, 28 Jun 2019 06:35:00 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id A5C9E4C93 for ; Fri, 28 Jun 2019 06:34:58 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id k13so1997245pgq.9 for ; Thu, 27 Jun 2019 21:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P6/UpzHDZo1vz7oE3pCYbCLE19+MSn2A6Giwlk0rZXg=; b=DqRKK+pazAMGh+Es6GLPnfIWgAlbwA+x+fUCQ+MQ3iB89oLkI6yx4x57xxxLOfp5NQ 8jVUFB15rIpF09nCoHPRy+X9rH4G7IsFNC/dzRPR3qgVl1iROwUKGgkDRMmqT1dFqbrZ stYf0atKzUU7nwan/6EMMzCNLPvJ7KKk3bAzdVz1AUGlDM3aJjEqjXMfN8CpGdztSbeK u2rsML8vo9w5nLoZ3VU+jenVf7ZFGuE7t865cF4+nteHr1CsW2SGraJi4UofLV3nfEN6 Adu/FSeqRv+NtvaYEQ0zeVe8wnxfSfciMv0nWYzS1ZRUhGcpGtAJ9NmjezBJu+urywj7 NiDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P6/UpzHDZo1vz7oE3pCYbCLE19+MSn2A6Giwlk0rZXg=; b=kwHWPSEwY5P3pe/VqTCgu6yVcvvQ4f7UOxoCGGagcGzD5dJu6F5dx92a8Zuenc5792 TbqNtzyFjXX+3dHVwBqduICT8GHDgpni+R91quw/n6zZ8mWp8D8lF4OivgUcG9497BjK VJM7LZJl5D8JSWAsWxSz5ATq3q0X9kYG6+kGaQSODSG+o6FhNgVdCLw10ymy9OuDp6xu b79keRp1Ai1tM2bVzdf+X3nFKTiOOKqzV0Qvo4KPHyAHFSzS3dNV7WNkQWnKzLhw/eXX 4WKnNiUctD8C1RudYKgqvYRVHksTkRYgdgVm30rL6vAjIDBnGt9BboWuyF/27zdZCK2z InEA== X-Gm-Message-State: APjAAAVXyodnOa/MpGXEQzdlHgyIbhpOpMPwsEPIn51SsOiu1VK1gU8e 8YMhRpVndLNnqsXd7baWA0PnKg== X-Google-Smtp-Source: APXvYqzvEq7ZQAa5gXPeZ9CmYxA/Jz+YviHylINAOVXwAfIedCF6eirHnRhCIb+SjEHl047X0EUIQg== X-Received: by 2002:a17:90a:e397:: with SMTP id b23mr10457626pjz.140.1561696497684; Thu, 27 Jun 2019 21:34:57 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id w22sm649325pfi.175.2019.06.27.21.34.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 21:34:57 -0700 (PDT) Date: Thu, 27 Jun 2019 21:34:50 -0700 From: Stephen Hemminger To: "Ruifeng Wang (Arm Technology China)" Cc: "bruce.richardson@intel.com" , "vladimir.medvedkin@intel.com" , "dev@dpdk.org" , Honnappa Nagarahalli , "Gavin Hu (Arm Technology China)" , nd Message-ID: <20190627213450.30082af6@hermes.lan> In-Reply-To: References: <20190627093751.7746-1-ruifeng.wang@arm.com> <20190627082451.56719392@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 1/3] lib/lpm: not inline unnecessary functions 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 Fri, 28 Jun 2019 02:44:54 +0000 "Ruifeng Wang (Arm Technology China)" wrote: > > > > > Tests showed that the function inlining caused performance drop on > > > some x86 platforms with the memory ordering patches applied. > > > By force no-inline functions, the performance was better than before > > > on x86 and no impact to arm64 platforms. > > > > > > Suggested-by: Medvedkin Vladimir > > > Signed-off-by: Ruifeng Wang > > > Reviewed-by: Gavin Hu > > { > > > > Do you actually need to force noinline or is just taking of inline enough? > > In general, letting compiler decide is often best practice. > > The force noinline is an optimization for x86 platforms to keep rte_lpm_add() API > performance with memory ordering applied. I don't think you answered my question. What does a recent version of GCC do if you drop the inline. Actually all the functions in rte_lpm should drop inline. diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 6b7b28a2e431..ffe07e980864 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -399,7 +399,7 @@ MAP_STATIC_SYMBOL(void rte_lpm_free(struct rte_lpm *lpm), * are stored in the rule table from 0 - 31. * NOTE: Valid range for depth parameter is 1 .. 32 inclusive. */ -static inline int32_t +static int32_t rule_add_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth, uint8_t next_hop) { @@ -471,7 +471,7 @@ rule_add_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth, return rule_index; } -static inline int32_t +static int32_t rule_add_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, uint32_t next_hop) { @@ -547,7 +547,7 @@ rule_add_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, * Delete a rule from the rule table. * NOTE: Valid range for depth parameter is 1 .. 32 inclusive. */ -static inline void +static void rule_delete_v20(struct rte_lpm_v20 *lpm, int32_t rule_index, uint8_t depth) { int i; @@ -570,7 +570,7 @@ rule_delete_v20(struct rte_lpm_v20 *lpm, int32_t rule_index, uint8_t depth) lpm->rule_info[depth - 1].used_rules--; } -static inline void +static void rule_delete_v1604(struct rte_lpm *lpm, int32_t rule_index, uint8_t depth) { int i; @@ -597,7 +597,7 @@ rule_delete_v1604(struct rte_lpm *lpm, int32_t rule_index, uint8_t depth) * Finds a rule in rule table. * NOTE: Valid range for depth parameter is 1 .. 32 inclusive. */ -static inline int32_t +static int32_t rule_find_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth) { uint32_t rule_gindex, last_rule, rule_index; @@ -618,7 +618,7 @@ rule_find_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth) return -EINVAL; } -static inline int32_t +static int32_t rule_find_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth) { uint32_t rule_gindex, last_rule, rule_index; @@ -642,7 +642,7 @@ rule_find_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth) /* * Find, clean and allocate a tbl8. */ -static inline int32_t +static int32_t tbl8_alloc_v20(struct rte_lpm_tbl_entry_v20 *tbl8) { uint32_t group_idx; /* tbl8 group index. */ @@ -669,7 +669,7 @@ tbl8_alloc_v20(struct rte_lpm_tbl_entry_v20 *tbl8) return -ENOSPC; } -static inline int32_t +static int32_t tbl8_alloc_v1604(struct rte_lpm_tbl_entry *tbl8, uint32_t number_tbl8s) { uint32_t group_idx; /* tbl8 group index. */ @@ -709,7 +709,7 @@ tbl8_free_v1604(struct rte_lpm_tbl_entry *tbl8, uint32_t tbl8_group_start) tbl8[tbl8_group_start].valid_group = INVALID; } -static inline int32_t +static int32_t add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, uint8_t next_hop) { @@ -777,7 +777,7 @@ add_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, return 0; } -static inline int32_t +static int32_t add_depth_small_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t next_hop) { @@ -846,7 +846,7 @@ add_depth_small_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, return 0; } -static inline int32_t +static int32_t add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth, uint8_t next_hop) { @@ -971,7 +971,7 @@ add_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth, return 0; } -static inline int32_t +static int32_t add_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, uint32_t next_hop) { @@ -1244,7 +1244,7 @@ BIND_DEFAULT_SYMBOL(rte_lpm_is_rule_present, _v1604, 16.04); MAP_STATIC_SYMBOL(int rte_lpm_is_rule_present(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t *next_hop), rte_lpm_is_rule_present_v1604); -static inline int32_t +static int32_t find_previous_rule_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, uint8_t *sub_rule_depth) { @@ -1266,7 +1266,7 @@ find_previous_rule_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, return -1; } -static inline int32_t +static int32_t find_previous_rule_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint8_t *sub_rule_depth) { @@ -1288,7 +1288,7 @@ find_previous_rule_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, return -1; } -static inline int32_t +static int32_t delete_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth, int32_t sub_rule_index, uint8_t sub_rule_depth) { @@ -1381,7 +1381,7 @@ delete_depth_small_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, return 0; } -static inline int32_t +static int32_t delete_depth_small_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, int32_t sub_rule_index, uint8_t sub_rule_depth) { @@ -1483,7 +1483,7 @@ delete_depth_small_v1604(struct rte_lpm *lpm, uint32_t ip_masked, * Return of value > -1 means tbl8 is in use but has all the same values and * thus can be recycled */ -static inline int32_t +static int32_t tbl8_recycle_check_v20(struct rte_lpm_tbl_entry_v20 *tbl8, uint32_t tbl8_group_start) { @@ -1530,7 +1530,7 @@ tbl8_recycle_check_v20(struct rte_lpm_tbl_entry_v20 *tbl8, return -EINVAL; } -static inline int32_t +static int32_t tbl8_recycle_check_v1604(struct rte_lpm_tbl_entry *tbl8, uint32_t tbl8_group_start) { @@ -1577,7 +1577,7 @@ tbl8_recycle_check_v1604(struct rte_lpm_tbl_entry *tbl8, return -EINVAL; } -static inline int32_t +static int32_t delete_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, uint8_t depth, int32_t sub_rule_index, uint8_t sub_rule_depth) { @@ -1655,7 +1655,7 @@ delete_depth_big_v20(struct rte_lpm_v20 *lpm, uint32_t ip_masked, return 0; } -static inline int32_t +static int32_t delete_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, int32_t sub_rule_index, uint8_t sub_rule_depth) {