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 510E0A0093 for ; Tue, 19 May 2020 15:10:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 472F21D6C2; Tue, 19 May 2020 15:10:13 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 659DA1D6A4 for ; Tue, 19 May 2020 15:10:11 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id l11so15917222wru.0 for ; Tue, 19 May 2020 06:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fJobObFv5OzsK0pmDkXdIsDPemVzD3CNhLkLKNaLgXI=; b=rwbplubxamaT3bSKyqOQLWUYzji+a1rVsmUVMUW2sTr1ZIHhwzBK5ibr6W7dJA1cho wde1688IM7f8YnQ49ldimIz6cdwonh4S9CRqiqxpWXnKqGj95Wj7OOJiU1KGPQbsEnSp j6HqRNAPo9wWl3Nv7RFpEsvxlB6dS3JaJ7Q7BAcbmJLy0ljY+b6lVYmHb4yMX9oGYJHS 3fMLbUE9pws+jCUzLtvLZwQAXr9ABdPKGFc7M7dV/ihDES9VJR8MzSuQADaAikzZS020 5ibWzJQuYJUWqal4M/ihpkOO8gK3jqCI0kaa+CcWrgQS1abbw54ht22yxNzxU6xHgdds RHJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fJobObFv5OzsK0pmDkXdIsDPemVzD3CNhLkLKNaLgXI=; b=mIDMPyM0DLPD9azp/amMd/1/puh+LT2m9fcviKloGwVGw3Ku1cerIyeX523/HkUebc 92K4Z/j5AXM26DtyGrMp5e9u+bVxrMqt2XZKpAm74CRKE7eKoVabbCzZQh4+/Q64IO4o 5D5dE7GFaMiKnK4F/yXH6J83IkE+Gil/kyaqYKd+QLOA4vCAAzV/6FrZv+R9nSZmjztR zV3c0w15mJPEbuNiHZVhz5lenNbrCKJjmFuL/U7Tzc9DL/dRB+hRgeqXu+th4CjTWlT7 AlkN1wSiAY7OqAJO1KsAPPaTsJyqSSA09/nXHhxNRuWroWNBQUg0spkYR/BEE3ZgmM1K g29Q== X-Gm-Message-State: AOAM531Vg7BAn2l9LNCgQD+ftw+TuXGpcWOH40d4PtXQzBmf6ElJkIdG /ghJWE6jVmPLPxxOnjNrGIkfUgc/qY7RACbA X-Google-Smtp-Source: ABdhPJy+MBW9Zdv4jCYAuV6gVAdfWnjuZZiC1nQJLMkNy2BPBpIWoMBkCpNJNmqvxiJcriaVAWG35A== X-Received: by 2002:adf:d089:: with SMTP id y9mr25431881wrh.26.1589893811144; Tue, 19 May 2020 06:10:11 -0700 (PDT) Received: from localhost ([2a01:4b00:f419:6f00:7a8e:ed70:5c52:ea3]) by smtp.gmail.com with ESMTPSA id b19sm4231971wmd.26.2020.05.19.06.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:10:10 -0700 (PDT) From: luca.boccassi@gmail.com To: Mohsin Shaikh Cc: Alexander Kozyrev , Viacheslav Ovsiienko , dpdk stable Date: Tue, 19 May 2020 14:03:36 +0100 Message-Id: <20200519130549.112823-81-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: use open/read/close for ib stats query' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From fd2f1973f408d51e47a1a3cbd38f0e661b15b59d Mon Sep 17 00:00:00 2001 From: Mohsin Shaikh Date: Fri, 10 Apr 2020 04:37:06 +0800 Subject: [PATCH] net/mlx5: use open/read/close for ib stats query [ upstream commit 00437823cb80b8fa87dbe61becc07bd42ee98549 ] fgets(3)/fread(3)/fscanf(3) etc. use mmap(2)/munmap(2) which leads to TLB shutdown interrupts to all DPDK app cores including RX cores. This can cause packet drops. Use read(2)/write(2) instead. Bugzilla ID: 440 Signed-off-by: Mohsin Shaikh Reviewed-by: Alexander Kozyrev Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_stats.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index d60a633e15..636fc80c7c 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -3,11 +3,13 @@ * Copyright 2015 Mellanox Technologies, Ltd */ +#include #include #include #include #include #include +#include #include #include @@ -139,20 +141,23 @@ static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init); static inline int mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t *stat) { - FILE *file; + int fd; + if (priv->sh) { MKSTR(path, "%s/ports/%d/hw_counters/%s", priv->sh->ibdev_path, priv->ibv_port, ctr_name); + fd = open(path, O_RDONLY); + if (fd != -1) { + char buf[21] = {'\0'}; + ssize_t n = read(fd, buf, sizeof(buf)); - file = fopen(path, "rb"); - if (file) { - int n = fscanf(file, "%" SCNu64, stat); - - fclose(file); - if (n == 1) + close(fd); + if (n != -1) { + *stat = strtoull(buf, NULL, 10); return 0; + } } } *stat = 0; -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:47.755394437 +0100 +++ 0081-net-mlx5-use-open-read-close-for-ib-stats-query.patch 2020-05-19 14:04:44.248648953 +0100 @@ -1,14 +1,15 @@ -From 00437823cb80b8fa87dbe61becc07bd42ee98549 Mon Sep 17 00:00:00 2001 +From fd2f1973f408d51e47a1a3cbd38f0e661b15b59d Mon Sep 17 00:00:00 2001 From: Mohsin Shaikh Date: Fri, 10 Apr 2020 04:37:06 +0800 Subject: [PATCH] net/mlx5: use open/read/close for ib stats query +[ upstream commit 00437823cb80b8fa87dbe61becc07bd42ee98549 ] + fgets(3)/fread(3)/fscanf(3) etc. use mmap(2)/munmap(2) which leads to TLB shutdown interrupts to all DPDK app cores including RX cores. This can cause packet drops. Use read(2)/write(2) instead. Bugzilla ID: 440 -Cc: stable@dpdk.org Signed-off-by: Mohsin Shaikh Reviewed-by: Alexander Kozyrev @@ -18,7 +19,7 @@ 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c -index 5bc6fa6aa1..b4ca6922a4 100644 +index d60a633e15..636fc80c7c 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -3,11 +3,13 @@ @@ -35,7 +36,7 @@ #include #include -@@ -142,20 +144,23 @@ static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init); +@@ -139,20 +141,23 @@ static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init); static inline int mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t *stat) {