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 3C1B4A09E8 for ; Tue, 8 Dec 2020 13:07:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 13D6AA3; Tue, 8 Dec 2020 13:07:04 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 74EB4A3 for ; Tue, 8 Dec 2020 13:07:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607429220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=97G/mLmHVKG5QE/O2thRfnJv3kSfdaZELa3SY700MHs=; b=AP0gMJHUYyN9TulNp3hT677+RQuZ1AirkxNrkxD7YHJjNJ27GAgBPW+Oagk4l/5jNrCF9v VGDn3RZ0WXQ9AASmx8Gx9ZQ85knZxqfKs/5poXYCWhQwr0nitElUGhqOf7xySCByIBNJ22 PeGqNDhhGHqfIABqb0FpR0Hmj7aZeBE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-P80gsHg3MhirZS8q_ga2Zg-1; Tue, 08 Dec 2020 07:06:56 -0500 X-MC-Unique: P80gsHg3MhirZS8q_ga2Zg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFE8A612AA; Tue, 8 Dec 2020 12:06:55 +0000 (UTC) Received: from [10.36.114.230] (ovpn-114-230.ams2.redhat.com [10.36.114.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 938E360BF1; Tue, 8 Dec 2020 12:06:54 +0000 (UTC) To: Viacheslav Ovsiienko , stable@dpdk.org Cc: mohsinshaikh@niometrics.com References: <1607427254-11610-1-git-send-email-viacheslavo@nvidia.com> From: Kevin Traynor Message-ID: <9994347b-c239-8783-48ff-07d3185ebdc5@redhat.com> Date: Tue, 8 Dec 2020 12:06:53 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <1607427254-11610-1-git-send-email-viacheslavo@nvidia.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-stable] [PATCH] [18.11] net/mlx5: use open/read/close for ib stats query 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" On 08/12/2020 11:34, Viacheslav Ovsiienko wrote: > From: Mohsin Shaikh > > From: Mohsin Shaikh > Hi Slava, your patches are putting in duplicate From: tags ^ and missing upstream commit ids. Please add upstream commit ids so I don't have to find it for every patch. i.e. [ 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 > We can drop the stable tag as it's targetted to LTS branch anyway > Signed-off-by: Mohsin Shaikh > Reviewed-by: Alexander Kozyrev > Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_stats.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c > index 6906dc8..0b1fe3d 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,19 +141,24 @@ > static inline void > mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t *stat) > { > - FILE *file; > + int fd; > + > MKSTR(path, "%s/ports/1/hw_counters/%s", > priv->ibdev_path, > ctr_name); > > - file = fopen(path, "rb"); > - if (file) { > - int n = fscanf(file, "%" SCNu64, stat); > + fd = open(path, O_RDONLY); > + if (fd != -1) { > + char buf[21] = {'\0'}; > + ssize_t n = read(fd, buf, sizeof(buf)); > > - fclose(file); > - if (n != 1) > - stat = 0; > + close(fd); > + if (n != -1) { > + *stat = strtoull(buf, NULL, 10); > + return; > + } > } > + *stat = 0; > } > > /** >