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 6A570C433E7 for ; Wed, 15 Jul 2020 02:06:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C38A20663 for ; Wed, 15 Jul 2020 02:06:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cS481nZ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728265AbgGOCGI (ORCPT ); Tue, 14 Jul 2020 22:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgGOCGH (ORCPT ); Tue, 14 Jul 2020 22:06:07 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F01C3C061755 for ; Tue, 14 Jul 2020 19:06:06 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id cm21so1302674pjb.3 for ; Tue, 14 Jul 2020 19:06:06 -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=BWe0eEqZlg5KtSwKDX8dzWYLdIuFkfJ6SNclopNBxM4=; b=cS481nZ8/3HVzld0YdIzWieqhAS+5a+P/1/6y2CDxpjrr2uEmRvRLWK+yj+evifIdc /AQ3xdfPdgLCAe/oav8qqHhWmSr9Dj52DxEayP9acPeRibhBjKQGHKq+raaOSYPCEI/2 SedvXRdZ0vf2XkFdXpqA/fYZdxr2h299zO5Cz51iiymn+wsTRcv1Y677C16BYHxX7ek+ M4xtKEpCBO6tN+B5w8ypoYhIf3RCchT8hL/QSxm2fkmDHDXijK4Bmpv4Sru5Y5Y3gN4L bBb4QQsrgr1oCub37rzRNo4yQCqNwWEqPg0G+WVGGRqHSydwwae8EiFpLFzlzwlAUi+t EwLA== 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=BWe0eEqZlg5KtSwKDX8dzWYLdIuFkfJ6SNclopNBxM4=; b=tRD6Gu8EQd6lGf7p2SpgGahGoTL3nEGwOEl3FXsXOCiI/9n+tdFeQvOHgR5HIe9hpN QcNyQHrEQOhSC91QeekeFU9hHbz3N+SvrU+hYEqfEcfHXqQurrx7uOGFHiXnQ23x7sEh cDGDzsiWHDAjdInqiPzd0ZydSlnf/Asx48e+EKuIuJ1pIN4SuXL/IbMdOtzsMrWPGLyj uQNX09vKosGOAtbKYXkLc98PVB89N9BwRZ6WMi+YrXtgiuMUb9JAqA1p+FtamWor/70w xiS/FrwlPvh+cnh43hHFS3U1vMYtoiLtmmu+9xnQH/83jx2at67cETCdexASfygPn5dV 5DKg== X-Gm-Message-State: AOAM533WbtrI6ljyxJVz8905u0I99ZH4h/fD7zTVdQ3UvPdpAejayJtw n9LuSijnLj85sxdolsHQeGNBVA== X-Google-Smtp-Source: ABdhPJxcAQQNi6Qcy+NhhnvhF349xyBGbkOGhog3d/+wdL8gBWjrl4CsxqOiTM4TFRwDBkTeEA5Pcw== X-Received: by 2002:a17:90a:a78b:: with SMTP id f11mr7261791pjq.42.1594778766537; Tue, 14 Jul 2020 19:06:06 -0700 (PDT) Received: from localhost ([2400:8904::f03c:91ff:fe8a:bbe4]) by smtp.gmail.com with ESMTPSA id y24sm364459pfp.217.2020.07.14.19.06.05 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 19:06:06 -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 5/6] arm64: perf: Add cap_user_time_short Date: Wed, 15 Jul 2020 10:05:11 +0800 Message-Id: <20200715020512.20991-6-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 This completes the ARM64 cap_user_time support. Signed-off-by: Peter Zijlstra (Intel) --- 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 76f6afd28b48..1e0f15305f67 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. */ quot = rd->epoch_cyc >> rd->shift; rem = rd->epoch_cyc & (((u64)1 << rd->shift) - 1); @@ -1218,4 +1219,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; } -- 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,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 89183C433E2 for ; Wed, 15 Jul 2020 02:07:29 +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 561A820663 for ; Wed, 15 Jul 2020 02:07:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eyX2BkZN"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cS481nZ8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 561A820663 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=jJytpS5DlMLNWKLnSMYAyyOgHLk+asYyhucxbzUVxcQ=; b=eyX2BkZNd64ACl8XHiPamGsomB CdjT+0eO5YYCc4Nj8LmrXEpns7LSy/9/I6693UttaStYomo0VbvvcTDYQ9X+03/Cr4Q9Zy7NFphti I3SNXR91dZKzMb6XOmF6N1KRpktHMITI7qXg7yZADdMWhLoFega0zsE8Bs+mfuew20UdY7ddHSQWY mGV29v+YtAY2rlwQo//ojkEuDSVVLaIx6C3mePbf6RQ4Jm4asHiYw2mKKo7rh1jyv1YlQ4zcyQ4vX 71uTijiwFG5W12LtsptBBJpcUuCrSKtaYdj+DKHgfevHSo/USq6w7tGQdmwydLoz3cm/2nu/KUtNU ol4LSISg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvWoH-0007Vi-8n; Wed, 15 Jul 2020 02:06:13 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvWoC-0007Th-9S for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 02:06:09 +0000 Received: by mail-pj1-x1041.google.com with SMTP id ls15so1304784pjb.1 for ; Tue, 14 Jul 2020 19:06:08 -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=BWe0eEqZlg5KtSwKDX8dzWYLdIuFkfJ6SNclopNBxM4=; b=cS481nZ8/3HVzld0YdIzWieqhAS+5a+P/1/6y2CDxpjrr2uEmRvRLWK+yj+evifIdc /AQ3xdfPdgLCAe/oav8qqHhWmSr9Dj52DxEayP9acPeRibhBjKQGHKq+raaOSYPCEI/2 SedvXRdZ0vf2XkFdXpqA/fYZdxr2h299zO5Cz51iiymn+wsTRcv1Y677C16BYHxX7ek+ M4xtKEpCBO6tN+B5w8ypoYhIf3RCchT8hL/QSxm2fkmDHDXijK4Bmpv4Sru5Y5Y3gN4L bBb4QQsrgr1oCub37rzRNo4yQCqNwWEqPg0G+WVGGRqHSydwwae8EiFpLFzlzwlAUi+t EwLA== 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=BWe0eEqZlg5KtSwKDX8dzWYLdIuFkfJ6SNclopNBxM4=; b=bv1QaIxZc/6RTcu6k70MC/aBqtuynZ5/1ocryReBN0YCBM3QBwpixaR59MLWYWSpsI ojsOJdRpURd9iyli9Xf77Nct8hZhsqNKr0ga2GELf6lu0ohn+tYJj1Rg3DKLRpptLW6h 5rquH7L/UN0e5yJqybSvl28E3oKQvim+JTQGPL5wkCUGm5g9A7gO5AywDzWyHuj36/uh 53cFa7YJiRE3b/ttyZ8SucRHoAPyVcY+QcoqOZfN8EKUKDZycmXlGSRRLtt+EwOkmN6v 0/mNea4SxExTVuB7gVW49zGJ7TsqdBEkhKULQ2Rfi5lqAipk/D07vs+tNRv7rn3VoytX 3sqw== X-Gm-Message-State: AOAM531TQtM2VfBSTJHN3SyyWZhTVVJWGTwED8R9N0FIrTkDV2gM78A0 sXrFsAjQTFuBwIGpU/qGcwB5DQ== X-Google-Smtp-Source: ABdhPJxcAQQNi6Qcy+NhhnvhF349xyBGbkOGhog3d/+wdL8gBWjrl4CsxqOiTM4TFRwDBkTeEA5Pcw== X-Received: by 2002:a17:90a:a78b:: with SMTP id f11mr7261791pjq.42.1594778766537; Tue, 14 Jul 2020 19:06:06 -0700 (PDT) Received: from localhost ([2400:8904::f03c:91ff:fe8a:bbe4]) by smtp.gmail.com with ESMTPSA id y24sm364459pfp.217.2020.07.14.19.06.05 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Jul 2020 19:06:06 -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 5/6] arm64: perf: Add cap_user_time_short Date: Wed, 15 Jul 2020 10:05:11 +0800 Message-Id: <20200715020512.20991-6-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_220608_386902_54DF9293 X-CRM114-Status: GOOD ( 12.45 ) 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 This completes the ARM64 cap_user_time support. Signed-off-by: Peter Zijlstra (Intel) --- 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 76f6afd28b48..1e0f15305f67 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. */ quot = rd->epoch_cyc >> rd->shift; rem = rd->epoch_cyc & (((u64)1 << rd->shift) - 1); @@ -1218,4 +1219,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; } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel