public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Wangnan (F)" <wangnan0@huawei.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: <masami.hiramatsu.pt@hitachi.com>, <ast@kernel.org>,
	<lizefan@huawei.com>, <pi3orama@163.com>,
	<linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 04/16] bpf tools: Collect map definition in bpf_object
Date: Fri, 27 Nov 2015 14:21:29 +0800	[thread overview]
Message-ID: <5657F669.5070404@huawei.com> (raw)
In-Reply-To: <5657F544.1080708@huawei.com>



On 2015/11/27 14:16, Wangnan (F) wrote:
>
>
> On 2015/11/27 4:56, Arnaldo Carvalho de Melo wrote:
>> Em Tue, Nov 24, 2015 at 01:36:09PM +0000, Wang Nan escreveu:
>
> [SNIP]

[SNIP]

>>> +
>>> +    if ((prev < s) || (prev >= e)) {
>>> +        pr_warning("error: map handler doesn't belong to object\n");
>> I wonder if this shouldn't be made pr_debug, and as well have a function
>> prefix, otherwise we may think this is related to some other kind of
>> map, so I suggest:
>>         pr_debug("%s: error: map handler doesn't belong to object\n", 
>> __func__);
>>
>> Or at least:
>>
>>         pr_debug("BPF error: map handler doesn't belong to object\n");
>
> We always have a libbpf prefix before debug info from libbpf. Please see
>
> static __printf(1, 2) libbpf_print_fn_t __pr_warning = __base_pr;
> static __printf(1, 2) libbpf_print_fn_t __pr_info = __base_pr;
> static __printf(1, 2) libbpf_print_fn_t __pr_debug;
> #define __pr(func, fmt, ...)    \
> do {                            \
>         if ((func))             \
>                 (func)("libbpf: " fmt, ##__VA_ARGS__); \
> } while (0)
>
> #define pr_warning(fmt, ...)    __pr(__pr_warning, fmt, ##__VA_ARGS__)
> #define pr_info(fmt, ...)       __pr(__pr_info, fmt, ##__VA_ARGS__)
> #define pr_debug(fmt, ...)      __pr(__pr_debug, fmt, ##__VA_ARGS__)
>
> We allow __pr_{warning,info,debug} be overwritten but the 'libbpf:' 
> prefix is
> always there.
>
> Also, don't forget in perf's context libbpf is muted.
>
Sorry, Shoule be "muted in most case"...

Here's an example:

$ sudo ./perf record -v -e ./test_bpf_base.c ls
...
ude/uapi -Iinclude/generated/uapi -include 
/home/w00229757/linux-hydrogen/include/linux/kconfig.h
set env: WORKING_DIR=/lib/modules/4.3.0-rc4+/build
set env: CLANG_SOURCE=/home/w00229757/./test_bpf_base.c
llvm compiling command template: $CLANG_EXEC -D__KERNEL__ 
-D__NR_CPUS__=$NR_CPUS -DLINUX_VERSION_CODE=$LINUX_VERSION_CODE 
$CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign 
-working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o -
libbpf: loading object './test_bpf_base.c' from buffer
libbpf: section .strtab, size 112, link 0, flags 0, type=3
libbpf: section .text, size 0, link 0, flags 6, type=1
libbpf: section .data, size 0, link 0, flags 3, type=1
...
libbpf: kernel version of ./test_bpf_base.c is 40300
libbpf: section .symtab, size 96, link 1, flags 0, type=2
bpf: config program 'func_write=vfs_write file->f_mode'
symbol:vfs_write file:(null) line:0 offset:0 return:0 lazy:(null)
parsing arg: file->f_mode into file, f_mode(1)
bpf: config 'func_write=vfs_write file->f_mode' is ok

If the error you pointed out is triggered, it should be:

libbpf: error: map handler doesn't belong to object ...

So we can always find which error message is belone to libbpf
and which is belone to perf.


  reply	other threads:[~2015-11-27  6:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 13:36 [PATCH 00/16] perf tools: BPF related update Wang Nan
2015-11-24 13:36 ` [PATCH 01/16] tools build: Clean CFLAGS and LDFLAGS for fixdep Wang Nan
2015-11-26  8:21   ` [tip:perf/core] " tip-bot for Wang Nan
2015-11-24 13:36 ` [PATCH 02/16] tools lib bpf: Don't feature check when cleaning Wang Nan
2015-11-26  8:22   ` [tip:perf/core] tools lib bpf: Don' t do a " tip-bot for Wang Nan
2015-11-24 13:36 ` [PATCH 03/16] bpf tools: Add helper function for updating bpf maps elements Wang Nan
2015-11-27  7:47   ` [tip:perf/core] " tip-bot for He Kuang
2015-11-24 13:36 ` [PATCH 04/16] bpf tools: Collect map definition in bpf_object Wang Nan
2015-11-26 20:56   ` Arnaldo Carvalho de Melo
2015-11-27  6:16     ` Wangnan (F)
2015-11-27  6:21       ` Wangnan (F) [this message]
2015-11-24 13:36 ` [PATCH 05/16] bpf tools: Extract and collect map names from BPF object file Wang Nan
2015-11-24 13:36 ` [PATCH 06/16] perf tools: Rename bpf config to program config Wang Nan
2015-11-24 13:36 ` [PATCH 07/16] perf tools: Add API to config maps in bpf object Wang Nan
2015-11-27  7:32   ` Wangnan (F)
2015-11-24 13:36 ` [PATCH 08/16] perf tools: Enable BPF object configure syntax Wang Nan
2015-11-24 13:36 ` [PATCH 09/16] perf record: Apply config to BPF objects before recording Wang Nan
2015-11-24 13:36 ` [PATCH 10/16] perf tools: Support perf event alias name Wang Nan
2015-11-24 13:36 ` [PATCH 11/16] perf tools: Enable passing event to BPF object Wang Nan
2015-11-24 13:36 ` [PATCH 12/16] perf tools: Support setting different slots in a BPF map separately Wang Nan
2015-11-27  7:31   ` Wangnan (F)
2015-11-24 13:36 ` [PATCH 13/16] perf tools: Enable indices setting syntax for BPF maps Wang Nan
2015-11-24 13:36 ` [PATCH 14/16] perf tools: Introduce bpf-output event Wang Nan
2015-11-24 13:36 ` [PATCH 15/16] perf data: Add u32_hex data type Wang Nan
2015-11-24 13:36 ` [PATCH 16/16] perf data: Support converting data from bpf_perf_event_output() Wang Nan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5657F669.5070404@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=acme@kernel.org \
    --cc=ast@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=namhyung@kernel.org \
    --cc=pi3orama@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox