From patchwork Thu Jul 16 05:11:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 11666669 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEB2D13A4 for ; Thu, 16 Jul 2020 05:14:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A69A5207BB for ; Thu, 16 Jul 2020 05:14:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R4fLnWSU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="krIWOXFg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A69A5207BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JLVAHmV7sIXWynu7GAKbPDHjPlwXFJvXzIqNBGq8/yY=; b=R4fLnWSU3fLDLhHEidGnuxmSvR K1Fy8krnyOI2SWoSiu96MzJfiKms8KZ3aItOEYBDezDiYnSuAkEEMgdabJbBftm1BCCa9NMB9OesU ADZ4svZ3O9oSUizc8Qj4lF/IRDk8MjxvHUdH1P6k8gGEMrsntwE7yvR7e+jSGFalQLQyuGLGv6hC4 MHxKE/AGuOwUKWwj1JyrYmSszSGSrapNZSG6gUS/cFKWh3bWCm5cZddEH9fcEm8zu1qlrSQuXJUZl kZEyGFa2FC19eV/MmG97ZrO5EdiRbBxQseqp3srlsJptWutr1Ukc2+3dKdZDHbvUUPTB62uVAH8IE Fo/rqblQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwCR-0005ju-AV; Thu, 16 Jul 2020 05:12:51 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwCM-0005hC-RP for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 05:12:47 +0000 Received: by mail-pl1-x641.google.com with SMTP id m16so3358059pls.5 for ; Wed, 15 Jul 2020 22:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9SuwXG5wYWJjKAU5flve9nJ1dK7+MJYoWmtIlrptV4I=; b=krIWOXFgIeM3ecJz/r74xx6HpdmDjHKKU8d9VmYrCjaWOM76YlH8WKFVtDlhMXxJCV N1kshlioH70saQvzgIiD65BamQnO4wxV8dDroEHJx9BpV+u3dPt5Gx3L6SX3Zb9r80Ab b3GJ3j7tjwTDQm7q7A1ZYBHDKzhZwJSCyIiegcXYthgzta8sT+dPfBYyVprpkKjzm4GS nPO1b6tGOKS+ihfG4Sc58vMmdbRyqxsjsIouW60F8Fn1zkuEeqVBkVLqIB5Dw0jMBmeh nmz3G6ZdO12uxRk1zXHRxurZueMzMS5BkuJ3HkkwYGk3dtWmbExR1yxyOccsZSUwptA/ ckDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9SuwXG5wYWJjKAU5flve9nJ1dK7+MJYoWmtIlrptV4I=; b=qnUfEl84dNk4Nw7AMHWijcjTMYjIinZY9UdUbr8sLvXr3lmiVyFmfCKKUTa4GzljUG ACutQUj3wyM7NXZnuwnVYA2k6NRy5/s9cWuPqqiO9um8YewmhvnNV4TXt40LNnf/MEJM 0IVe0yfeB9sTuckTOQBOyYeu22vYp/wUXKbF46koonn1uKwuIZwmImYpnILAfX8rSwKL UGl5HNVqG5ceY3dpKnqvslNxVR74iEjsnKPJ6zogYL1/V/4OaKK3DGsc7MEWP5kFONyb 1BD+Wh9uIJqW9sVHD7sNXN8SRcnG4QqH5+O+793ET5JUlWJ8FG0ws5rOx0MYfaBCGi4v urKg== X-Gm-Message-State: AOAM5337YuaWL3/wtcAQm+/zANJDkvhbjNwqOIoyPIilo0Ueg239sL1d yIlVD4OoHNROYjfTn1sDi8FGGQ== X-Google-Smtp-Source: ABdhPJzOQxiFHywkTQOU5cdSK+Q4FRgeK3RFG1TxHSXZ1LJrkJiq2mpEHfQHBWxgWjUYdMVODsOS/g== X-Received: by 2002:a17:90b:4b12:: with SMTP id lx18mr3346143pjb.156.1594876364801; Wed, 15 Jul 2020 22:12:44 -0700 (PDT) Received: from localhost ([2400:8904::f03c:91ff:fe8a:bbe4]) by smtp.gmail.com with ESMTPSA id n25sm3525709pff.51.2020.07.15.22.12.43 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Jul 2020 22:12:44 -0700 (PDT) From: Leo Yan To: Peter Zijlstra , Will Deacon , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Catalin Marinas , Thomas Gleixner , "Ahmed S. Darwish" , "Ben Dooks (Codethink)" , Paul Cercueil , Adrian Hunter , Kan Liang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 6/7] arm64: perf: Add cap_user_time_short Date: Thu, 16 Jul 2020 13:11:29 +0800 Message-Id: <20200716051130.4359-7-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200716051130.4359-1-leo.yan@linaro.org> References: <20200716051130.4359-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_011246_973900_ECE276B9 X-CRM114-Status: GOOD ( 12.70 ) X-Spam-Score: 3.4 (+++) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (3.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [2400:8904:0:0:f03c:91ff:fe8a:bbe4 listed in] [zen.spamhaus.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Yan MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Peter Zijlstra This completes the ARM64 cap_user_time support. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Leo Yan --- arch/arm64/kernel/perf_event.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index c016b116ae33..888bcb5d1388 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -1174,6 +1174,7 @@ void arch_perf_update_userpage(struct perf_event *event, userpg->cap_user_time = 0; userpg->cap_user_time_zero = 0; + userpg->cap_user_time_short = 0; do { rd = sched_clock_read_begin(&seq); @@ -1184,13 +1185,13 @@ void arch_perf_update_userpage(struct perf_event *event, userpg->time_mult = rd->mult; userpg->time_shift = rd->shift; userpg->time_zero = rd->epoch_ns; + userpg->time_cycles = rd->epoch_cyc; + userpg->time_mask = rd->sched_clock_mask; /* - * This isn't strictly correct, the ARM64 counter can be - * 'short' and then we get funnies when it wraps. The correct - * thing would be to extend the perf ABI with a cycle and mask - * value, but because wrapping on ARM64 is very rare in - * practise this 'works'. + * Subtract the cycle base, such that software that + * doesn't know about cap_user_time_short still 'works' + * assuming no wraps. */ ns = mul_u64_u32_shr(rd->epoch_cyc, rd->mult, rd->shift); userpg->time_zero -= ns; @@ -1216,4 +1217,5 @@ void arch_perf_update_userpage(struct perf_event *event, */ userpg->cap_user_time = 1; userpg->cap_user_time_zero = 1; + userpg->cap_user_time_short = 1; }