netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arjun Roy <arjunroy@google.com>
To: David Laight <David.Laight@aculab.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Arjun Roy <arjunroy.kdev@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"soheil@google.com" <soheil@google.com>
Subject: Re: [net-next v2 1/8] net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy.
Date: Fri, 4 Dec 2020 14:37:29 -0800	[thread overview]
Message-ID: <CAOFY-A060UoG_aFM1nK_++-mGnUxXQKeyso9L_z0Du4WJVumUg@mail.gmail.com> (raw)
In-Reply-To: <99eb2611ce8a47289a6c6360f29acdd7@AcuMS.aculab.com>

On Fri, Dec 4, 2020 at 1:03 AM David Laight <David.Laight@aculab.com> wrote:
>
> From: Arjun Roy
> > Sent: 03 December 2020 23:25
> ...
> > > > You also have to allow for old (working) applications being recompiled
> > > > with the new headers.
> > > > So you cannot rely on the fields being zero even if you are passed
> > > > the size of the structure.
> > > >
> > >
> > > I think this should already be taken care of in the current code; the
> > > full-sized struct with new fields is being zero-initialized, then
> > > we're getting the user-provided optlen, then copying from userspace
> > > only that much data. So the newer fields would be zero in that case,
> > > so this should handle the case of new kernels but old applications.
> > > Does this address the concern, or am I misunderstanding?
> > >
> >
> > Actually, on closer read, perhaps the following is what you have in
> > mind for the old application?
> >
> > struct zerocopy_args args;
> > args.address = ...;
> > args.length = ...;
> > args.recv_skip_hint = ...;
> > args.inq = ...;
> > args.err = ...;
> > getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, &args, sizeof(args));
> > // sizeof(args) is now bigger when recompiled with new headers, but we
> > did not explicitly set the new fields to 0, therefore issues
>
> That's the one...
>

I'll defer in this case to Eric's previous response in this thread
(paraphrased: that there is precedent for this in tcp_mmap.c).

-Arjun

>         David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)

  reply	other threads:[~2020-12-04 22:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 22:09 [net-next v2 0/8] Perf. optimizations for TCP Recv. Zerocopy Arjun Roy
2020-12-02 22:09 ` [net-next v2 1/8] net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy Arjun Roy
2020-12-03  0:15   ` Stephen Hemminger
2020-12-03  0:24     ` Arjun Roy
2020-12-03 23:01     ` David Laight
2020-12-03 23:14       ` Eric Dumazet
2020-12-04  9:02         ` David Laight
2020-12-03 23:19       ` Arjun Roy
2020-12-03 23:24         ` Arjun Roy
2020-12-04  9:03           ` David Laight
2020-12-04 22:37             ` Arjun Roy [this message]
2020-12-02 22:09 ` [net-next v2 2/8] net-tcp: Introduce tcp_recvmsg_locked() Arjun Roy
2020-12-02 22:09 ` [net-next v2 3/8] net-zerocopy: Refactor skb frag fast-forward op Arjun Roy
2020-12-02 22:09 ` [net-next v2 4/8] net-zerocopy: Refactor frag-is-remappable test Arjun Roy
2020-12-02 22:09 ` [net-next v2 5/8] net-zerocopy: Fast return if inq < PAGE_SIZE Arjun Roy
2020-12-02 22:09 ` [net-next v2 6/8] net-zerocopy: Introduce short-circuit small reads Arjun Roy
2020-12-02 22:09 ` [net-next v2 7/8] net-zerocopy: Set zerocopy hint when data is copied Arjun Roy
2020-12-02 22:09 ` [net-next v2 8/8] net-zerocopy: Defer vm zap unless actually needed Arjun Roy

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=CAOFY-A060UoG_aFM1nK_++-mGnUxXQKeyso9L_z0Du4WJVumUg@mail.gmail.com \
    --to=arjunroy@google.com \
    --cc=David.Laight@aculab.com \
    --cc=arjunroy.kdev@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    --cc=stephen@networkplumber.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).