From patchwork Sun Jul 16 10:05:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 9842865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A027360393 for ; Sun, 16 Jul 2017 10:06:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9664528414 for ; Sun, 16 Jul 2017 10:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AD0928484; Sun, 16 Jul 2017 10:06:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CCB428414 for ; Sun, 16 Jul 2017 10:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Subject:To:From:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=IPGGZacWkIcMj47qtfkp9pSqTXedpRdkA6Chd3C3iPk=; b=POs Yqhbf9cNaEJLv7QkRboWboqpVLOe1GuqgYbT36Kk48E5MFkM+Xo2Yla/Ds+kSDQDew6CEs2MGclc/ 8Ca0eejRCR1odBVGjdKnkQm+BKyHpBPLH+/H6iErlgjWDEoJwMbYVBq2C6JrboOzIwc4g41KWiOAz rnmg5xFfR67qYx9p8jfBPTv7Ro2A6snZGDvjYhm9PJQR8Kv9F7v12P9zkNz2tXKIpt9XiKvXunp0F fDek5zSdKp4Z5FL2rSknrrj9oEguMZPqqeX1xU85/mUtR96pV4jznXEZtau2wo/PTwFjdaB1SR1Oo b2j4fVrW+FCl9VhwjivNRkHFHyF09NA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dWgRQ-0001JG-VY; Sun, 16 Jul 2017 10:06:20 +0000 Received: from lstlambert-657-1-117-164.w92-154.abo.wanadoo.fr ([92.154.28.164] helo=golem.pkh.me) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dWgRM-0001Ib-KR for linux-arm-kernel@lists.infradead.org; Sun, 16 Jul 2017 10:06:19 +0000 Received: from golem.pkh.me (localhost.localdomain [127.0.0.1]) by golem.pkh.me (OpenSMTPD) with ESMTP id 182ef42b for ; Sun, 16 Jul 2017 10:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pkh.me; h=date:from:to :subject:message-id:mime-version:content-type; s=selector1; bh=i xm8f0WrTySxH1qSvWTylIuNnsQ=; b=HdLQy7vqx4H7KK7lsVxPzhhfe8ZNv+2ls kCBxbk45zf4DyCFMOQv+tf7A0/Dz+Sj/MLj2Kfu0cIeIjXmKip+KUTceB/NyDiNy 7YCUm2bNVtzbCtkI3aKjWHxcdSwFygZxZO5lzmX3DrKI8vQczZKlJoQ+dLjU5dvS SefdECsCTNUD7dDopnAPVWMmQN7fRxhW4cN0sgX8LuYY+dNRb8aT+tXzqNIwjBNc hZv7sA5NlBh+5S/i7eujt/uwgIuiAVYtPwW3hbP0Ypyp7bnYSd9F70aKjFbq2KTo 6USF0i8lZFV0Y//iY3KS3clWEmSRihxMoJabgq/FlDFLzH7l+IPRg== DomainKey-Signature: a=rsa-sha1; c=nofws; d=pkh.me; h=date:from:to :subject:message-id:mime-version:content-type; q=dns; s= selector1; b=C90VXA3Le+YL4Cgz5yWxYLhbh94kHG1wHfeWZO2HZtcN0QyVB9E 2Ngx/DHAe9BdzEiNEE/+yTeSBOvlH7YTMYSpLBCerZhC8ru76aDMwTFE/AMXLs+K zqqdH6kAJAg/pRVTdlKGUK671q9i21ewKOyCYUxFEUBamRmBPJvDGLC4v2QwG9un TN8HcDtQ1EcK4kGm182Y2zHF+Ah37isxFGTy2Zy9Xw3QABEZv5vlN7IVd6z2OZ9A nYbjDf41opuP/K1d1w3d1PHAF3PV64qYc3+qdmmZcnBN1ILFTG4p1QGE7D2+up8x p8hTDaQwG8Mtwy2hc6h/fzR1e9yfx/zGTdw== Received: from golem.pkh.me (localhost.localdomain [127.0.0.1]) by golem.pkh.me (OpenSMTPD) with ESMTPSA id f1c2440f (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Sun, 16 Jul 2017 10:05:48 +0000 (UTC) Date: Sun, 16 Jul 2017 12:05:37 +0200 From: =?utf-8?B?Q2zDqW1lbnQgQsWTc2No?= To: linux-arm-kernel@lists.infradead.org Subject: Questions about PMU counters Message-ID: <20170716100537.GA15094@golem.pkh.me> MIME-Version: 1.0 User-Agent: Mutt/1.8.3 (2017-05-23) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170716_030617_180194_CF293822 X-CRM114-Status: GOOD ( 18.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, I have a few questions about the PMU counters I couldn't get anywhere else. Hopefully this is the right place. 1. Device-Tree: pmu vs arm-pmu But it didn't make any difference. Q: any idea where I can find more information on this? I couldn't get any help from 96boards. 4. Quick questions ================== Q: Where can I find the "interrupt" parser of the device-tree? (I'm trying to verify I understand correctly how exactly is handled 1, 2 and 3 parameters forms). Q: rpi3 seems to have perf counters in 32-bit but not in 64-bit. I don't understand why: they seem to both share the same device-tree. Oh, and that bcm2837 doesn't seem to even have pmu declared, so I'm confused. Q: Why "v3" in "armv8-pmuv3"? Q: I watched an old talk about device trees, and one of the main issue seemed to be the impossibility to keep API/ABI compatibility forever. What came out of this wrt the process of defining how to write device trees? Note: as you probably guessed, I'm completely new to all this stuff, so if you can answer at least one of these questions, this will probably help me a lot finding my way in the forest. Thanks, ============================== Documentation/devicetree/bindings/arm/pmu.txt is documenting "pmu" as identifier, but both "arm-pmu" and "pmu" seems to be used interchangeably in the codebase in both arch/{arm,arm64}. While most of the codebase seems to use "pmu", drivers/perf/arm_pmu.c is also checking for the exact "arm-pmu" string. Q: what is the difference between the two? 2. Userspace access =================== An RFC patch was sent a few years ago to allows userspace access to the PMU counters: https://patchwork.kernel.org/patch/5217341/ AFAICT, this was not mainlined as a module or the suggested sysfs control. I tried to contact the author of this patch but got no answer. The perf API may be considered good enough for end users, but some projects have their own benchmarking framework which they want cross-platform, with as little overhead as possible (FFmpeg is one of them). Currently, the only workaround seems to use this lost module, which "recently" got arm64 support: https://github.com/zhiyisun/enable_arm_pmu/ I confirm it's working on various boards I tested, but it's still not ideal (typically, it's breaking badly if perf is used at the same time). Q: did anything come out of this, is there any plan, or is there a decision to not doing this? 3. ACPU controller for the Hikey ================================ This question is specific to the Hikey (hisilicon/hi6220-hikey.dts). While I was able to get PMU counters access through enable_arm_pmu with most of my boards, it made no difference for the Hikey. So I was under the impression that the board needs a special treatment to enable these PMU counters. Anyway, according the specifications, there is an ACPU interrupt ACPU_PMUIRQ_intr=131 (so SPI 99) "combined interrupt of the eight core CoreSight interrupts of the two clusters of the ACPU)." Just in case, I naively attempted: diff --git a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi index 470461ddd427..98fb2c775540 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220.dtsi +++ b/arch/arm64/boot/dts/hisilicon/hi6220.dtsi @@ -171,6 +171,11 @@ CLUSTER1_L2: l2-cache1 { compatible = "cache"; }; + + pmu { + compatible = "arm,armv8-pmuv3"; + interrupts = ; + }; }; cpu_opp_table: cpu_opp_table {