From patchwork Mon May 22 12:48:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaokun Zhang X-Patchwork-Id: 100293 Delivered-To: patch@linaro.org Received: by 10.182.142.97 with SMTP id rv1csp1367523obb; Mon, 22 May 2017 05:18:40 -0700 (PDT) X-Received: by 10.84.138.1 with SMTP id 1mr28816244plo.188.1495455520306; Mon, 22 May 2017 05:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495455520; cv=none; d=google.com; s=arc-20160816; b=aexkUVh9JgYNBIMatrq4HSFZJDsGFAQVw5rlSB36RVZmA+EYmdH3EuxOK8xsV9c3wL kgt4jTUou577SDXv4okNwWk8ifQ2vnuNEAdkpbR9HUrpSSlFLBgEGENChsSdDe2cYX4A bC/OFeNdt1ieyPr85mXYMA59x5+7cINNSH/sts0oouUDFmP2zUgVIL++/3it6cw7nHx7 wG3/JQ5eD2yaK2iVLmjzvBC5m05ddYNe3pEIwESNg9Ixjr7/qcSK7wyQGZCK/vKsGJtI E8IDjBD6r7/mRw70XZaz82VIyfLdK1i8ShSGAD/Q6oixDinj6AhLoFvIQGHfUC4rhXuh nuFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=SeLq+x7YNnClbB8Z8QlgBpGha0djGZHDp4qweTf36IY=; b=fIWb66YhKjvA/1jJR8BFuDcvcqIom/L5KRGg2yxrnLJo2B2woboA7dlCm9OkUj4HMT k8oupK3OGH9V/FUr17MJRzzBjNZFU24ioBqHa6jyF4fi3DwRQEn54tRUbAvY1YCq8IIO iCXFJiKI33Pa/i4S2CrHlhCQpWreSCQXS02/YdGUBHO67pkH2vfXseRhfh3H81pwV9Wx FpPX87qzlyRjGC/NuJq/mAxhzGC1fHYghIRkRp1XSq017sxT3sn89HSHhWa+KN4UIPKO sRhl2CtGzvOTRelt/Psf6n2ybG/rm6E1M0ZPkhTRIxDbUhjdxGUwcUqmGyvLCqkyQ3D1 gV4g== 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 w8si14630604pls.225.2017.05.22.05.18.40; Mon, 22 May 2017 05:18:40 -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 S1759599AbdEVMSO (ORCPT + 25 others); Mon, 22 May 2017 08:18:14 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:6369 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759560AbdEVMSE (ORCPT ); Mon, 22 May 2017 08:18:04 -0400 Received: from 172.30.72.54 (EHLO dggeml405-hub.china.huawei.com) ([172.30.72.54]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AOA30820; Mon, 22 May 2017 20:17:25 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by dggeml405-hub.china.huawei.com (10.3.17.49) with Microsoft SMTP Server id 14.3.301.0; Mon, 22 May 2017 20:17:16 +0800 From: Shaokun Zhang To: , , CC: , , , , , , , , , , , , , , , Subject: [PATCH v8 4/9] Documentation: perf: hisi: Documentation for HiP05/06/07 PMU event counting. Date: Mon, 22 May 2017 20:48:27 +0800 Message-ID: <1495457307-235888-1-git-send-email-zhangshaokun@hisilicon.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5922D6D6.00F5, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ac15065819b3784a6f43dd714090a629 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anurup M Documentation for perf usage and Hisilicon SoC PMU uncore events. The Hisilicon SOC has event counters for hardware modules like L3 cache, Miscellaneous node etc. These events are all uncore. Signed-off-by: Anurup M Signed-off-by: Shaokun Zhang --- Documentation/perf/hisi-pmu.txt | 75 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Documentation/perf/hisi-pmu.txt -- 1.9.1 diff --git a/Documentation/perf/hisi-pmu.txt b/Documentation/perf/hisi-pmu.txt new file mode 100644 index 0000000..a21571d --- /dev/null +++ b/Documentation/perf/hisi-pmu.txt @@ -0,0 +1,75 @@ +Hisilicon SoC PMU (Performance Monitoring Unit) +================================================ +The Hisilicon SoC HiP05/06/07 chips consist of various independent system +device PMU's such as L3 cache(L3C) and Miscellaneous Nodes(MN). +These PMU devices are independent and have hardware logic to gather +statistics and performance information. + +HiP0x chips are encapsulated by multiple CPU and IO dies. The CPU die is +called as Super CPU cluster (SCCL) which includes 16 cpu-cores. Every SCCL +is further grouped as CPU clusters (CCL) which includes 4 cpu-cores each. +Each SCCL has 1 L3 cache and 1 MN units. + +The L3 cache is shared by all CPU cores in a CPU die. The L3C has four banks +(or instances). Each bank or instance of L3C has Eight 32-bit counter +registers and also event control registers. The HiP05/06 chip L3 cache has +22 statistics events. The HiP07 chip has 66 statistics events. These events +are very useful for debugging. + +The MN module is also shared by all CPU cores in a CPU die. It receives +barriers and DVM(Distributed Virtual Memory) messages from cpu or smmu, and +perform the required actions and return response messages. These events are +very useful for debugging. The MN has total 9 statistics events and support +four 32-bit counter registers in HiP05/06/07 chips. + +There is no memory mapping for L3 cache and MN registers. It can be accessed +by using the Hisilicon djtag interface. The Djtag in a SCCL is an independent +module which connects with some modules in the SoC by Debug Bus. + +Hisilicon SoC (HiP05/06/07) PMU driver +-------------------------------------- +The HiP0x PMU driver shall register perf PMU drivers like L3 cache, MN etc. +The available events and configuration options shall be described in the sysfs. +The "perf list" shall list the available events from sysfs. + +The L3 cache in a SCCL is divided as 4 banks. Each L3 cache bank have separate +PMU registers for event counting and control. The L3 cache banks also do not +have any CPU affinity. So each L3 cache banks are registered with perf as a +separate PMU. +The PMU name will appear in event listing as hisi_l3c_. +where "bank-id" is the bank index (0 to 3) and "scl-id" is the SCCL identifier +e.g. hisi_l3c0_2/read_hit is READ_HIT event of L3 cache bank #0 SCCL ID #2. + +The MN in a SCCL is registered as a separate PMU with perf. +The PMU name will appear in event listing as hisi_mn_. +e.g. hisi_mn_2/read_req. READ_REQUEST event of MN of Super CPU cluster #2. + +The event code is represented by 8 bits. + i) event 0-7 + The event code will be represented using the LSB 8 bits. + +The driver also provides a "cpumask" sysfs attribute, which shows the CPU core +ID used to count the uncore PMU event. + +Example usage of perf: +$# perf list +hisi_l3c0_2/read_hit/ [kernel PMU event] +------------------------------------------ +hisi_l3c1_2/write_hit/ [kernel PMU event] +------------------------------------------ +hisi_l3c0_1/read_hit/ [kernel PMU event] +------------------------------------------ +hisi_l3c0_1/write_hit/ [kernel PMU event] +------------------------------------------ +hisi_mn_2/read_req/ [kernel PMU event] +hisi_mn_2/write_req/ [kernel PMU event] +------------------------------------------ + +$# perf stat -a -e "hisi_l3c0_2/read_allocate/" sleep 5 +$# perf stat -A -C 0 -e "hisi_l3c0_2/read_allocate/" sleep 5 + +The current driver does not support sampling. So "perf record" is unsupported. +Also attach to a task is unsupported as the events are all uncore. + +Note: Please contact the maintainer for a complete list of events supported for +the PMU devices in the SoC and its information if needed.