Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4835631imd; Tue, 30 Oct 2018 08:07:12 -0700 (PDT) X-Google-Smtp-Source: AJdET5fcPDtiCtFVcxOAn79HTV8rgd4W/kcwoXCa0jfMKUpZyrD2HOoHROmvcAsVI/6ACEvepiDK X-Received: by 2002:a17:902:1008:: with SMTP id b8-v6mr19510514pla.337.1540912032250; Tue, 30 Oct 2018 08:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540912032; cv=none; d=google.com; s=arc-20160816; b=z91Xlija5Uj8PCQdETXZZQ/YD8h48Sqxa1sgkZL1ByN88O+rW38ccdOxGiktv8/WsI 1QcSNCQs5w+SXkoSG5nLqUFlXdZHxZIBSakHg1xwi2/mh16GDKqIBdS7tfxVItuiaG8p lKrnqgrU4kaIMNpizX0q/NWT1BWLwevFOO6DMalBjVRnSOTguwhkb6wU6lOaNi6FwjD4 fWsBALUawJO5po43VJItpoSZOOPdPOVsShbNybe0zeIx7ui7QaO+1W9kx9bSV1S/kKB+ se2DIdSgdUEEeOJqn17uvYt+Xwgpl1YI/zItLCwXvAwSr/VeuV7RgbdULp1tYOZxg7vX /7tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=M8ODo+5nlI/edvBLdzlgQu84w+YBU1p44EcawnET9pk=; b=e9JxCxC1XlBMOBkTK1l4mL82c5+8t43UQupp/d7RHd6yVZWe448cwDHw3if+vPKA+2 l50y23Ocg5fCfqus9pYiDkhahvCrQIh6yOYbyd1LhMsh142pRaieepTuajVzh83JgwAA zFOSeAlpJmBLQTJi1rqJ8i77b8fNe33LSyT8IPrYDzttbV2qSDMaz3yNOjjfEuUYDmq6 WyNC0HsOaedrfcB915BNtMfeL86eMZJWCRQHVPqW8czRM8RLBCo9pDyiVXb62dbpoggU WbS+CPHBePT6lFofJwREGThG/N3fJ7PlWaRjESmFWJt8rEN/ZzHQ+NQZfdEDzAgtnI6q 8ZoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DFt8KV8/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6-v6si24386815pgf.303.2018.10.30.08.06.49; Tue, 30 Oct 2018 08:07:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DFt8KV8/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727551AbeJ3X7E (ORCPT + 99 others); Tue, 30 Oct 2018 19:59:04 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:36531 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726135AbeJ3X7E (ORCPT ); Tue, 30 Oct 2018 19:59:04 -0400 Received: by mail-wm1-f68.google.com with SMTP id a8-v6so11641568wmf.1 for ; Tue, 30 Oct 2018 08:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=M8ODo+5nlI/edvBLdzlgQu84w+YBU1p44EcawnET9pk=; b=DFt8KV8/ESNPmbJa9+vvQToHWNT0FzKJUHQGMhiF9UkseKZUnzZsto3XXKO0RsvAcs 5Ch0VQjd56r/6zMlKqg0fTCJBXhnoKFVF3VViUJZlLSza4r80aTTVgBhBlwKu+9wJvTD fph0Vae30aLRCbaTKSjWuRJmL2Ii2lHIbRWRs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=M8ODo+5nlI/edvBLdzlgQu84w+YBU1p44EcawnET9pk=; b=rXeh7TxMlPrwWP40KWvH3RvOIBGGmLGy0JduFMzNaY+WlEsb3G696pcW6hGsJ0ycPj mB5fdh4UBMesbCdUruoVs2PX46Ekgqg0KogtjG8K/6iXJjX5M1dEqb79+IVyk+Q3qcns AbVZnDMtXiZkLR2wQYUyr6VHu5UhByiJHqCr7XFGsyyx9yd6T85OXtlVCSI1Vl9BO7AB 52Q7faZB+NxzTQcASp7aMmNHfFJHp7jqLPjhl9fwbi1mfBoFJNK6J54Bt28EPHI6h7yz dKpVe9lLapAiVK6htLdz9K3XSQmEN6lUBxuUtAHQCqop71AbbEePR8KJ5rL42TkJvRvF tLUA== X-Gm-Message-State: AGRZ1gL4OUN7PswSZ0fS32e4jKv4aL4UqooSpAvkxY7wJAAahax3Nnc9 7GVBx55kyOY7LxNgl7kD0XFWzg== X-Received: by 2002:a1c:5a86:: with SMTP id o128-v6mr2035351wmb.138.1540911903380; Tue, 30 Oct 2018 08:05:03 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([209.250.228.18]) by smtp.gmail.com with ESMTPSA id y16-v6sm23486186wru.18.2018.10.30.08.04.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 08:05:00 -0700 (PDT) Date: Tue, 30 Oct 2018 23:04:49 +0800 From: leo.yan@linaro.org To: Arnaldo Carvalho de Melo Cc: Mathieu Poirier , Peter Zijlstra , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coresight ML Subject: Re: [PATCH] perf cs-etm: Correct CPU mode for samples Message-ID: <20181030150449.GB8344@leoy-ThinkPad-X240s> References: <1540883908-17018-1-git-send-email-leo.yan@linaro.org> <20181030143226.GA23310@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181030143226.GA23310@kernel.org> User-Agent: Mutt/1.10+31 (9cdd884) (2018-06-19) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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