On Fri, Jul 29, 2016 at 10:23:06PM -0700, William Tu wrote: > On Fri, Jul 29, 2016 at 5:19 PM, Daniel Borkmann <dan...@iogearbox.net> wrote: > > On 07/29/2016 10:03 PM, William Tu wrote: > >> > >> I'm not using ARM. It's x86 in a VM with 2 vcpu. By printk() in kernel, I > >> got > >> num_possible_cpu == 64 > >> num_online_cpu == 2 == sysconf(_SC_NPROCESSORS_CONF) ... > >> To fix it, I could either > >> 1). declare values array based on num_possible_cpu in test_map.c, > >> long values[64]; > >> or 2) in kernel, only copying 8*2 = 16 byte from kernel to user. ... > Since percpu array adds variable length of data passing between kernel > and userspace, I wonder if we should add a 'value_len' field in 'union > bpf_attr' so kernel knows how much data to copy to user?
I think the first step is to figure out why num_possible is 64, since it hurts all per-cpu allocations. If it is a widespread issue, it hurts a lot of VMs. Hopefully it's not the case, since in my kvm setup num_possible==num_online qemu version 2.4.0 booting with -enable-kvm -smp N