Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Oct 2020 05:07:25 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366924 - head/sys/arm64/include
Message-ID:  <202010220507.09M57PXf077212@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Thu Oct 22 05:07:25 2020
New Revision: 366924
URL: https://svnweb.freebsd.org/changeset/base/366924

Log:
  [hwpmc] Fix call chain capture for ARM64
  
  Use ELR register value instead of LR for PMC_TRAPFRAME_TO_PC macro since
  it's the former that indicates PC if the interrupted execution thread.
  
  This fixes a bug where pmcstat lost the leaf function of the call chain
  and started with the second function in the chain.
  
  Although this change is an improvement over the previous logic there is still
  posibility for incomplete data: if the leaf function does not have stack
  variables and does not call any other functions compiler would not generate
  a stack frame for it and the FP value would point to the caller's frame, so
  instead of the actual "caller1 -> caller2 -> leaf" chain only
  "caller1 -> leaf" would be captured.
  
  Sponsored by:	Ampere Computing
  Submitted by:	Klara, Inc.

Modified:
  head/sys/arm64/include/pmc_mdep.h

Modified: head/sys/arm64/include/pmc_mdep.h
==============================================================================
--- head/sys/arm64/include/pmc_mdep.h	Thu Oct 22 04:49:14 2020	(r366923)
+++ head/sys/arm64/include/pmc_mdep.h	Thu Oct 22 05:07:25 2020	(r366924)
@@ -54,7 +54,7 @@ union pmc_md_pmc {
 	((S) >= (START) && (S) < (END))
 #define	PMC_IN_KERNEL(va)	INKERNEL((va))
 #define	PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)
-#define	PMC_TRAPFRAME_TO_PC(TF)		((TF)->tf_lr)
+#define	PMC_TRAPFRAME_TO_PC(TF)		((TF)->tf_elr)
 #define	PMC_TRAPFRAME_TO_FP(TF)		((TF)->tf_x[29])
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010220507.09M57PXf077212>