Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4844777imd; Tue, 30 Oct 2018 08:13:45 -0700 (PDT) X-Google-Smtp-Source: AJdET5eyo/im+/fsrU5fiMg4CW2XMCLhU5ro4NiGIvQspObhKwez1T/cgeF5XN0BRG7m3LFQ9rNa X-Received: by 2002:a17:902:744a:: with SMTP id e10-v6mr19312771plt.61.1540912425592; Tue, 30 Oct 2018 08:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540912425; cv=none; d=google.com; s=arc-20160816; b=jabud5050rd5O1tvSBdxPZgLx5fOUg9f6HoYnnBkJnUU3zTsr9NBB225sW5qUW8ejt F1vPU1xhmmTkPcUifYkC5DFB0bWNvfCfuP1JuvI3DO862hXdkKZH8AsR8wTnuJG0jcPz 2us9xE8t7nAeeMawistK8CY/EbYOo7LjWP7E7L6l0bCYbqDXdPpTI4oNrTx/6KJAb0Ha GK07je6eVQ7L5sbGCqRBjvn/yFRjeTE8USUX3xfgHB27mxlSVcSRu2tD/EwKjoFfIgq1 sYMb6aGbeNuNpOr6ePnROfXjSDl/Mt6FJKc6PBIejFiTbUzvFYFGIQlyUdQ1zSM5u0i9 ul2Q== 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=boD20gwNluGjxcNGu/DrspXWAUAw3r2GQlVcXp2xuXU=; b=jwb+MdFXspyC0Quw9ZB0MDwfpBszUKie/eTs9ZQ0RvIpzUaj6eirb2IT7R0G45/qTq p31HEvU60aHr8/jpY+w8o18rfZ4YcWBM6NZjdDgG3D4K2ENSosVZilG7NFv1Xouc8ZiK hr8Mh8qXmtQTIZgBIpW2WbHEyPB7JY4e0zSEPqZemiK3BK4MVJOVwPKDxPAh0Grax3XZ z12gWcAOrrjJ+kkGgXC0AZCBDuVgN4MC9oJNh7kIENarsP0xnTgyW/euG9We3eVg2JOf qfllOijMif7rEBli6E1x1mgT4SnkBQqpeNd3goPJ8lgSfN9ftRTAMOSNcgxmcN61mq0n 0RNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U4O/CUN3"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9-v6si20583768pgp.488.2018.10.30.08.13.29; Tue, 30 Oct 2018 08:13:45 -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=@kernel.org header.s=default header.b="U4O/CUN3"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727565AbeJaAFd (ORCPT + 99 others); Tue, 30 Oct 2018 20:05:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:45024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbeJaAFd (ORCPT ); Tue, 30 Oct 2018 20:05:33 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AED53204FD; Tue, 30 Oct 2018 15:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540912301; bh=c5qZK/ylEs1KowBEgAkpI4GJ7m5Kt/PIxHrNGM5No0s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U4O/CUN3U1VlDx9f/pCdd5SZL9kn24nJ7t/PUPkHW97UJSPoSTS+VtPA/CGhPoAN9 cJZvvuK1gsBTF2qIXnVGKTeqjaPsq1WlJ8wTgk2J7+yyOQSGCrjTciYFOKGl0iQ0Np jPVViA9Hcpf7v/LogHz/IZN7/qX1tFuEFf0TRwpY= Received: by jouet.infradead.org (Postfix, from userid 1000) id 0FD64142C5F; Tue, 30 Oct 2018 12:11:38 -0300 (-03) Date: Tue, 30 Oct 2018 12:11:38 -0300 From: Arnaldo Carvalho de Melo To: leo.yan@linaro.org, Adrian Hunter 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: <20181030151137.GF23310@kernel.org> References: <1540883908-17018-1-git-send-email-leo.yan@linaro.org> <20181030143226.GA23310@kernel.org> <20181030150449.GB8344@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181030150449.GB8344@leoy-ThinkPad-X240s> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Oct 30, 2018 at 11:04:49PM +0800, leo.yan@linaro.org escreveu: > 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. I'm tentatively applying the patch, as this needs fixing ASAP, and I take that you have tested it and it cured the problem for you, so should be a good indication for the acceptance of the patch. We can always fix some detail later. > 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. Right, I think Adrian is working on it, Adrian? > > Now processing coresight traces should be faster, less lookups :-) > > Thanks! - Arnaldo