-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Cannot access kernel percpu variables, LLVM error parsing inline asm because %gs is invalid register/token name #2914
Comments
native inline assembly code (x64) won't work for bpf. If necessary, we need a helper here. What is your use case for |
Thanks Yonghong. I am working on an performance profiling and analysis tool, during data collection phase some kernel states are needed, actually I also want to read some other percpu variables like kernel_cpustat -- which also couldn't be done so far. |
Easy accesss percpu globals are not available yet. There is a proposal here But you can do it today with sufficient kernel knowledge with For inline asm code, a helper is needed. Why you need this information? A strong use case is needed in order to add a helper. |
@yonghong-song I need to read Adding a little bit of context here. I raised an issue regarding recognizing process context while collecting stack traces (#5114). I was trying to use @wenbinzeng Were you able to resolve this? |
I am trying to read preempt_count in a bcc program, but can't get it done, because preempt_count() ends up reading kernel percpu variables in asm code which accesses %gs register, but LLVM doesn't recognize it and reports invalid register error as follows:
<inline asm>:1:2: error: invalid register/token name movl %gs:(r1 + 0),r1 ^ LLVM ERROR: Error parsing inline asm
Not only preempt_count, any kernel percpu variables I don't know how to read via bcc programs. Appreciate very much if someone would kindly help.
The code looks like:
The text was updated successfully, but these errors were encountered: