From: Zhu Yanjun <yanjun....@oracle.com> Date: Thu, 5 Sep 2019 05:15:42 -0400
> When testing with a background iperf pushing 1Gbit/sec traffic and running > both ifconfig and netstat to collect statistics, some deadlocks occurred. > > Ifconfig and netstat will call nv_get_stats64 to get software xmit/recv > statistics. In the commit f5d827aece36 ("forcedeth: implement > ndo_get_stats64() API"), the normal tx/rx variables is to collect tx/rx > statistics. The fix is to replace normal tx/rx variables with per > cpu 64-bit variable to collect xmit/recv statistics. The per cpu variable > will avoid deadlocks and provide fast efficient statistics updates. > > In nv_probe, the per cpu variable is initialized. In nv_remove, this > per cpu variable is freed. > > In xmit/recv process, this per cpu variable will be updated. > > In nv_get_stats64, this per cpu variable on each cpu is added up. Then > the driver can get xmit/recv packets statistics. > > A test runs for several days with this commit, the deadlocks disappear > and the performance is better. > > Tested: ... > Fixes: f5d827aece36 ("forcedeth: implement ndo_get_stats64() API") > CC: Joe Jin <joe....@oracle.com> > CC: JUNXIAO_BI <junxiao...@oracle.com> > Reported-and-tested-by: Nan san <nan.1986...@gmail.com> > Signed-off-by: Zhu Yanjun <yanjun....@oracle.com> Applied.