[PATCH v2 0/2] Print map ID on successful creation

Harshit Mogalapalli posted 2 patches 3 months, 1 week ago
There is a newer version of this series
tools/bpf/bpftool/map.c                       | 21 ++++++++---
.../testing/selftests/bpf/test_bpftool_map.sh | 36 +++++++++++++++++++
2 files changed, 53 insertions(+), 4 deletions(-)
[PATCH v2 0/2] Print map ID on successful creation
Posted by Harshit Mogalapalli 3 months, 1 week ago
Hi all,

I have tried looking at an issue from the bpftool repository:
https://github.com/libbpf/bpftool/issues/121 and this RFC tries to add
that enhancement.

Summary: Currently when a map creation is successful there is no message
on the terminal, printing IDs on successful creation of maps can help
notify the user and can be used in CI/CD.

The first patch adds the logic for printing and the second patch adds a
simple selftest for the same.

The github issue is not fully solved with these two patches, as there
are other bpf objects that might need similar additions. Would
appreciate any inputs on this.

Thank you very much.

V1 --> V2: PATCH 1 updated [Thanks Yonghong for suggesting better way of
error handling with a new label for close(fd); instead of calling
multiple times]

Regards,
Harshit

Harshit Mogalapalli (2):
  bpftool: Print map ID upon creation and support JSON output
  selftests/bpf: Add test for bpftool map ID printing

 tools/bpf/bpftool/map.c                       | 21 ++++++++---
 .../testing/selftests/bpf/test_bpftool_map.sh | 36 +++++++++++++++++++
 2 files changed, 53 insertions(+), 4 deletions(-)

-- 
2.50.1
Re: [PATCH v2 0/2] Print map ID on successful creation
Posted by Quentin Monnet 3 months, 1 week ago
2025-10-30 14:06 UTC-0700 ~ Harshit Mogalapalli
<harshit.m.mogalapalli@oracle.com>
> Hi all,
> 
> I have tried looking at an issue from the bpftool repository:
> https://github.com/libbpf/bpftool/issues/121 and this RFC tries to add


This is not longer a RFC :)


> that enhancement.
> 
> Summary: Currently when a map creation is successful there is no message
> on the terminal, printing IDs on successful creation of maps can help
> notify the user and can be used in CI/CD.
> 
> The first patch adds the logic for printing and the second patch adds a
> simple selftest for the same.
> 
> The github issue is not fully solved with these two patches, as there
> are other bpf objects that might need similar additions. Would
> appreciate any inputs on this.


What's your question, exactly?

Thanks,
Quentin
Re: [PATCH v2 0/2] Print map ID on successful creation
Posted by Harshit Mogalapalli 3 months, 1 week ago
Hi Quentin,

On 01/11/25 22:29, Quentin Monnet wrote:
> 2025-10-30 14:06 UTC-0700 ~ Harshit Mogalapalli
> <harshit.m.mogalapalli@oracle.com>
>> Hi all,
>>
>> I have tried looking at an issue from the bpftool repository:
>> https://github.com/libbpf/bpftool/issues/121 and this RFC tries to add
> 
> 
> This is not longer a RFC :)
> 

Oh, right, I used part of it from my RFC cover letter, sorry about that.

> 
>> that enhancement.
>>
>> Summary: Currently when a map creation is successful there is no message
>> on the terminal, printing IDs on successful creation of maps can help
>> notify the user and can be used in CI/CD.
>>
>> The first patch adds the logic for printing and the second patch adds a
>> simple selftest for the same.
>>
>> The github issue is not fully solved with these two patches, as there
>> are other bpf objects that might need similar additions. Would
>> appreciate any inputs on this.
> 
> 
> What's your question, exactly?
> 
If I understand the issue correctly, the goal is to improve usability
and CI support by printing IDs or other relevant information to the
terminal upon creation of BPF objects, instead of producing no output as
is currently the case. For maps, printing the map ID on creation is
particularly helpful.

In addition to maps, I believe it would be beneficial to print the ID 
when loading a program. I am currently working on implementing this 
enhancement.

Are there any other BPF objects where displaying additional information 
(such as IDs or relevant metadata) on the terminal would be useful?


Thank you!


Regards,
Harshit
  > Thanks,
> Quentin