[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5ff84c99-46a2-4dde-a1f4-f49b09b0b15f@linux.dev>
Date: Sat, 21 Jun 2025 03:54:29 +0800
From: Tao Chen <chen.dylane@...ux.dev>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau
<martin.lau@...ux.dev>, Eduard <eddyz87@...il.com>,
Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: Add load_time in bpf_prog fdinfo
在 2025/6/21 02:27, Alexei Starovoitov 写道:
> On Thu, Jun 19, 2025 at 10:10 PM Tao Chen <chen.dylane@...ux.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@...ux.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
Powered by blists - more mailing lists