Received: by 10.213.65.68 with SMTP id h4csp2124427imn; Mon, 2 Apr 2018 01:19:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/fu+2TrdglB58obBjnKw3+qIKrPCi1i7l50jl/9pkTdL6GIeqVlMUBJmrSfrykiakI5g7n X-Received: by 10.101.87.201 with SMTP id q9mr5779071pgr.215.1522657174078; Mon, 02 Apr 2018 01:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522657174; cv=none; d=google.com; s=arc-20160816; b=eeB2U8vP+TVL73Sc/mb9YWLyVCHjc6a2rV8DxeerLsv3w5crmgbA59vvr+vLuYthQ7 LuOa+9ZUQStR6CKUa2a6fgdizMzCs/I5+Git63iJxa0lg712FxNLURrx/GH8O5WqKRxx OS4wJjdgflFzas0qJVuety5ee8TDdKr2eqLiHK+IfMZQPvBettOPesiohlWz5q0KAUKj YTjgoj+LfptB340tPhNgasqjyqz3pSpdaWgOxFG1DQ/K1eLszCE7zei6d88TtYEzAqFG iuJM9flpHsOOYTVp7a7Vzt96V+yRLp6r/GoCJXIM5SN9A53Q14vaKxLXL1IZKL/9ZnNY vtzw== 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:arc-authentication-results; bh=y5S4KemE+EM7QwwxcoWIi1BA8nWj22nzLcTz9HtdpU0=; b=odcMPMV3i/td70snvU3mdgBCXLDnRTg8F6IsxTjcxj0VUQzYzVYhNr4v0dUN+JPxg1 b7ApXICYSBhnJ8EfgrySlof42Oz8R70GvKJSInzecXjFgEGbpQLoW1d9AJWfSjoLycqL 2uqOb2QUFGJ+uyXnseIAMymjOkrZElRXaEDroH/HIbmwmcYuMZZ50FNiALg/APHf0++R jduU0PZxahXz4z4siNzWUoRQjFdUbDZQvagJ1pIQ+7B9xFlKh2FzEvSvoNWWikzZT/Iv XU0Gw4VlSRRax2fMCUo2yYwMfA3ypTueNgrq3SfJmLV72nHgWIgcbsarc1e69T2gouE+ 5K1A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8si9509274pgt.225.2018.04.02.01.19.20; Mon, 02 Apr 2018 01:19:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754272AbeDBISO (ORCPT + 99 others); Mon, 2 Apr 2018 04:18:14 -0400 Received: from exmail.andestech.com ([59.124.169.137]:47192 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751860AbeDBISM (ORCPT ); Mon, 2 Apr 2018 04:18:12 -0400 Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w328D3Iv059149; Mon, 2 Apr 2018 16:13:03 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from andestech.com (10.0.1.85) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Mon, 2 Apr 2018 16:18:05 +0800 Date: Mon, 2 Apr 2018 16:18:06 +0800 From: Alan Kao To: Alex Solomatnikov CC: Nick Hu , Jonathan Corbet , "Peter Zijlstra" , Palmer Dabbelt , , , "Arnaldo Carvalho de Melo" , Alexander Shishkin , Ingo Molnar , "Albert Ou" , Namhyung Kim , , Jiri Olsa , Greentime Hu Subject: Re: [PATCH 1/2] perf: riscv: preliminary RISC-V support Message-ID: <20180402081806.GA24954@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> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180402073611.GA7694@andestech.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.0.1.85] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w328D3Iv059149 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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