All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: davem@davemloft.net, mst@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu
Date: Fri, 1 Apr 2016 10:13:34 +0800	[thread overview]
Message-ID: <56FDD94E.8090908@redhat.com> (raw)
In-Reply-To: <1459420341.6473.225.camel@edumazet-glaptop3.roam.corp.google.com>



On 03/31/2016 06:32 PM, Eric Dumazet wrote:
> On Thu, 2016-03-31 at 13:50 +0800, Jason Wang wrote:
>> We use a union for napi_id and send_cpu, this is ok for most of the
>> cases except when we want to support busy polling for tun which needs
>> napi_id to be stored and passed to socket during tun_net_xmit(). In
>> this case, napi_id was overridden with sender_cpu before tun_net_xmit()
>> was called if XPS was enabled. Fixing by not using union for napi_id
>> and sender_cpu.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>>  include/linux/skbuff.h | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 15d0df9..8aee891 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -743,11 +743,11 @@ struct sk_buff {
>>  	__u32			hash;
>>  	__be16			vlan_proto;
>>  	__u16			vlan_tci;
>> -#if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS)
>> -	union {
>> -		unsigned int	napi_id;
>> -		unsigned int	sender_cpu;
>> -	};
>> +#if defined(CONFIG_NET_RX_BUSY_POLL)
>> +	unsigned int		napi_id;
>> +#endif
>> +#if defined(CONFIG_XPS)
>> +	unsigned int		sender_cpu;
>>  #endif
>>  	union {
>>  #ifdef CONFIG_NETWORK_SECMARK
> Hmmm...
>
> This is a serious problem.
>
> Making skb bigger (8 bytes because of alignment) was not considered
> valid for sender_cpu introduction. We worked quite hard to avoid this,
> if you take a look at git history :(
>
> Can you describe more precisely the problem and code path ?
>

The problem is we want to support busy polling for tun. This needs
napi_id to be passed to tun socket by sk_mark_napi_id() during
tun_net_xmit(). But before reaching this, XPS will set sender_cpu will
make us can't see correct napi_id.

  parent reply	other threads:[~2016-04-01  2:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  5:50 [PATCH net-next 0/6] net device rx busy polling support in vhost_net Jason Wang
2016-03-31  5:50 ` [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu Jason Wang
2016-03-31 10:32   ` Eric Dumazet
2016-03-31 20:01     ` David Miller
2016-04-01  2:46       ` Jason Wang
2016-04-01  2:13     ` Jason Wang [this message]
2016-04-01  2:55       ` Eric Dumazet
2016-04-01  4:49         ` Jason Wang
2016-04-01 13:04           ` Eric Dumazet
2016-04-05 15:05             ` Michael S. Tsirkin
2016-04-06  6:22             ` Jason Wang
2016-03-31  5:50 ` [PATCH net-next 2/6] tuntap: socket rx busy polling support Jason Wang
2016-03-31  5:50 ` [PATCH net-next 3/6] macvtap: " Jason Wang
2016-03-31  5:50 ` [PATCH net-next 4/6] net: core: factor out core busy polling logic to sk_busy_loop_once() Jason Wang
2016-03-31  5:50 ` [PATCH net-next 5/6] net: export napi_by_id() Jason Wang
2016-03-31  5:50 ` [PATCH net-next 6/6] vhost_net: net device rx busy polling support Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FDD94E.8090908@redhat.com \
    --to=jasowang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.