bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Stanislav Fomichev <sdf@google.com>
Cc: Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH bpf-next v8 1/3] bpf: remove extra lock_sock for TCP_ZEROCOPY_RECEIVE
Date: Thu, 14 Jan 2021 19:57:14 -0800	[thread overview]
Message-ID: <CAADnVQ+2MDGVEKRZ+B-q+GcZ8CExN5VfSZpkvntg48dpww3diA@mail.gmail.com> (raw)
In-Reply-To: <CAKH8qBsaZjOkvGZuNCtG=V2M9YfAJgtG+moAejwtBCB6kNJUwA@mail.gmail.com>

On Thu, Jan 14, 2021 at 7:40 PM Stanislav Fomichev <sdf@google.com> wrote:
>
> On Thu, Jan 14, 2021 at 7:27 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> >
> > On Wed, Jan 13, 2021 at 1:33 PM Stanislav Fomichev <sdf@google.com> wrote:
> > >
> > > Add custom implementation of getsockopt hook for TCP_ZEROCOPY_RECEIVE.
> > > We skip generic hooks for TCP_ZEROCOPY_RECEIVE and have a custom
> > > call in do_tcp_getsockopt using the on-stack data. This removes
> > > 3% overhead for locking/unlocking the socket.
> > >
> > > Without this patch:
> > >      3.38%     0.07%  tcp_mmap  [kernel.kallsyms]  [k] __cgroup_bpf_run_filter_getsockopt
> > >             |
> > >              --3.30%--__cgroup_bpf_run_filter_getsockopt
> > >                        |
> > >                         --0.81%--__kmalloc
> > >
> > > With the patch applied:
> > >      0.52%     0.12%  tcp_mmap  [kernel.kallsyms]  [k] __cgroup_bpf_run_filter_getsockopt_kern
> > >
> > > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > > Cc: Martin KaFai Lau <kafai@fb.com>
> > > Cc: Song Liu <songliubraving@fb.com>
> > > Cc: Eric Dumazet <edumazet@google.com>
> > > Acked-by: Martin KaFai Lau <kafai@fb.com>
> >
> > Few issues in this patch and the patch 2 doesn't apply:
> > Switched to a new branch 'tmp'
> > Applying: bpf: Remove extra lock_sock for TCP_ZEROCOPY_RECEIVE
> > .git/rebase-apply/patch:295: trailing whitespace.
> > #endif
> > .git/rebase-apply/patch:306: trailing whitespace.
> > union tcp_word_hdr {
> > .git/rebase-apply/patch:309: trailing whitespace.
> > };
> > .git/rebase-apply/patch:311: trailing whitespace.
> > #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
> > .git/rebase-apply/patch:313: trailing whitespace.
> > enum {
> > warning: squelched 1 whitespace error
> > warning: 6 lines add whitespace errors.
> > Applying: bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt
> > error: patch failed: kernel/bpf/cgroup.c:1390
> > error: kernel/bpf/cgroup.c: patch does not apply
> > Patch failed at 0002 bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt
> Sorry, I mentioned in the cover letter that the series requires
> 4be34f3d0731 ("bpf: Don't leak memory in bpf getsockopt when optlen == 0")
> which is only in the bpf tree. No sure when bpf & bpf-next merge.
> Or are you trying to apply on top of that?

hmm. It will take a while to wait for the trees to converge.
Ok. I've cherry-picked that bpf commit and applied 3 patches on top,
but the test failed to build:

progs/sockopt_sk.c:60:47: error: use of undeclared identifier
'TCP_ZEROCOPY_RECEIVE'
        if (ctx->level == SOL_TCP && ctx->optname == TCP_ZEROCOPY_RECEIVE) {
                                                     ^
progs/sockopt_sk.c:66:16: error: invalid application of 'sizeof' to an
incomplete type 'struct tcp_zerocopy_receive'
                if (optval + sizeof(struct tcp_zerocopy_receive) > optval_end)

Looks like copied uapi/tcp.h into tools/ wasn't in the include path.

  reply	other threads:[~2021-01-15  3:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 21:33 [PATCH bpf-next v8 0/3] bpf: misc performance improvements for cgroup hooks Stanislav Fomichev
2021-01-13 21:33 ` [PATCH bpf-next v8 1/3] bpf: remove extra lock_sock for TCP_ZEROCOPY_RECEIVE Stanislav Fomichev
2021-01-15  3:27   ` Alexei Starovoitov
2021-01-15  3:39     ` Stanislav Fomichev
2021-01-15  3:57       ` Alexei Starovoitov [this message]
2021-01-15  4:05         ` Stanislav Fomichev
2021-01-15  4:07           ` Alexei Starovoitov
2021-01-15  4:28             ` Stanislav Fomichev
2021-01-13 21:33 ` [PATCH bpf-next v8 2/3] bpf: try to avoid kzalloc in cgroup/{s,g}etsockopt Stanislav Fomichev
2021-01-13 21:33 ` [PATCH bpf-next v8 3/3] bpf: split cgroup_bpf_enabled per attach type Stanislav Fomichev

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=CAADnVQ+2MDGVEKRZ+B-q+GcZ8CExN5VfSZpkvntg48dpww3diA@mail.gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=edumazet@google.com \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    /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).