lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181030150449.GB8344@leoy-ThinkPad-X240s>
Date:   Tue, 30 Oct 2018 23:04:49 +0800
From:   leo.yan@...aro.org
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Mathieu Poirier <mathieu.poirier@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Coresight ML <coresight@...ts.linaro.org>
Subject: Re: [PATCH] perf cs-etm: Correct CPU mode for samples

Hi Arnaldo,

On Tue, Oct 30, 2018 at 11:32:26AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Oct 30, 2018 at 03:18:28PM +0800, Leo Yan escreveu:
> > Since commit 9042f5e3539e ("perf tools: Stop fallbacking to kallsyms
> > for vdso symbols lookup"), the kernel address cannot be properly parsed
> > to kernel symbol with command 'perf script -k vmlinux'.  The reason is
> > CoreSight samples is always to set CPU mode as PERF_RECORD_MISC_USER,
> > thus it fails to find corresponding map/dso in below flows:
> > 
> >   process_sample_event()
> >     `-> machine__resolve()
> > 	  `-> thread__find_map(thread, sample->cpumode, sample->ip, al);
> > 
> > In this flow it needs to pass argument 'sample->cpumode' to tell what's
> > the CPU mode, before it always passed PERF_RECORD_MISC_USER but without
> > any failure until the commit 9042f5e3539e ("perf tools: Stop fallbacking
> > to kallsyms for vdso symbols lookup") has been merged.  The reason is
> > even with the wrong CPU mode the function thread__find_map() firstly
> > fails to find map but it will rollback to find kernel map for vdso
> > symbols lookup.  In the latest code it has removed the fallback code,
> > thus if CPU mode is PERF_RECORD_MISC_USER then it cannot find map
> > anymore with kernel address.
> > 
> > This patch is to correct samples CPU mode setting, it creates a new
> > helper function cs_etm__cpu_mode() to tell what's the CPU mode based on
> > the address with the info from machine structure; this patch has a bit
> > extension to check not only kernel and user mode, but also check for
> > host/guest and hypervisor mode.  Finally this patch uses the function
> > in instruction and branch samples and also apply in cs_etm__mem_access()
> > for a minor polishing.
> 
> Mathieu, can I have your Acked-by, please? Leo, thanks for acting so
> quickly on this one! 

Thanks for reivewing.  Yeah, let's wait for Mathieu reviewing as well,
as I know he is travelling so might be delay a bit.

Just remind, we might need the similiar change for util/intel-pt.c and
util/intel-bts.c when generate samples, otherwise they might have the
same regression for kernel symbols.  I am not the best person to change
these two files, but bring up this for attention.

> Now processing coresight traces should be faster, less lookups :-)

Thanks!

[...]

Thanks,
Leo Yan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ