Thread (14 messages) 14 messages, 3 authors, 2016-08-25

Re: [PATCH] bpf: fix size of copy_to_user in percpu map.

From: Alexei Starovoitov <hidden>
Date: 2016-07-30 05:34:23

On Fri, Jul 29, 2016 at 10:23:06PM -0700, William Tu wrote:
On Fri, Jul 29, 2016 at 5:19 PM, Daniel Borkmann [off-list ref] wrote:
quoted
On 07/29/2016 10:03 PM, William Tu wrote:
quoted
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)
...
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help