From: Jiri Olsa <jolsa@redhat.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: namhyung@kernel.org, acme@kernel.org, jolsa@kernel.org,
mingo@redhat.com, lizefan@huawei.com, pi3orama@163.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7] perf: __kmod_path__parse: deal with kernel module names in '[]' correctly
Date: Wed, 3 Jun 2015 10:47:26 +0200 [thread overview]
Message-ID: <20150603084726.GC24863@krava.redhat.com> (raw)
In-Reply-To: <1433317763-150917-1-git-send-email-wangnan0@huawei.com>
On Wed, Jun 03, 2015 at 07:49:23AM +0000, Wang Nan wrote:
SNIP
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index b335db3..87f5796 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -166,12 +166,28 @@ bool is_supported_compression(const char *ext)
> return false;
> }
>
> -bool is_kernel_module(const char *pathname)
> +bool is_kernel_module(const char *pathname, int cpumode)
> {
> struct kmod_path m;
> -
> - if (kmod_path__parse(&m, pathname))
> - return NULL;
> + int mode = cpumode & PERF_RECORD_MISC_CPUMODE_MASK;
> +
> + WARN_ONCE(mode != cpumode,
> + "Internal error: passing unmasked cpumode (%x) to is_kernel_module",
> + cpumode);
> + /* caller should pass a masked cpumode. Mask again for safety. */
no need for this comment then ^^^
jirka
> + switch (mode) {
> + case PERF_RECORD_MISC_USER:
> + case PERF_RECORD_MISC_HYPERVISOR:
> + case PERF_RECORD_MISC_GUEST_USER:
> + return false;
> + /* Treat PERF_RECORD_MISC_CPUMODE_UNKNOWN as kernel */
> + default:
> + if (kmod_path__parse(&m, pathname)) {
> + pr_err("Failed to check whether %s is a kernel module or not. Assume it is.",
> + pathname);
> + return true;
> + }
> + }
SNIP
next prev parent reply other threads:[~2015-06-03 8:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 3:33 [PATCH v6] perf: __kmod_path__parse: deal with kernel module names in '[]' correctly Wang Nan
2015-04-21 5:16 ` Namhyung Kim
2015-04-21 9:28 ` Wang Nan
2015-05-29 0:00 ` Namhyung Kim
2015-06-03 7:49 ` [PATCH v7] " Wang Nan
2015-06-03 8:47 ` Jiri Olsa [this message]
2015-06-03 8:52 ` [PATCH v8] " Wang Nan
2015-06-03 9:12 ` Jiri Olsa
2015-06-03 13:09 ` Arnaldo Carvalho de Melo
2015-06-04 14:12 ` [tip:perf/core] perf tools: Deal " tip-bot for Wang Nan
2015-05-28 8:33 ` [PATCH v6] perf: __kmod_path__parse: deal " Jiri Olsa
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=20150603084726.GC24863@krava.redhat.com \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=pi3orama@163.com \
--cc=wangnan0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.