From mboxrd@z Thu Jan 1 00:00:00 1970 From: alankao@andestech.com (Alan Kao) Date: Mon, 2 Apr 2018 16:18:06 +0800 Subject: [PATCH 1/2] perf: riscv: preliminary RISC-V support In-Reply-To: <20180402073611.GA7694@andestech.com> References: <1522051075-6442-1-git-send-email-alankao@andestech.com> <1522051075-6442-2-git-send-email-alankao@andestech.com> <20180329023024.GA32659@andestech.com> <20180402073611.GA7694@andestech.com> Message-ID: <20180402081806.GA24954@andestech.com> To: linux-riscv@lists.infradead.org List-Id: linux-riscv.lists.infradead.org Hi Alex, On Mon, Apr 02, 2018 at 03:36:12PM +0800, Alan Kao wrote: > On Sat, Mar 31, 2018 at 03:47:10PM -0700, Alex Solomatnikov wrote: > > The original guess was that maybe, an counter value on a hart is picked > as the minusend, and an old counter value on another hart was recorded > as the subtrahend but numerically larger. Then, the overflow causes > by that subtraction. Please let me name this guess as > "cross-hart subtraction." > > > You can add a skew between cores in qemu, something like this: > > > > case CSR_INSTRET: > > core_id()*return cpu_get_host_ticks()/10; > > break; > > case CSR_CYCLE: > > return cpu_get_host_ticks(); > > break; > > > > However, I tried similar stuff to reproduce the phenomenon but in vain. > It seems that the > > ***cross-hart subtration doesn't even happen, because generic > code handles them. ... I am sorry that this observation is wrong. With appropriate tweak, we successfully reproduce the behavior and locate the the bug. This will be fix in v2. Thanks for the helps. Alan