From patchwork Tue May 12 12:41:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 11543103 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 6C34192A for ; Tue, 12 May 2020 12:47:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 ED4B120736 for ; Tue, 12 May 2020 12:47:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rWnzToBD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ZXKExd2Z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED4B120736 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Subject:To:From :Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=MT4UKDvpXI0oKQN33rt6Dcj0/6hinbD6Ar4ZXXCihX8=; b=rWnzToBDv6ea0W zUUM/xuXaxqBwLNFlNFHwD+N6bZrsGNo796SSWJ+uF6mIxNj3+PZ2R8be6Mu2xyeEsx/XcinsMDs5 44at+WZRgmMVJ12CpzAo2J7/2pfradnGFLsgevlQkDrrNwhuXFVJ/gCyK70A66y03NEt7QUi9TzkK CU+vJGC679X3LETZOT+y4vpcjM2i0D0f2cbMs9VHGohHvkA4OpFP9IoOs0Yy8f5MraBursSoXSiBe jw9pKaZNKgzg2OhdtJwRBuV6sBVkTWhJ1WTpbMEqk0DtkSd8lcPtPOk3f4bZ8oj317On4PUXR1Qyj x0HEQtzOI6/F0djUhK2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYUJz-0007r4-9Q; Tue, 12 May 2020 12:47:43 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYUJK-0007EQ-3x for linux-arm-kernel@bombadil.infradead.org; Tue, 12 May 2020 12:47:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=ngZs8drZ7QXRvmUeJGP4y1pSY454qouM1a6376s95vs=; b=ZXKExd2ZH/XmhPLQHFbAQkMSxn dtYYboA1nY3FF0+yBsWq4FobSf6GFGhLCUnrmPQKSwpiQXmIV3cV2L6rZcbI9u2qE3py6oq7zbcbs hk1tIwy76YSm8bbl/m3NhC+y3YCZNGRA/jO6FkHQ18bXcaNMQNxCkd2EDNP0UwD/tgvsXZEbcAs0B CXp1eX2wUz3BoeuMCPyAcyKmqoSNwbfC6FXLY6/zsfjiD3Y3IzSFTf2DixAOYpO/QPt8EVYqB93h8 kKe1Y0411ra2oOuYlKZR5XuqE3bLWJIkCZL7Go7oBqH84dQmlS85SxJMUpI/kgZwb1+0CdRMW+dRK IxNP2Jow==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYUJF-0003GZ-ID; Tue, 12 May 2020 12:46:57 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 44CCC304DB2; Tue, 12 May 2020 14:46:53 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id 2DA2820962E55; Tue, 12 May 2020 14:46:53 +0200 (CEST) Message-ID: <20200512124450.903534446@infradead.org> User-Agent: quilt/0.66 Date: Tue, 12 May 2020 14:41:01 +0200 From: Peter Zijlstra To: Will Deacon , Marc Zyngier , Mark Rutland , Catalin Marinas , Leo Yan Subject: [PATCH 3/5] arm64: perf: Only advertise cap_user_time for arch_timer References: <20200512124058.833263033@infradead.org> MIME-Version: 1.0 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: alexander.shishkin@linux.intel.com, daniel.lezcano@linaro.org, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, acme@kernel.org, "Peter Zijlstra \(Intel\)" , mingo@redhat.com, john.stultz@linaro.org, tglx@linutronix.de, jolsa@redhat.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When sched_clock is running on anything other than arch_timer, don't advertise cap_user_time*. Requested-by: Will Deacon Signed-off-by: Peter Zijlstra (Intel) --- arch/arm64/kernel/perf_event.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -1169,16 +1171,15 @@ void arch_perf_update_userpage(struct pe struct clock_read_data *rd; unsigned int seq; - /* - * Internal timekeeping for enabled/running/stopped times - * is always computed with the sched_clock. - */ - userpg->cap_user_time = 1; - userpg->cap_user_time_zero = 1; + userpg->cap_user_time = 0; + userpg->cap_user_time_zero = 0; do { rd = sched_clock_read_begin(&seq); + if (rd->read_sched_clock != arch_timer_read_counter) + return; + userpg->time_mult = rd->mult; userpg->time_shift = rd->shift; userpg->time_zero = rd->epoch_ns; @@ -1207,4 +1208,10 @@ void arch_perf_update_userpage(struct pe userpg->time_mult >>= 1; } + /* + * Internal timekeeping for enabled/running/stopped times + * is always computed with the sched_clock. + */ + userpg->cap_user_time = 1; + userpg->cap_user_time_zero = 1; }