From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752305AbbCWLCs (ORCPT ); Mon, 23 Mar 2015 07:02:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37861 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752144AbbCWLCq (ORCPT ); Mon, 23 Mar 2015 07:02:46 -0400 Date: Mon, 23 Mar 2015 12:02:28 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , linux-kernel@vger.kernel.org, Adrian Hunter , Corey Ashford , David Ahern , Frederic Weisbecker , Ingo Molnar , Paul Mackerras , Peter Zijlstra , Stephane Eranian , acme@kernel.org Subject: Re: [PATCH 08/14] perf tools: Use kmod_path__parse in map_groups__set_modules_path_dir Message-ID: <20150323110228.GC21860@krava.brq.redhat.com> References: <1425640442-16048-9-git-send-email-jolsa@kernel.org> <20150321182042.GB3404@redhat.com> <20150322235509.GA2782@sejong> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150322235509.GA2782@sejong> 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 On Mon, Mar 23, 2015 at 08:55:09AM +0900, Namhyung Kim wrote: SNIP > > > + */ > > > + if (m->comp && is_kmod_dso(map->dso)) > > > + map->dso->symtab_type++; > > > > Ouch, does this assumes this is a: > > > > DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE > > Nope, it's one of _SYSTEM_PATH_KMODULE or _GUEST_KMODULE. > > > > > > And that, because in the dso_binary_type enum > > DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP comes right after it, and thus > > this cryptic increment is equivalent to: > > > > map->dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP; > > Again, _SYSTEM_PATH_KMODULE_COMP or _GUEST_KMODULE_COMP. > yep, the code assumes (correctly) that symtab_type is either _SYSTEM_PATH_KMODULE or _GUEST_KMODULE. Namhyung placed the _COMP enum right behind 'no comp' values: enum dso_binary_type { ... DSO_BINARY_TYPE__GUEST_KMODULE, DSO_BINARY_TYPE__GUEST_KMODULE_COMP, DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE, DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP, ... so we could safely just increase the symtab_type in case we detect it's compressed kernel module. Perhaps the code could be more verbose on this, but since such comment wasn't part of the previous code I did not feel the need to add it now ;-) jirka