Open problame opened 3 years ago
sorry, still I've not had enough time for this. @lian-bo , can you possibly take a look?
@k-hagio Sure. @problame , Christian, thank you for pointing out this issue. Crash can know if it is a percpu symbol via its name, see the definition per_cpu_symbol_search(). I haven't investigated it in detail, if it is a kernel percpu symbol, can you try to check if it(struct mnt_pcp percpu *mnt_pcp) is in the range of [per_cpu_start, per_cpu_end)?
@lian-bo, a __percpu pointer allocated by alloc_percpu()
is not within the range.
crash> mount.mnt_pcp ffff916f5500b480
mnt_pcp = 0x340b01007114,
crash> sym __per_cpu_start __per_cpu_end
0 (D) __per_cpu_start
2d000 (D) __per_cpu_end
To make it just work as I expected, we'd need to know whether a pointer is a __percpu pointer. Is that information available?
Hmm, as far as I've searched, looks not.
If it is not, I suggest we make the
memberlist
syntax and:cpuspec
syntax mutually exclusive when parsing thestruct
command, or at the very least, print a warning.
Yes, I agree on making those mutually exclusive.
Thanks, Kazu
My use case for crash in the last two days was to inspect a mountpoint's
struct mount::mnt_pcp
member. That member is a__percpu
pointer, allocated here and defined here.Expected UX for getting the per-cpu values:
Actual behavior with the last command:
These invalid addresses are the result of
ffff986121bfe880 + kt->__per_cpu_offset[...]
computed here:https://github.com/crash-utility/crash/blob/995db8ab88916b6397676b67be98c0a4f82cca49/symbols.c#L6679-L6690
Looking at that code, I figured out how to get the data I wanted. First, one needs to first get the per-cpu pointer value using the memberlist notation. That'd be
0x39448c800eb0
in my example. And then, one needs to use the:cpuspec
notation with the member type. Like so:To make it
just work
as I expected, we'd need to know whether a pointer is a__percpu
pointer. Is that information available?If it is not, I suggest we make the
memberlist
syntax and:cpuspec
syntax mutually exclusive when parsing thestruct
command, or at the very least, print a warning.I'm happy to put in the work and make a PR, but maintainers should first decide which approach should be taken.