netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: linmiaohe <linmiaohe@huawei.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: correct zerocopy refcnt with newly allocated UDP or RAW uarg
Date: Sat, 15 Aug 2020 02:02:18 +0000	[thread overview]
Message-ID: <0627950da21443c2b422d9861e81bf3a@huawei.com> (raw)

Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote:
>On Fri, Aug 14, 2020 at 10:17 AM linmiaohe <linmiaohe@huawei.com> wrote:
>>
>
>I don't think that can happen.
>
>The question is when this branch is false
>
>                next = (u32)atomic_read(&sk->sk_zckey);
>                if ((u32)(uarg->id + uarg->len) == next) {
>
>I cannot come up with a case. I think it might be vestigial. The goal is to ensure to append only a consecutive range of notification IDs.
>Each notification ID corresponds to a sendmsg invocation with MSG_ZEROCOPY. In both TCP and UDP with corking, data is ordered and access to changes to these fields happen together as a transaction:
>
>                /* realloc only when socket is locked (TCP, UDP cork),
>                 * so uarg->len and sk_zckey access is serialized
>                 */

So what I concerned is just a theoretically problems. If we can always guarantee sock_zerocopy_realloc only returns the existing uarg or NULL when on skb_zcopy(skb),
bad things won't happen.

Many thanks for your detailed explaination.


             reply	other threads:[~2020-08-16  2:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15  2:02 linmiaohe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-08-14  8:17 [PATCH] net: correct zerocopy refcnt with newly allocated UDP or RAW uarg linmiaohe
2020-08-14 15:44 ` Willem de Bruijn
2020-08-13 11:58 Miaohe Lin
2020-08-13 12:34 ` Willem de Bruijn

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=0627950da21443c2b422d9861e81bf3a@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yoshfuji@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).