[PATCH v5] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-30 Thread Jia He
us check the data structure member "sk_shutdown" (suggested by Stefano) after a call of the function "lock_sock" since this field is set to "SHUTDOWN_MASK" under the protection of "lock_sock_nested". Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_co

[PATCH] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-30 Thread Jia He
us check the data structure member “sk_shutdown” (suggested by Stefano) after a call of the function “lock_sock” since this field is set to “SHUTDOWN_MASK” under the protection of “lock_sock_nested”. Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko") Signed-off-by: Jia He Cc

[PATCH v3] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-29 Thread Jia He
This fixes it by checking sk->sk_shutdown(suggested by Stefano) after lock_sock since sk->sk_shutdown is set to SHUTDOWN_MASK under the protection of lock_sock_nested. Signed-off-by: Jia He Cc: sta...@vger.kernel.org Reviewed-by: Stefano Garzarella --- v3: - describe the fix of race condition mo

[PATCH v2] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-29 Thread Jia He
If there is __vsock_release() in another task, sk->sk_socket will be set to NULL inadvertently. This fixes it by checking sk->sk_shutdown. Signed-off-by: Jia He Cc: sta...@vger.kernel.org Cc: Stefano Garzarella --- v2: use lightweight checking suggested by Stefano Garzarell

[PATCH] virtio_vsock: Fix race condition in virtio_transport_recv_pkt

2020-05-29 Thread Jia He
virtio_transport_recv_connecting sk->sk_socket->state (panic) This fixes it by checking vsk again whether it is in bound/connected table. Signed-off-by: Jia He Cc: sta...@vger.kernel.org --- net/vmw

[PATCH v2] vhost: vsock: kick send_pkt worker once device is started

2020-04-30 Thread Jia He
h vsock enabled) boot time is reduced from 3s to 1s on a ThunderX2 arm64 server. [1] https://github.com/kata-containers/runtime/issues/1917 Reported-by: Ning Bo Suggested-by: Stefano Garzarella Signed-off-by: Jia He --- v2: new solution suggested by Stefano Garzarella drivers/vhost/vsoc

[PATCH] vhost: add mutex_lock/unlock for vhost_vq_reset

2020-04-29 Thread Jia He
vq->mutex is to protect any vq accessing, hence adding mutex_lock/unlock makes sense to avoid potential race condition. Signed-off-by: Jia He --- drivers/vhost/vhost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index d450e16c5

[PATCH] vhost: vsock: don't send pkt when vq is not started

2020-04-29 Thread Jia He
from 3s to 1s on ThunderX2 arm64 server. [1] https://github.com/kata-containers/runtime/issues/1917 Reported-by: Ning Bo Signed-off-by: Jia He --- drivers/vhost/vsock.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index e36aaf9ba7bd

[PATCH v6 7/7] net: Suppress the "Comparison to NULL could be written" warnings

2016-09-29 Thread Jia He
This is to suppress the checkpatch.pl warning "Comparison to NULL could be written". No functional changes here. Signed-off-by: Jia He --- net/ipv4/proc.c | 32 net/sctp/proc.c | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git

[PATCH v6 4/7] proc: Reduce cache miss in sctp_snmp_seq_show

2016-09-29 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/sctp/proc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/sctp/proc.c b/net/sctp

[PATCH v6 1/7] net:snmp: Introduce generic interfaces for snmp_get_cpu_field{,64}

2016-09-29 Thread Jia He
This is to introduce the generic interfaces for snmp_get_cpu_field{,64}. It exchanges the two for-loops for collecting the percpu statistics data. This can aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He Suggested-by: Marcelo Ricardo Leitner

[PATCH v6 5/7] proc: Reduce cache miss in xfrm_statistics_seq_show

2016-09-29 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/xfrm/xfrm_proc.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_proc.c b

[PATCH v6 2/7] proc: Reduce cache miss in snmp_seq_show

2016-09-29 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Then snmp_seq_show is split into 2 parts to avoid build warning "the frame size" larger than 1024. Signed-off-by: Jia He --- net/ipv4/p

[PATCH v6 3/7] proc: Reduce cache miss in snmp6_seq_show

2016-09-29 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/ipv6/proc.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/net

[PATCH v6 6/7] ipv6: Remove useless parameter in __snmp6_fill_statsdev

2016-09-29 Thread Jia He
The parameter items(is always ICMP6_MIB_MAX) is useless for __snmp6_fill_statsdev Signed-off-by: Jia He --- net/ipv6/addrconf.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2f1f5d4..35d4baa 100644 --- a/net

[PATCH v6 0/7] Reduce cache miss for snmp_fold_field

2016-09-29 Thread Jia He
changes in netstat_seq_show considerred the stack usage is too large v3: - introduce generic interface (suggested by Marcelo Ricardo Leitner) - use max_t instead of self defined macro (suggested by David Miller) v2: - fix bug in udplite statistics. - snmp_seq_show is split into 2 parts Jia He (7):

[PATCH v5 6/7] ipv6: Remove useless parameter in __snmp6_fill_statsdev

2016-09-27 Thread Jia He
The parameter items(always ICMP6_MIB_MAX) is useless for __snmp6_fill_statsdev. Signed-off-by: Jia He --- net/ipv6/addrconf.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2f1f5d4..35d4baa 100644 --- a/net/ipv6

[PATCH v5 5/7] proc: Reduce cache miss in xfrm_statistics_seq_show

2016-09-27 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/xfrm/xfrm_proc.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/net/xfrm/xfrm_proc.c

[PATCH v5 1/7] net:snmp: Introduce generic interfaces for snmp_get_cpu_field{,64}

2016-09-27 Thread Jia He
This is to introduce the generic interfaces for snmp_get_cpu_field{,64}. It exchanges the two for-loops for collecting the percpu statistics data. This can aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He Suggested-by: Marcelo Ricardo Leitner

[PATCH v5 3/7] proc: Reduce cache miss in snmp6_seq_show

2016-09-27 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/ipv6/proc.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/net

[PATCH v5 7/7] net: Suppress the "Comparison to NULL could be written" warnings

2016-09-27 Thread Jia He
This is to suppress the checkpatch.pl warning "Comparison to NULL could be written". No functional changes here. Signed-off-by: Jia He --- net/ipv4/proc.c | 32 net/sctp/proc.c | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git

[PATCH v5 4/7] proc: Reduce cache miss in sctp_snmp_seq_show

2016-09-27 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/sctp/proc.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/sctp/proc.c b/net/sctp

[PATCH v5 0/7] Reduce cache miss for snmp_fold_field

2016-09-27 Thread Jia He
netstat_seq_show considerred the stack usage is too large v3: - introduce generic interface (suggested by Marcelo Ricardo Leitner) - use max_t instead of self defined macro (suggested by David Miller) v2: - fix bug in udplite statistics. - snmp_seq_show is split into 2 parts Jia He (7): net:snmp: Introduce

[PATCH v5 2/7] proc: Reduce cache miss in snmp_seq_show

2016-09-27 Thread Jia He
This is to use the generic interfaces snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Then snmp_seq_show is split into 2 parts to avoid build warning "the frame size" larger than 1024. Signed-off-by: Jia He --- net/ipv4/p

[PATCH v4 0/7] Reduce cache miss for snmp_fold_field

2016-09-26 Thread Jia He
gested by Marcelo Ricardo Leitner) - use max_t instead of self defined macro (suggested by David Miller) v2: - fix bug in udplite statistics. - snmp_seq_show is split into 2 parts Jia He (7): net:snmp: Introduce generic interfaces for snmp_get_cpu_field{,64} proc: Reduce cache miss in snmp_seq_show

[PATCH v4 6/7] ipv6: Remove useless parameter in __snmp6_fill_statsdev

2016-09-26 Thread Jia He
The parameter items(always ICMP6_MIB_MAX) is useless for __snmp6_fill_statsdev. Signed-off-by: Jia He --- net/ipv6/addrconf.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2f1f5d4..35d4baa 100644 --- a/net/ipv6

[PATCH v4 5/7] proc: Reduce cache miss in xfrm_statistics_seq_show

2016-09-26 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/xfrm/xfrm_proc.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_proc.c b

[PATCH v4 4/7] proc: Reduce cache miss in sctp_snmp_seq_show

2016-09-26 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/sctp/proc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/sctp/proc.c b/net/sctp

[PATCH v4 3/7] proc: Reduce cache miss in snmp6_seq_show

2016-09-26 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/ipv6/proc.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/net

[PATCH v4 7/7] net: Suppress the "Comparison to NULL could be written" warnings

2016-09-26 Thread Jia He
This is to suppress the checkpatch.pl warning "Comparison to NULL could be written". No functional changes here. Signed-off-by: Jia He --- net/ipv4/proc.c | 32 net/sctp/proc.c | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git

[PATCH v4 1/7] net:snmp: Introduce generic interfaces for snmp_get_cpu_field{,64}

2016-09-26 Thread Jia He
This is to introduce the generic interfaces for snmp_get_cpu_field{,64}. It exchanges the two for-loops for collecting the percpu statistics data. This can aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He Suggested-by: Marcelo Ricardo Leitner

[PATCH v4 2/7] proc: Reduce cache miss in snmp_seq_show

2016-09-26 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Then snmp_seq_show is split into 2 parts to avoid build warning "the frame size" larger than 1024. Signed-off-by: Jia He --- net/ipv4/p

[RFC PATCH v3 0/7] Reduce cache miss for snmp_fold_field

2016-09-08 Thread Jia He
che hits[39.89%] 6.868422769 seconds time elapsed The cache-miss rate can be reduced from 15% to 2.9% v3: - introduce generic interface (suggested by Marcelo Ricardo Leitner) - use max_t instead of self defined macro (suggested by David Miller) v2: - fix bug in udplite statistics.

[RFC PATCH v3 7/7] net: Suppress the "Comparison to NULL could be written" warning

2016-09-08 Thread Jia He
This is to suppress the checkpatch.pl warning "Comparison to NULL could be written". No functional changes here. Signed-off-by: Jia He --- net/ipv4/proc.c | 32 net/sctp/proc.c | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git

[RFC PATCH v3 3/7] proc: Reduce cache miss in snmp6_seq_show

2016-09-08 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/ipv6/proc.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/net

[RFC PATCH v3 6/7] ipv6: Remove useless parameter in __snmp6_fill_statsdev

2016-09-08 Thread Jia He
The parameter items(always ICMP6_MIB_MAX) is useless for __snmp6_fill_statsdev. Signed-off-by: Jia He --- net/ipv6/addrconf.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f418d2e..e170554 100644 --- a/net/ipv6

[RFC PATCH v3 2/7] proc: Reduce cache miss in {snmp,netstat}_seq_show

2016-09-08 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Then snmp_seq_show and netstat_seq_show are split into 2 parts to avoid build warning "the frame size" larger than 1024 on s390. Signed-off-

[RFC PATCH v3 5/7] proc: Reduce cache miss in xfrm_statistics_seq_show

2016-09-08 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/xfrm/xfrm_proc.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/xfrm/xfrm_proc.c b

[RFC PATCH v3 4/7] proc: Reduce cache miss in sctp_snmp_seq_show

2016-09-08 Thread Jia He
This is to use the generic interface snmp_get_cpu_field{,64}_batch to aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/sctp/proc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/sctp/proc.c b/net/sctp

[RFC PATCH v3 1/7] net:snmp: Introduce generic batch interfaces for snmp_get_cpu_field{,64}

2016-09-08 Thread Jia He
This is to introduced the generic batch interfaces for snmp_get_cpu_field{,64}. It exchanges the two for-loops for collecting the percpu statistics data. This can aggregate the data by going through all the items of each cpu sequentially. Signed-off-by: Jia He Suggested-by: Marcelo Ricardo

[RFC PATCH v2 6/6] net: Suppress the "Comparison to NULL could be written" warning

2016-09-05 Thread Jia He
This is to suppress the checkpatch.pl warning "Comparison to NULL could be written". No functional changes here. Signed-off-by: Jia He --- net/ipv4/proc.c | 44 ++-- net/sctp/proc.c | 4 ++-- net/xfrm/xfrm_proc.c | 4 ++-- 3 files c

[RFC PATCH v2 3/6] proc: Reduce cache miss in sctp_snmp_seq_show

2016-09-05 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can reduce cache misses by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/sctp/proc.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net

[RFC PATCH v2 1/6] proc: Reduce cache miss in {snmp,netstat}_seq_show

2016-09-05 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can aggregate the data by going through all the items of each cpu sequentially. Then snmp_seq_show is split into 2 parts to avoid build warning "the frame size" larger than 1024. Signed-off-by: Jia He ---

[RFC PATCH v2 5/6] ipv6: Remove useless parameter in __snmp6_fill_statsdev

2016-09-05 Thread Jia He
The parameter items(always ICMP6_MIB_MAX) is useless for __snmp6_fill_statsdev. Signed-off-by: Jia He --- net/ipv6/addrconf.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f418d2e..e170554 100644 --- a/net/ipv6

[RFC PATCH v2 2/6] proc: Reduce cache miss in snmp6_seq_show

2016-09-05 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can reduce cache misses by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/ipv6/proc.c | 47 --- 1 file changed, 36 insertions(+), 11

[RFC PATCH v2 4/6] proc: Reduce cache miss in xfrm_statistics_seq_show

2016-09-05 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can reduce cache misses by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/xfrm/xfrm_proc.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git

[RFC PATCH v2 0/6] Reduce cache miss for snmp_fold_field

2016-09-05 Thread Jia He
che hits[39.89%] 6.868422769 seconds time elapsed The cache-miss rate can be reduced from 15% to 2.9% v2: - 1/6 fix bug in udplite statistics. - 1/6 snmp_seq_show is split into 2 parts Jia He (6): proc: Reduce cache miss in {snmp,netstat}_seq_show proc: Reduce cache miss in

[RFC PATCH 5/6] ipv6: Remove useless parameter in __snmp6_fill_statsdev

2016-08-29 Thread Jia He
The parameter items(always ICMP6_MIB_MAX) is useless for __snmp6_fill_statsdev. Signed-off-by: Jia He --- net/ipv6/addrconf.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index df8425f..0fa5aa1 100644 --- a/net/ipv6

[RFC PATCH 2/6] proc: Reduce cache miss in snmp6_seq_show

2016-08-29 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can reduce cache misses by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/ipv6/proc.c | 47 --- 1 file changed, 36 insertions(+), 11

[RFC PATCH 1/6] proc: Reduce cache miss in {snmp,netstat}_seq_show

2016-08-29 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can aggregate the data by going through all the items of each cpu sequentially. In snmp_seq_show, just use one buff copy to dislay the Udp and UdpLite data because they are the same. Signed-off-by: Jia He --- net

[RFC PATCH 3/6] proc: Reduce cache miss in sctp_snmp_seq_show

2016-08-29 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can reduce cache misses by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/sctp/proc.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net

[RFC PATCH 0/6] Reduce cache miss for snmp_fold_field

2016-08-29 Thread Jia He
[60.04%] 464466 LLC-load-misses #0.25% of all LL-cache hits[39.89%] 6.868422769 seconds time elapsed The cache-miss rate can be reduced from 15% to 2.9% Jia He (6): proc: Reduce cache miss in {snmp,netstat}_seq_show proc: Reduce cache miss in

[RFC PATCH 4/6] proc: Reduce cache miss in xfrm_statistics_seq_show

2016-08-29 Thread Jia He
This patch exchanges the two loop for collecting the percpu statistics data. This can reduce cache misses by going through all the items of each cpu sequentially. Signed-off-by: Jia He --- net/xfrm/xfrm_proc.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git

[RFC PATCH 6/6] net: Suppress the "Comparison to NULL

2016-08-29 Thread Jia He
This is to suppress the checkpatch.pl warning "Comparison to NULL could be written". No functional changes here. Signed-off-by: Jia He --- net/ipv4/proc.c | 42 +- net/sctp/proc.c | 4 ++-- net/xfrm/xfrm_proc.c | 4 ++-- 3 files c

[RFC PATCH 3/3] net: Remove the useless parameter of __snmp6_fill_statsdev

2016-08-08 Thread Jia He
In commit a3a773726c9f ("net: Optimize snmp stat aggregation by walking all the percpu data at once"), __snmp6_fill_stats64 had been optimized by removing parameter items, so do the same for __snmp6_fill_statsdev. Signed-off-by: Jia He Cc: "David S. Miller" Cc: Alexey

[RFC PATCH 2/3] net: Replace for_each_possible_cpu with for_each_online_cpu

2016-08-08 Thread Jia He
In PowerPC server with large number cpus, the loop index in smt=1 could be reduced to 1/8 compared with smt=8. Thus cache misses can be reduced. Signed-off-by: Jia He Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy ---

[RFC PATCH 0/3] net: Improve snmp6_fill_stats

2016-08-08 Thread Jia He
This is the follow up work of commit a3a773726c9f ("net: Optimize snmp stat aggregation by walking all the percpu data at once") Jia He (3): net: Remove unnecessary memset in __snmp6_fill_stats64 net: Replace for_each_possible_cpu with for_each_online_cpu net: Remove the useless

[RFC PATCH 1/3] net: Remove unnecessary memset in __snmp6_fill_stats64

2016-08-08 Thread Jia He
buff[] will be assigned later, so memset is not necessary. Signed-off-by: Jia He Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy --- net/ipv6/addrconf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/ipv6/addrconf.c