net/mlx5: Read of "out_of_buffer" using fopen/fscanf/fclose causing TLB shootdowns due to mmap/munmap
A message that is not in the archive (sent off-list or not yet received): [email protected]/
A message that is not in the archive (sent off-list or not yet received): [email protected]/
Hi Alexander,
Thank you for your quick response. Please find attached the patch for bug 440.
- Mohsin
Quoted 24 lines · On 9 Apr 2020, at 1:07 AM, [email protected] wrote:
https://bugs.dpdk.org/show_bug.cgi?id=440
Alexander Kozyrev ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------Ever confirmed|0 |1 Status|UNCONFIRMED |CONFIRMED CC| |[email protected]--- Comment #1 from Alexander Kozyrev ([email protected]) --- Hi Mohsin, thank you for the problem description and especially for the patch. Would you mind sending this patch to DPDK mailing list so we can integrate it? The patch looks really good to me. The only small thing I would like to change. Could you please use SCNu64 macro instead of "%lu" in the sscanf function?
sscanf(buf, "%" SCNu64, stat);Signature · 2 lines
You are receiving this mail because: You reported the bug.
Resending.
============================================================
commit 89681d3655f27d758537ae01a02d500deee1acd6
Author: Mohsin Shaikh <[email protected]> Date: Thu Apr 9 12:19:45 2020 +0800
net/mlx5: Use open/read/close for reading ib stat
fgets(3)/fread(3)/fscanf(3) etc. use mmap(2)/munmap(2) which leads to TLB shootdown interrupts to all dpdk app cores including RX cores. This can cause packet drops. Use read(2)/write(2) instead.
The details can be found here:
https://bugs.dpdk.org/show_bug.cgi?id=440
Bugzilla ID: 440
drivers/net/mlx5/mlx5_stats.c +11 -7
@@ -8,6 +8,8 @@#include <linux/ethtool.h> #include <stdint.h> #include <stdio.h> +#include <unistd.h> +#include <fcntl.h> #include <rte_ethdev_driver.h> #include <rte_common.h>
@@ -139,20 +141,22 @@static inline void 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); - file =fopen (path,"rb" ); -if (file) { -int n =fscanf (file,"%" SCNu64, stat); - -fclose (file); -if (n ==1 ) + fd =open (path,O_RDONLY ); +if (fd !=-1 ) { +char buf[32 ]; +ssize_t n =read (fd, buf,sizeof (buf)); +close (fd); +if (n !=-1 ) { +sscanf (buf,"%" SCNu64, stat);return ; + } } } *stat =0 ;
============================================================
Thanks,
Mohsin
Quoted 33 lines · Mohsin Shaikh
Hi Alexander,
Thank you for your quick response. Please find attached the patch for bug 440.
- Mohsin
Quoted 22 lines · On 9 Apr 2020, at 1:07 AM, [email protected] wrote:
https://bugs.dpdk.org/show_bug.cgi?id=440
Alexander Kozyrev ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------Ever confirmed|0 |1 Status|UNCONFIRMED |CONFIRMED CC| |[email protected]--- Comment #1 from Alexander Kozyrev ([email protected]) --- Hi Mohsin, thank you for the problem description and especially for the patch. Would you mind sending this patch to DPDK mailing list so we can integrate it? The patch looks really good to me. The only small thing I would like to change. Could you please use SCNu64 macro instead of "%lu" in the sscanf function?
sscanf(buf, "%" SCNu64, stat);Signature · 2 lines
You are receiving this mail because: You reported the bug.