All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: ast@kernel.org, daniel@iogearbox.net, andriin@fb.com, yhs@fb.com,
	linux@rasmusvillemoes.dk, andriy.shevchenko@linux.intel.com,
	pmladek@suse.com, kafai@fb.com, songliubraving@fb.com,
	john.fastabend@gmail.com, kpsingh@chromium.org, shuah@kernel.org,
	rdna@fb.com, scott.branden@broadcom.com, quentin@isovalent.com,
	cneirabustos@gmail.com, jakub@cloudflare.com, mingo@redhat.com,
	rostedt@goodmis.org, bpf@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	acme@kernel.org
Subject: Re: [PATCH v5 bpf-next 5/6] bpf: add bpf_seq_btf_write helper
Date: Mon, 21 Sep 2020 18:10:40 -0700	[thread overview]
Message-ID: <20200922011040.osoccsppdljfam4g@ast-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <1600436075-2961-6-git-send-email-alan.maguire@oracle.com>

On Fri, Sep 18, 2020 at 02:34:34PM +0100, Alan Maguire wrote:
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 9b89b67..c0815f1 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -3614,6 +3614,15 @@ struct bpf_stack_build_id {
>   *		The number of bytes that were written (or would have been
>   *		written if output had to be truncated due to string size),
>   *		or a negative error in cases of failure.
> + *
> + * long bpf_seq_btf_write(struct seq_file *m, struct btf_ptr *ptr, u32 ptr_size, u64 flags)
> + *	Description
> + *		Use BTF to write to seq_write a string representation of
> + *		*ptr*->ptr, using *ptr*->type name or *ptr*->type_id as per
> + *		bpf_btf_snprintf() above.  *flags* are identical to those
> + *		used for bpf_btf_snprintf.
> + *	Return
> + *		0 on success or a negative error in case of failure.
>   */
>  #define __BPF_FUNC_MAPPER(FN)		\
>  	FN(unspec),			\
> @@ -3766,6 +3775,7 @@ struct bpf_stack_build_id {
>  	FN(d_path),			\
>  	FN(copy_from_user),		\
>  	FN(btf_snprintf),		\
> +	FN(seq_btf_write),		\

bpf_btf_ prefix is a bit mouthful.

May be bpf_print_btf() and bpf_seq_print_btf() ?

> -void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
> -			struct seq_file *m)
> +int btf_type_seq_show_flags(const struct btf *btf, u32 type_id, void *obj,
> +			struct seq_file *m, u64 flags)
>  {
>  	struct btf_show sseq;
>  
>  	sseq.target = m;
>  	sseq.showfn = btf_seq_show;
> -	sseq.flags = BTF_SHOW_NONAME | BTF_SHOW_COMPACT | BTF_SHOW_ZERO |
> -		     BTF_SHOW_UNSAFE;
> +	sseq.flags = flags;

could you roll this change into patch 2?

>  
> -BPF_CALL_5(bpf_btf_snprintf, char *, str, u32, str_size, struct btf_ptr *, ptr,
> -	   u32, btf_ptr_size, u64, flags)
> +static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size,
> +				  u64 flags, const struct btf **btf,
> +				  s32 *btf_id)

Similarly pls introduce bpf_print_prepare() helper in the patch 3 right away.
It reads odd when something that was just introduced in the previous patch
gets refactored in the next.

The rest looks great to me.
Please address build bot issues and respin.

  reply	other threads:[~2020-09-22  1:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 13:34 [PATCH v5 bpf-next 0/6] bpf: add helpers to support BTF-based kernel data display Alan Maguire
2020-09-18 13:34 ` [PATCH v5 bpf-next 1/6] bpf: provide function to get vmlinux BTF information Alan Maguire
2020-09-18 13:34 ` [PATCH v5 bpf-next 2/6] bpf: move to generic BTF show support, apply it to seq files/strings Alan Maguire
2020-09-18 18:20   ` kernel test robot
2020-09-18 18:32   ` kernel test robot
2020-09-18 18:32   ` [RFC PATCH] bpf: btf_type_show() can be static kernel test robot
2020-09-18 18:44   ` [PATCH v5 bpf-next 2/6] bpf: move to generic BTF show support, apply it to seq files/strings kernel test robot
2020-09-18 13:34 ` [PATCH v5 bpf-next 3/6] bpf: add bpf_btf_snprintf helper Alan Maguire
2020-09-18 23:53   ` kernel test robot
2020-09-19  0:20   ` kernel test robot
2020-09-18 13:34 ` [PATCH v5 bpf-next 4/6] selftests/bpf: add bpf_btf_snprintf helper tests Alan Maguire
2020-09-18 13:34 ` [PATCH v5 bpf-next 5/6] bpf: add bpf_seq_btf_write helper Alan Maguire
2020-09-22  1:10   ` Alexei Starovoitov [this message]
2020-09-18 13:34 ` [PATCH v5 bpf-next 6/6] selftests/bpf: add test for " Alan Maguire

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=20200922011040.osoccsppdljfam4g@ast-mbp.dhcp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andriin@fb.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cneirabustos@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=jakub@cloudflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=quentin@isovalent.com \
    --cc=rdna@fb.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.branden@broadcom.com \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@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 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.