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

Change trace in ebpf_pinning_table_find #2954

Merged
merged 9 commits into from
Nov 15, 2023

Conversation

shpalani
Copy link
Collaborator

@shpalani shpalani commented Oct 6, 2023

Description

Problem:
ebpf_pinning_table_find() returns EBPF_RETURN_RESULT(retval), which prints success or failure trace upon return.

In _ebpf_native_reuse_map(), ebpf_pinning_table_find() was printing a trace with an error.
It is not an error if the Key is not found in the pinning table, as there will be no entry for the newly created map.

Solution:

  • Added a new macro EBPF_RETURN_FUNCTION_RESULT log trace to log the result from the function, and return.
  • The ebpf_core_get_pinned_object() caller will log and return EBPF_RETURN_FUNCTION_RESULT .
  • The callers will print the error trace:
    1. _ebpf_native_reuse_map()
    2. _ebpf_core_protocol_get_pinned_object()

Testing

_Do any existing tests cover this change? Are new tests needed? No

Before fix
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_native_load_programs
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]_ebpf_native_create_maps
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]_ebpf_native_initialize_maps
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]_ebpf_native_initialize_maps returned success
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_core_get_pinned_object
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_pinning_table_find
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_pinning_table_find returned error,19
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_core_get_pinned_object returned error,19
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_core_create_map
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_map_create
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]eBPF object initialized,0xFFFFC60C2A4E4F30,1
[38]1EB8.11F8::‎2023‎-‎10‎-‎06 16:21:56.698 [EbpfForWindowsProvider]ebpf_map_create returned success

xdp_trace_withoutfix.txt

After fix:

[1]2114.0F94::2023/11/08-12:58:11.849601200 [EbpfForWindowsProvider]{"Entry":"_ebpf_native_reuse_map","meta":{"provider":"EbpfForWindowsProvider","event":"EbpfGenericMessage","time":"2023-11-08T20:58:11.8496012Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"opcode":1,"keywords":"0x1"}}
[1]2114.0F94::2023/11/08-12:58:11.849602500 [EbpfForWindowsProvider]{"Entry":"ebpf_core_get_pinned_object","meta":{"provider":"EbpfForWindowsProvider","event":"EbpfGenericMessage","time":"2023-11-08T20:58:11.8496025Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"opcode":1,"keywords":"0x1"}}
[1]2114.0F94::2023/11/08-12:58:11.849603100 [EbpfForWindowsProvider]{"Entry":"ebpf_pinning_table_find","meta":{"provider":"EbpfForWindowsProvider","event":"EbpfGenericMessage","time":"2023-11-08T20:58:11.8496031Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"opcode":1,"keywords":"0x1"}}
[1]2114.0F94::2023/11/08-12:58:11.849610600 [EbpfForWindowsProvider]{"Message":"ebpf_pinning_table_find returned result","Result":19,"meta":{"provider":"EbpfForWindowsProvider","event":"EbpfGenericMessage","time":"2023-11-08T20:58:11.8496106Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"keywords":"0x2"}}
[1]2114.0F94::2023/11/08-12:58:11.849616100 [EbpfForWindowsProvider]{"Message":"ebpf_core_get_pinned_object returned result","Result":19,"meta":{"provider":"EbpfForWindowsProvider","event":"EbpfGenericMessage","time":"2023-11-08T20:58:11.8496161Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"keywords":"0x2"}}
[1]2114.0F94::2023/11/08-12:58:11.849616800 [EbpfForWindowsProvider]{"Message":"_ebpf_native_reuse_map returned success","meta":{"provider":"EbpfForWindowsProvider","event":"EbpfSuccess","time":"2023-11-08T20:58:11.8496168Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"keywords":"0x2"}}
[1]2114.0F94::2023/11/08-12:58:11.849624400 [EbpfForWindowsProvider]{"Entry":"ebpf_core_create_map","meta":{"provider":"EbpfForWindowsProvider","event":"EbpfGenericMessage","time":"2023-11-08T20:58:11.8496244Z","cpu":1,"pid":8468,"tid":3988,"channel":11,"level":5,"opcode":1,"keywords":"0x1"}}
[1]2114.0F94::2023/11/08-12:58:11.849625000 [EbpfForWindowsProvider]

xdp_trace.txt

Documentation

_Is there any documentation impact for this change?No

Installation

_Is there any installer impact for this change? No

dthaler
dthaler previously requested changes Oct 7, 2023
libs/execution_context/ebpf_core.c Show resolved Hide resolved
@shpalani shpalani requested a review from dthaler October 19, 2023 00:38
shankarseal
shankarseal previously approved these changes Oct 27, 2023
gtrevi
gtrevi previously approved these changes Oct 31, 2023
@shpalani shpalani added this pull request to the merge queue Nov 15, 2023
Merged via the queue into microsoft:main with commit 43972ae Nov 15, 2023
76 checks passed
@shpalani shpalani deleted the shpalan/pinning-trace branch November 15, 2023 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pinning trace error is misleading in ebpf_pinning_table_find function
4 participants