linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Add load_time in bpf_prog fdinfo
Date: Sat, 21 Jun 2025 03:54:29 +0800	[thread overview]
Message-ID: <5ff84c99-46a2-4dde-a1f4-f49b09b0b15f@linux.dev> (raw)
In-Reply-To: <CAADnVQLd9Z1nfp+WBdMLaZ7EP-+A9QEDdOhZaL0YTaygtKD2Hg@mail.gmail.com>

在 2025/6/21 02:27, Alexei Starovoitov 写道:
> On Thu, Jun 19, 2025 at 10:10 PM Tao Chen <chen.dylane@linux.dev> wrote:
>>
>> The field run_time_ns can tell us the run time of the bpf_prog,
>> and load_time_s can tell us how long the bpf_prog loaded on the
>> machine.
>>
>> Signed-off-by: Tao Chen <chen.dylane@linux.dev>
>> ---
>>   kernel/bpf/syscall.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index 51ba1a7aa43..407841ea296 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>> @@ -2438,6 +2438,7 @@ static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp)
>>          const struct bpf_prog *prog = filp->private_data;
>>          char prog_tag[sizeof(prog->tag) * 2 + 1] = { };
>>          struct bpf_prog_kstats stats;
>> +       u64 now = ktime_get_boottime_ns();
>>
>>          bpf_prog_get_stats(prog, &stats);
>>          bin2hex(prog_tag, prog->tag, sizeof(prog->tag));
>> @@ -2450,7 +2451,8 @@ static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp)
>>                     "run_time_ns:\t%llu\n"
>>                     "run_cnt:\t%llu\n"
>>                     "recursion_misses:\t%llu\n"
>> -                  "verified_insns:\t%u\n",
>> +                  "verified_insns:\t%u\n"
>> +                  "load_time_s:\t%llu\n",
>>                     prog->type,
>>                     prog->jited,
>>                     prog_tag,
>> @@ -2459,7 +2461,8 @@ static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp)
>>                     stats.nsecs,
>>                     stats.cnt,
>>                     stats.misses,
>> -                  prog->aux->verified_insns);
>> +                  prog->aux->verified_insns,
>> +                  (now - prog->aux->load_time) / NSEC_PER_SEC);
> 
> I don't like where it's going.
> Soon fdinfo will be printing the xlated insns of the prog too,
> since why not?
> Let's stop here. We have syscall query api-s for that and
> bpftool to print such things.
> No more fdinfo "improvements".

Got it, Alexei, thanks for your patient explanation.

-- 
Best Regards
Tao Chen

  reply	other threads:[~2025-06-20 19:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20  5:10 [PATCH bpf-next] bpf: Add load_time in bpf_prog fdinfo Tao Chen
2025-06-20 18:27 ` Alexei Starovoitov
2025-06-20 19:54   ` Tao Chen [this message]
2025-06-22  9:22 ` kernel test robot

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=5ff84c99-46a2-4dde-a1f4-f49b09b0b15f@linux.dev \
    --to=chen.dylane@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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).