From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757277AbbCMQiw (ORCPT ); Fri, 13 Mar 2015 12:38:52 -0400 Received: from mail-ie0-f170.google.com ([209.85.223.170]:36832 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757029AbbCMQis (ORCPT ); Fri, 13 Mar 2015 12:38:48 -0400 Message-ID: <5503128D.70908@plumgrid.com> Date: Fri, 13 Mar 2015 09:38:37 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: He Kuang , Ingo Molnar CC: Steven Rostedt , Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa , Masami Hiramatsu , "David S. Miller" , Daniel Borkmann , Peter Zijlstra , linux-api@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, wangnan0@huawei.com Subject: Re: [PATCH v6 tip 3/8] tracing: allow BPF programs to call bpf_ktime_get_ns() References: <1426047534-8148-1-git-send-email-ast@plumgrid.com> <1426047534-8148-4-git-send-email-ast@plumgrid.com> <5502C8EB.9070307@huawei.com> In-Reply-To: <5502C8EB.9070307@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/13/15 4:24 AM, He Kuang wrote: > Hi, Alexei > > I've followed up your bpf version. In bpf filter, sometimes we need to > get 'pid' and some other context informations to decide whether to > filter or not. > > For example, to trace a vfs read procedure, we can insert bpf program to > '__vfs_read(struct file *file, char __user *buf ...)', mark some of > 'buf' addresses and only trace the read procedure of these 'buf's. But > this parameter is a userspace pointer, the value is meaningless to other > processes, so we should also record 'pid' to make sense. > > To a function like __vfs_read, 'pid' can't be extracted from function > parameters directly. What's your opinion on this issue? yes. it's the next thing on todo list after this set of patches. There are several ways to let programs see 'pid'. We'll debate about the best approach hopefully soon :)