Received: by 10.192.165.148 with SMTP id m20csp5047832imm; Tue, 24 Apr 2018 12:45:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNeaYY5w3yuLAhbV0XOnXlv6k/vX28ua/jeJKvAufhHj2XyLRUgo7YF7dBN+Xzw9dtQffU X-Received: by 10.101.80.204 with SMTP id s12mr1883446pgp.313.1524599159501; Tue, 24 Apr 2018 12:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524599159; cv=none; d=google.com; s=arc-20160816; b=NiO1Q4iXs7O4D0HrYRW/xDKWIsc9Ef3HfKC4ZQlFga4aUciTzUj4xD7Qj5hu1Adv0P E6xzQ3L8eeIQa7B1lX4LHpRQxgV70c0NMNNs2AfCHwtG4HxqbmFn0xoPXr3iGQOIoMPL ZIlc3DRP9Pj+cPKj/8RtpU25ZojAnI2c2kh4lspyppKaQB0Bz6yhXy6oBTlcGr+NWUPr j4LGBSL3NFtoMDq5c+vK+ILIY4osILbiJ2TpmyZmoghQG4d0pd17YcR2LiY2ozwvlhJj 1RcMU55tAtDJSsYeNfN3RphKib+lZowhzWGuW5idTrjTPs8q9XQtE10LxkTYjLKeNovn C2hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=Gq3aCpBosiU+i4ktD+hrB7qF4Gyf/xt780GHOBVzbGk=; b=GXIrat7V8UeKQAXjqVzLcALJ6g81qXzTlJJpGSaJqjsntFW89DO7f4HXa7jWv4268x +uZx4nn1maIrnts0kmHjliDWtHYvMlWWcrB1DTPuL4rr4kasea2z+cCJcQq94uGFQztz MPQpYBFcFKFjzu/lTBwvbf9wgs9hCFPbaQyiwZCIkftOFV8xIxrmQji6lmDSRE/Pjz6m E6rQPixC6qdCF71rsbrM9JNPt6CZ+awosZpo1GLe8u1YLAX36/lA02EA5Yf/7ODEeR4W Ua1AGx4Gl3TSYhnGJ76cc21/mqfbn2CT2g6OTqzp0IV0AVB7+EpFzUw8qbTVzmwcb1AR 8Ijg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=O2oe4ENd; 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 q23si8800604pfd.153.2018.04.24.12.45.41; Tue, 24 Apr 2018 12:45:59 -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=@sifive.com header.s=google header.b=O2oe4ENd; 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 S1752135AbeDXToa (ORCPT + 99 others); Tue, 24 Apr 2018 15:44:30 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:38825 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbeDXToY (ORCPT ); Tue, 24 Apr 2018 15:44:24 -0400 Received: by mail-pg0-f67.google.com with SMTP id b5so11604666pgv.5 for ; Tue, 24 Apr 2018 12:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=Gq3aCpBosiU+i4ktD+hrB7qF4Gyf/xt780GHOBVzbGk=; b=O2oe4ENdvV9WCf8Km0FRcd7LA5nUmHMgzGMBcpJeO8VYLtsGLtY7OBOfy0hw2+LUwE 1C8LOUUibOP3ncBPlUUCOhbGZz7wCbU8W8keVs8J3vmgrjRwi3r8aZSV8e2aDd/xBZkD ltS7//uQ2SscRjfOlk4v9Y3jre7QXeKkcMiklNCXBrtKIPbllhTTP52bu+cSr0e47i3c 5E6Z31+7oJECBKiRljqQFWqmSrGoD/Lp8uobEeUILBSWLbCMPCqLqayTP5fMPUERLnDj u//PkLwbSkYOzajD/n1t2NqTZQWn+Fdc4aZIM760SXHEyto3St06p7bmR0NndQbQWF48 gqQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=Gq3aCpBosiU+i4ktD+hrB7qF4Gyf/xt780GHOBVzbGk=; b=qeWmTHgFYNBa2Q4pmubNEJ6XhiXUvgcynIKn8/ncZt17JFylksIro+SzZzv0kIdLAK sd1RUxxpjJtCXLqUOB9FlNjEKNPRUuIXAXL73+QebstLFTCTF16ekPfLx9vZkO42oYtW rJq1pMk2wuKvML0DvYHTD+4BmaFDKs+O/FU19N0NFEJ3++FC38tNNZYxG1q0fO8L5azj UveuwLhFnHaK1Juw22xP8heCcibob5vz4fDTUADyRQkO/tiEPQo+tzKQT/EqJ/VVKQjg XnEmuYaI7e4I/sOktAW1pk2XZnPACf0Obq+HgrtPGJ0hH0EtAoNmLp0IjZbDjaVec7JO o08w== X-Gm-Message-State: ALQs6tDOaSKc3FXIp3nWYe3NE6rYd2Sn9MnIcTFgimXYoNZ2NK8wdpQ1 1HMpAChEwmjKFDnBShz80rUgjQ== X-Received: by 10.99.114.83 with SMTP id c19mr14654425pgn.425.1524599063308; Tue, 24 Apr 2018 12:44:23 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id t9sm31725180pgr.37.2018.04.24.12.44.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 12:44:22 -0700 (PDT) Date: Tue, 24 Apr 2018 12:44:22 -0700 (PDT) X-Google-Original-Date: Tue, 24 Apr 2018 12:43:25 PDT (-0700) Subject: Re: [PATCH v5 0/2] perf: riscv: Preliminary Perf Event Support on RISC-V In-Reply-To: <661405fd-7b23-5f95-568d-0e2eb1925217@wdc.com> CC: alankao@andestech.com, albert@sifive.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, sols@sifive.com, corbet@lwn.net, linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, greentime@andestech.com, nickhu@andestech.com From: Palmer Dabbelt To: atish.patra@wdc.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Apr 2018 12:27:26 PDT (-0700), atish.patra@wdc.com wrote: > On 4/24/18 11:07 AM, Atish Patra wrote: >> On 4/19/18 4:28 PM, Alan Kao wrote: >>> This implements the baseline PMU for RISC-V platforms. >>> >>> To ease future PMU portings, a guide is also written, containing >>> perf concepts, arch porting practices and some hints. >>> >>> Changes in v5: >>> - Fix patch errors from checkpatch.pl. >>> >>> Changes in v4: >>> - Fix several compilation errors. Sorry for that. >>> - Raise a warning in the write_counter body. >>> >>> Changes in v3: >>> - Fix typos in the document. >>> - Change the initialization routine from statically assigning PMU to >>> device-tree-based methods, and set default to the PMU proposed in >>> this patch. >>> >>> Changes in v2: >>> - Fix the bug reported by Alex, which was caused by not sufficient >>> initialization. Check https://lkml.org/lkml/2018/3/31/251 for the >>> discussion. >>> >>> Alan Kao (2): >>> perf: riscv: preliminary RISC-V support >>> perf: riscv: Add Document for Future Porting Guide >>> >>> Documentation/riscv/pmu.txt | 249 ++++++++++++++ >>> arch/riscv/Kconfig | 13 + >>> arch/riscv/include/asm/perf_event.h | 79 ++++- >>> arch/riscv/kernel/Makefile | 1 + >>> arch/riscv/kernel/perf_event.c | 485 ++++++++++++++++++++++++++++ >>> 5 files changed, 823 insertions(+), 4 deletions(-) >>> create mode 100644 Documentation/riscv/pmu.txt >>> create mode 100644 arch/riscv/kernel/perf_event.c >>> >> Most of the perf tests either pass or fail because of unsupported >> event/trace point which is fine. >> >> However, I got an rcu-stall for the test "47: Event times". >> # ./perf test -v 47 >> 47: Event times : >> --- start --- >> test child forked, pid 2774 >> attaching to spawned child, enable on exec >> OK : ena 2243000, run 2243000 >> attaching to current thread as enabled >> OK : ena 19000, run 19000 >> attaching to current thread as disabled >> OK : ena 5000, run 5000 >> attaching to CPU 0 as enabled >> [ 1001.466578] INFO: rcu_sched self-detected stall on CPU >> [ 1001.470947] 4-....: (29999 ticks this GP) idle=5fa/140000000000001/0 >> softirq=19762/19762 fqs=14602 >> [ 1001.480053] (t=30001 jiffies g=3471 c=3470 q=125) >> [ 1001.484917] Task dump for CPU 4: >> [ 1001.488129] perf R running task 0 2774 2773 >> 0x00000008 >> [ 1001.495161] Call Trace: >> [ 1001.497606] [<000000006a3d4f87>] walk_stackframe+0x0/0xc0 >> [ 1001.502980] [<000000004b4b0780>] show_stack+0x3c/0x46 >> [ 1001.508024] [<0000000060c96ab8>] sched_show_task+0xd0/0x122 >> [ 1001.513573] [<000000007d8bd54e>] dump_cpu_task+0x50/0x5a >> [ 1001.518870] [<0000000053990e11>] rcu_dump_cpu_stacks+0x98/0xd2 >> [ 1001.524685] [<00000000fe94c593>] rcu_check_callbacks+0x614/0x822 >> [ 1001.530680] [<0000000057688dd3>] update_process_times+0x38/0x6a >> [ 1001.536585] [<0000000063a96de0>] tick_periodic+0x58/0xd8 >> [ 1001.541876] [<0000000013d712f1>] tick_handle_periodic+0x2e/0x7c >> [ 1001.547780] [<000000009e2ef428>] riscv_timer_interrupt+0x34/0x3c >> [ 1001.553774] [<00000000ff6b1f18>] riscv_intc_irq+0xbc/0xe0 >> [ 1001.559153] [<00000000c8614c3b>] ret_from_exception+0x0/0xc >> >> It is quite possible that we don't support some dependency >> infrastructure. I am looking into it. >> >> Regards, >> Atish >> >> >> >> >> > > Got it working. The test tries to attach the event to CPU0 which doesn't > exist in HighFive Unleashed. Changing it to cpu1 works. > > diff --git a/tools/perf/tests/event-times.c b/tools/perf/tests/event-times.c > index 1a2686f..eb11632f 100644 > --- a/tools/perf/tests/event-times.c > +++ b/tools/perf/tests/event-times.c > @@ -113,9 +113,9 @@ static int attach__cpu_disabled(struct perf_evlist > *evlist) > struct cpu_map *cpus; > int err; > > - pr_debug("attaching to CPU 0 as enabled\n"); > + pr_debug("attaching to CPU 1 as disabled\n"); > > - cpus = cpu_map__new("0"); > + cpus = cpu_map__new("1"); > if (cpus == NULL) { > pr_debug("failed to call cpu_map__new\n"); > return -1; > @@ -142,9 +142,9 @@ static int attach__cpu_enabled(struct perf_evlist > *evlist) > struct cpu_map *cpus; > int err; > > - pr_debug("attaching to CPU 0 as enabled\n"); > + pr_debug("attaching to CPU 1 as enabled\n"); > > - cpus = cpu_map__new("0"); > + cpus = cpu_map__new("1"); > if (cpus == NULL) { > pr_debug("failed to call cpu_map__new\n"); > return -1; > > > Palmer, > Would it be better to officially document it somewhere that CPU0 doesn't > exist in the HighFive Unleashed board ? > I fear that there will be other standard tests/code path that may fail > because of inherent assumption of cpu0 presence. I think the best way to fix this is to just have BBL (or whatever the bootloader is) renumber the CPUs so they're contiguous and begin with 0. Documenting it it just a way to tell people their code needs to be changed, it'll still break.