All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Feng zhou <zhoufeng.zf@bytedance.com>
Cc: Networking <netdev@vger.kernel.org>,
	Stephen Hemminger <stephen@networkplumber.org>,
	kuznet@ms2.inr.ac.ru, duanxiongchun@bytedance.com,
	Dongdong Wang <wangdongdong.6@bytedance.com>,
	chenzhuowen.simon@bytedance.com
Subject: Re: [PATCH] lib/bpf: Fix btf_load error lead to enable debug log
Date: Fri, 30 Jul 2021 11:40:28 -0700	[thread overview]
Message-ID: <CAEf4BzY8_n9Yvd0Tpveca5-YRQYpqLgZHshHTWVUNOrAzUJfWw@mail.gmail.com> (raw)
In-Reply-To: <20210729045516.7373-1-zhoufeng.zf@bytedance.com>

On Wed, Jul 28, 2021 at 9:55 PM Feng zhou <zhoufeng.zf@bytedance.com> wrote:
>
> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>
> Use tc with no verbose, when bpf_btf_attach fail,
> the conditions:
> "if (fd < 0 && (errno == ENOSPC || !ctx->log_size))"
> will make ctx->log_size != 0. And then, bpf_prog_attach,
> ctx->log_size != 0. so enable debug log.
> The verifier log sometimes is so chatty on larger programs.
> bpf_prog_attach is failed.
> "Log buffer too small to dump verifier log 16777215 bytes (9 tries)!"
>
> BTF load failure does not affect prog load. prog still work.
> So when BTF/PROG load fail, enlarge log_size and re-fail with
> having verbose.
>
> Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
> ---

This seems to be targeted against iproute2? It would be good to
specify that as [PATCH iproute2] or something.


>  lib/bpf_legacy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/bpf_legacy.c b/lib/bpf_legacy.c
> index 8a03b9c2..d824388c 100644
> --- a/lib/bpf_legacy.c
> +++ b/lib/bpf_legacy.c
> @@ -1531,7 +1531,7 @@ retry:
>                  * into our buffer. Still, try to give a debuggable error
>                  * log for the user, so enlarge it and re-fail.
>                  */
> -               if (fd < 0 && (errno == ENOSPC || !ctx->log_size)) {
> +               if (fd < 0 && errno == ENOSPC) {
>                         if (tries++ < 10 && !bpf_log_realloc(ctx))
>                                 goto retry;
>
> @@ -2069,7 +2069,7 @@ retry:
>         fd = bpf_btf_load(ctx->btf_data->d_buf, ctx->btf_data->d_size,
>                           ctx->log, ctx->log_size);
>         if (fd < 0 || ctx->verbose) {
> -               if (fd < 0 && (errno == ENOSPC || !ctx->log_size)) {
> +               if (fd < 0 && errno == ENOSPC) {
>                         if (tries++ < 10 && !bpf_log_realloc(ctx))
>                                 goto retry;
>
> --
> 2.11.0
>

  reply	other threads:[~2021-07-30 18:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  4:55 [PATCH] lib/bpf: Fix btf_load error lead to enable debug log Feng zhou
2021-07-30 18:40 ` Andrii Nakryiko [this message]
2021-08-01  5:59   ` [External] " zhoufeng
  -- strict thread matches above, loose matches on Subject: below --
2021-07-28  9:33 Feng zhou
2021-07-29  4:02 ` zhoufeng

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=CAEf4BzY8_n9Yvd0Tpveca5-YRQYpqLgZHshHTWVUNOrAzUJfWw@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=chenzhuowen.simon@bytedance.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=wangdongdong.6@bytedance.com \
    --cc=zhoufeng.zf@bytedance.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 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.