Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using global variable to control bpf log level #1206

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hzxuzhonghu
Copy link
Member

@hzxuzhonghu hzxuzhonghu commented Jan 20, 2025

What type of PR is this?

What this PR does / why we need it:

Using global variable to control bpf log level

Should be after #1205

Global variables provide much nicer user experience and avoid BPF map lookup overhead. Additionally, for constant variables, there values are well-known to BPF verifier and treated as constants during program verification, which allows BPF verifier to verify code more precisely and eliminate dead code branches effectively.

Which issue(s) this PR fixes:
Fixes #

Special notes for you're reviewer:

Does this PR introduce a user-facing change?:


Signed-off-by: Zhonghu Xu <[email protected]>
Signed-off-by: Zhonghu Xu <[email protected]>
Signed-off-by: Zhonghu Xu <[email protected]>
Signed-off-by: Zhonghu Xu <[email protected]>
@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from hzxuzhonghu. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

config.BpfLogLevel = uint32(level)
if err := bpf.UpdateKmeshConfigMap(s.kmeshConfigMap, config); err != nil {
http.Error(w, fmt.Sprintf("update log level error: %v", err), http.StatusBadRequest)
if err := s.bpfLogLevel.Set(uint32(level)); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is it now not necessary for KmeshConfigmap to pass the log_level?

Signed-off-by: Zhonghu Xu <[email protected]>
Signed-off-by: Zhonghu Xu <[email protected]>
@bitcoffeeiux
Copy link
Contributor

/lgtm

@hzxuzhonghu
Copy link
Member Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants