[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-++Vn6UbDm5q7_wpwx90Wt-Yia+g4ju_cJ+rX34tt7JPw@mail.gmail.com>
Date: Wed, 11 Oct 2017 17:44:10 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jason Wang <jasowang@...hat.com>
Cc: David Miller <davem@...emloft.net>,
Network Development <netdev@...r.kernel.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH RFC 0/3] tun zerocopy stats
On Tue, Oct 10, 2017 at 11:15 PM, Jason Wang <jasowang@...hat.com> wrote:
>
>
> On 2017年10月11日 03:11, Willem de Bruijn wrote:
>>
>> On Tue, Oct 10, 2017 at 1:39 PM, David Miller <davem@...emloft.net> wrote:
>>>
>>> From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
>>> Date: Tue, 10 Oct 2017 11:29:33 -0400
>>>
>>>> If there is a way to expose these stats through vhost_net directly,
>>>> instead of through tun, that may be better. But I did not see a
>>>> suitable interface. Perhaps debugfs.
>>>
>>> Please don't use debugfs, thank you :-)
>>
>> Okay. I'll take a look at tracing for on-demand measurement.
>
>
> This reminds me a past series that adding tracepoints to vhost/net[1]. It
> can count zero/datacopy independently and even contains a sample program to
> show the stats.
Interesting, thanks!
For occasional evaluation, we can also use a bpf kprobe for the time being:
bpf_program = """
#include <uapi/linux/ptrace.h>
#include <bcc/proto.h>
BPF_ARRAY(count, u64, 2);
void inc_counter(struct pt_regs *ctx) {
bool success;
int key;
u64 *val;
success = PT_REGS_PARM2(ctx);
key = success ? 0 : 1;
val = count.lookup(&key);
if (val)
lock_xadd(val, 1);
}
"""
b = bcc.BPF(text=bpf_program)
b.attach_kprobe(event="vhost_zerocopy_callback", fn_name="inc_counter")
time.sleep(5)
print("vhost_zerocopy_callback: Y:%d N:%d" %
(b["count"][ctypes.c_int(0)].value,
b["count"][ctypes.c_int(1)].value))
Powered by blists - more mailing lists