From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B01C433E1 for ; Wed, 15 Jul 2020 02:05:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 906D320663 for ; Wed, 15 Jul 2020 02:05:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YUR6Lc3G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728237AbgGOCFv (ORCPT ); Tue, 14 Jul 2020 22:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgGOCFu (ORCPT ); Tue, 14 Jul 2020 22:05:50 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A55C0C061755 for ; Tue, 14 Jul 2020 19:05:50 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id z5so1168741pgb.6 for ; Tue, 14 Jul 2020 19:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=7/Gfwk+DS7GBHyMfJAg29h1M+nONHVWzDeqMwBHi0xE=; b=YUR6Lc3G6i0FvqSkKps61Lmea72qgGLz3WCUuMsu2AhhimxaJdhtNLl8AyP9aFXJ0I 1QZtqBY4iFk7eUDQlJWcEQPDnmJtPlcCeUiDxkXfre5ORokCj2KlDwuXTXPNTQXeyMoF jl1ucKXQAqSHcmpIyyBB65pDXgY3cyAdDnVwvbj7su/I6kzfeC5a1sQhgr0iAkgSn5A4 UyYfMOBdOo5qlgqpw+8WAKzmr3DOx4VybjG0hVA3K3vYbsQ5D42BOuN/MOZzkKT5QEq/ 7uUJQyXcSawVxdRaz6phyOveay0PuxUZDU0jCg4B9b227FDPM8DAyKOfP5VXWLFyOh8/ vnCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=7/Gfwk+DS7GBHyMfJAg29h1M+nONHVWzDeqMwBHi0xE=; b=P+CgGAl/vl18CNf1oDBctlw1bAZ9rRtUvY1IQeP6WadZRtcXmnckY5sCoHU26PvyPl ZIzrER/XLvCNuQl57DuO5+IrnmI+Juee6vx064NEFwHYtH7yyIqKeXnH9exWGGC2Rtu/ 2XdrHqhsYguWJCWoq8WZvm9R5wgAbuWSMlSF0fSHt3wDTV5t5ZlpbwmbdzNySO3+BnSm RrNrHDVQjT65cdsh7ivvVhogtI205y6yVuE3ltV65Htu983Ep+OejtXq6Y3VRWJNpICI OMMJKtj9o/Xfo+moFxnteAmItOq9C4zUVfexckcNTNbdBnt9U/Pe7CjVaLvBZ3EJWxoZ 9Osw== X-Gm-Message-State: AOAM531JC0e2gjW04kEu3njvC3XTOGAXZtG1uh1LwE7XouGZiJx5mp6r OPX1k22YRY0bPKicyYfa11t3xw== X-Google-Smtp-Source: ABdhPJwV/5lGCdOshqU/M3J8xvahpLeG8JkJAxdd84ZmMrsq1MKHsDo2FG1Jwtv9lwt07qLGKhqisA== X-Received: by 2002:a65:6411:: with SMTP id a17mr3406498pgv.450.1594778750164; Tue, 14 Jul 2020 19:05:50 -0700 (PDT) Received: from localhost ([2400:8904::f03c:91ff:fe8a:bbe4]) by smtp.gmail.com with ESMTPSA id h15sm366740pfo.192.2020.07.14.19.05.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 19:05:49 -0700 (PDT) From: Leo Yan To: Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Catalin Marinas , Thomas Gleixner , Paul Cercueil , "Ben Dooks (Codethink)" , "Ahmed S. Darwish" , Adrian Hunter , Kan Liang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] arm64: perf: Only advertise cap_user_time for arch_timer Date: Wed, 15 Jul 2020 10:05:09 +0800 Message-Id: <20200715020512.20991-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715020512.20991-1-leo.yan@linaro.org> References: <20200715020512.20991-1-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra 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(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 35c2c737d4af..76f6afd28b48 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -1170,16 +1172,15 @@ void arch_perf_update_userpage(struct perf_event *event, unsigned int seq; u64 quot, rem, ns; - /* - * 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; @@ -1211,4 +1212,10 @@ void arch_perf_update_userpage(struct perf_event *event, 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; } -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F395FC433DF for ; Wed, 15 Jul 2020 02:13:46 +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 C06822074B for ; Wed, 15 Jul 2020 02:13: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="gOFXqNio"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YUR6Lc3G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C06822074B 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+linux-arm-kernel=archiver.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:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=u/tGXmwNafVmJnPod8E2J8Efxn3yuDSKmD+TU5GthK4=; b=gOFXqNiowaEfWtSW5DOL8/CMQJ Nxp5kpzKP55P/uPFuwp7vnw32k+KL+s49/zf5nVecXhONP53xPuJxVz1tdPRFA/GO1PevWmNlxfNX P6iu1g7X0VWB2qGXRhfL0UBbv0OWKKNm/AHtska9Wc+WUEUBq3vSnfdGLOvBqQC7eYnilf0qN/b4b xrM49X+S3wDN5HibY7EaQu6ynHOsJuQDJKO+dfFgGmZgUVVmiHyHpt16o+quhcExs59ig85Ewx+Z1 f6Ajd/zOM1Nxe4XVZ/rnu7c+/Ttf+9GjX1dkTPOpyH3eVmbN7AG71Rv/b41Eq9T/jm7sz4nJw007e 72FkpP2w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvWuD-0000K3-Rz; Wed, 15 Jul 2020 02:12:21 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvWuA-0000JF-3W for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 02:12:19 +0000 Received: by mail-pg1-x541.google.com with SMTP id l63so1190229pge.12 for ; Tue, 14 Jul 2020 19:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=7/Gfwk+DS7GBHyMfJAg29h1M+nONHVWzDeqMwBHi0xE=; b=YUR6Lc3G6i0FvqSkKps61Lmea72qgGLz3WCUuMsu2AhhimxaJdhtNLl8AyP9aFXJ0I 1QZtqBY4iFk7eUDQlJWcEQPDnmJtPlcCeUiDxkXfre5ORokCj2KlDwuXTXPNTQXeyMoF jl1ucKXQAqSHcmpIyyBB65pDXgY3cyAdDnVwvbj7su/I6kzfeC5a1sQhgr0iAkgSn5A4 UyYfMOBdOo5qlgqpw+8WAKzmr3DOx4VybjG0hVA3K3vYbsQ5D42BOuN/MOZzkKT5QEq/ 7uUJQyXcSawVxdRaz6phyOveay0PuxUZDU0jCg4B9b227FDPM8DAyKOfP5VXWLFyOh8/ vnCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=7/Gfwk+DS7GBHyMfJAg29h1M+nONHVWzDeqMwBHi0xE=; b=UxmvqvJvTQBlzO2dIZGTZsxPL+Oa3BsxZofQhk1AKpn/TV6wNpZRuvtj0h/0EAQt6g O3nx/c0ccW+J2gLw6+udSYJuIAHO5b+1xlx5OR3lC7bWqKg+Z5otzGUdIComQ1kgXnN9 hEYYwXjMG7vIIBmtj3f/Anc3M0XBJpMo+A4+14psuF2gzs4ibdnfktXL1kKTR2DXj37L iRK3HUWUihxJID5a+rTEct/hZkiLfl3Zu/Ad+mNcsH3F8Mtv0OxXDDQdrrVH4Ypg4w0+ NZhwyL33VkJAvGBWdMsAf43+Caxd4I8yrfUD+DRDksV343YOq7x9RcgKw62MDwW0AttN 8klw== X-Gm-Message-State: AOAM53090Je2qaWxp/0qFn8gloByib7PzqR+oyGDdHw/HGIAaDgfQozw 9jr3wkcU3+bYXzfprtRXTbVigHsBlisvMw== X-Google-Smtp-Source: ABdhPJwV/5lGCdOshqU/M3J8xvahpLeG8JkJAxdd84ZmMrsq1MKHsDo2FG1Jwtv9lwt07qLGKhqisA== X-Received: by 2002:a65:6411:: with SMTP id a17mr3406498pgv.450.1594778750164; Tue, 14 Jul 2020 19:05:50 -0700 (PDT) Received: from localhost ([2400:8904::f03c:91ff:fe8a:bbe4]) by smtp.gmail.com with ESMTPSA id h15sm366740pfo.192.2020.07.14.19.05.49 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 19:05:49 -0700 (PDT) From: Leo Yan To: Will Deacon , Mark Rutland , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Catalin Marinas , Thomas Gleixner , Paul Cercueil , "Ben Dooks (Codethink)" , "Ahmed S. Darwish" , Adrian Hunter , Kan Liang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] arm64: perf: Only advertise cap_user_time for arch_timer Date: Wed, 15 Jul 2020 10:05:09 +0800 Message-Id: <20200715020512.20991-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715020512.20991-1-leo.yan@linaro.org> References: <20200715020512.20991-1-leo.yan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200714_221218_412612_CA75C8EA X-CRM114-Status: GOOD ( 13.72 ) 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: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peter Zijlstra 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(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 35c2c737d4af..76f6afd28b48 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -13,6 +13,8 @@ #include #include +#include + #include #include #include @@ -1170,16 +1172,15 @@ void arch_perf_update_userpage(struct perf_event *event, unsigned int seq; u64 quot, rem, ns; - /* - * 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; @@ -1211,4 +1212,10 @@ void arch_perf_update_userpage(struct perf_event *event, 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; } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel