Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1602869

Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id in socket receive paths

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id in socket receive paths
Date 2017-03-16 23:10 +0100
Message-ID <tlLKN-4LF-5@gated-at.bofh.it> (permalink)
References <tlItA-2iT-5@gated-at.bofh.it> <tlItB-2iT-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2017-03-16 at 11:32 -0700, Alexander Duyck wrote:
> From: Sridhar Samudrala <sridhar.samudrala@intel.com>
> 
> Fix sk_mark_napi_id() and sk_mark_napi_id_once() to set sk_napi_id only if
> skb->napi_id is a valid value.
> 
> This happens in loopback paths where skb->napi_id is not updated in
> rx path and holds sender_cpu that is set in xmit path.
> 
> Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> ---
>  include/net/busy_poll.h |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
> index c0452de83086..67991635953e 100644
> --- a/include/net/busy_poll.h
> +++ b/include/net/busy_poll.h
> @@ -116,7 +116,8 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
>  static inline void sk_mark_napi_id(struct sock *sk, const struct sk_buff *skb)
>  {
>  #ifdef CONFIG_NET_RX_BUSY_POLL
> -	sk->sk_napi_id = skb->napi_id;
> +	if (skb->napi_id > (u32)NR_CPUS)
> +		sk->sk_napi_id = skb->napi_id;
>  #endif
>  }
>  
> @@ -125,7 +126,7 @@ static inline void sk_mark_napi_id_once(struct sock *sk,
>  					const struct sk_buff *skb)
>  {
>  #ifdef CONFIG_NET_RX_BUSY_POLL
> -	if (!sk->sk_napi_id)
> +	if (!sk->sk_napi_id && (skb->napi_id > (u32)NR_CPUS))
>  		sk->sk_napi_id = skb->napi_id;
>  #endif
>  }
> 

It is not clear why this patch is needed .

What you describe here is the case we might receive packets for a socket
coming from different interfaces ?

If skb->napi_id is a sender_cpu, why should we prevent overwriting the
sk_napi_id with it, knowing that busy polling will simply ignore the
invalid value ?

Do not get me wrong :

I simply try to understand why the test about napi_id validity is now
done twice :

1) At the time we are writing into sk->sk_napi_id

2) At busy polling time when we read sk->sk_napi_id

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[net-next PATCH 0/5] Add busy poll support for epoll under certain  circumstances Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 19:40 +0100
  [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id in  socket receive paths Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 19:40 +0100
    Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id  in socket receive paths Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-16 23:10 +0100
      Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id in  socket receive paths Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 23:50 +0100
        Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id  in socket receive paths Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-17 00:00 +0100
          Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id in  socket receive paths Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-17 03:50 +0100
            Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id  in socket receive paths Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-17 04:00 +0100
            Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id in  socket receive paths Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-17 04:00 +0100
            Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id  in socket receive paths Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-17 04:10 +0100
      Re: [net-next PATCH 1/5] net: Do not record sender_cpu as napi_id  in socket receive paths "Samudrala, Sridhar" <sridhar.samudrala@intel.com> - 2017-03-16 23:50 +0100
  [net-next PATCH 2/5] net: Call sk_mark_napi_id() in the ACK receive  path Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 19:40 +0100
    Re: [net-next PATCH 2/5] net: Call sk_mark_napi_id() in the ACK  receive path Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-16 23:10 +0100
      Re: [net-next PATCH 2/5] net: Call sk_mark_napi_id() in the ACK  receive path Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 23:40 +0100
  [net-next PATCH 3/5] net: Introduce SO_INCOMING_NAPI_ID Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 19:40 +0100
    Re: [net-next PATCH 3/5] net: Introduce SO_INCOMING_NAPI_ID Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-17 00:00 +0100
  Re: [net-next PATCH 0/5] Add busy poll support for epoll under  certain circumstances Michael Kerrisk <mtk.manpages@gmail.com> - 2017-03-18 12:50 +0100

csiph-web