On Thu, Apr 14, 2022 at 3:46 PM Alexander Lobakin <alobakin@xxxxx> wrote: > > On 32 bit systems, shifting an unsigned long by 32 positions > yields the following warning: > > samples/bpf/tracex2_kern.c:60:23: warning: shift count >= width of type [-Wshift-count-overflow] > unsigned int hi = v >> 32; > ^ ~~ > long is always 64-bit in BPF, but I suspect this is due to samples/bpf/Makefile still using this clang + llc combo, where clang is called with native target and llc for -target bpf. Not sure if we are ready to ditch that complicated combination. Yonghong, do we still need that or can we just use -target bpf in samples/bpf? > The usual way to avoid this is to shift by 16 two times (see > upper_32_bits() macro in the kernel). Use it across the BPF sample > code as well. > > Fixes: d822a1926849 ("samples/bpf: Add counting example for kfree_skb() function calls and the write() syscall") > Fixes: 0fb1170ee68a ("bpf: BPF based latency tracing") > Fixes: f74599f7c530 ("bpf: Add tests and samples for LWT-BPF") > Signed-off-by: Alexander Lobakin <alobakin@xxxxx> > --- > samples/bpf/lathist_kern.c | 2 +- > samples/bpf/lwt_len_hist_kern.c | 2 +- > samples/bpf/tracex2_kern.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > [...]