Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752824AbbFCIri (ORCPT ); Wed, 3 Jun 2015 04:47:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35006 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752877AbbFCIrb (ORCPT ); Wed, 3 Jun 2015 04:47:31 -0400 Date: Wed, 3 Jun 2015 10:47:26 +0200 From: Jiri Olsa To: Wang Nan 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 Message-ID: <20150603084726.GC24863@krava.redhat.com> References: <20150529000045.GA8405@sejong> <1433317763-150917-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433317763-150917-1-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1460 Lines: 51 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/