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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 3DB9AC433E0 for ; Wed, 15 Jul 2020 08:39:20 +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 0B8F6206E9 for ; Wed, 15 Jul 2020 08:39:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="M4/rMfK2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B8F6206E9 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+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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=daSrlB2C1ThPvAf4Ml6vK01nyjpkO6pO8v0AGKlvgv0=; b=M4/rMfK2/SXSNaJgIrS8PSmxb tHNeyI0qyTYRbC67cMtjAQABWCrO6kVb7uOs5Pk+3jZwP/Tb45vHznyJGIwB0FlZqvrySvNb1IvXQ fmAqY/ddvkFKxiipGtZrAqnfKnMd7vsc6/X3FMVFZJ2H50Xr/Hv/V5AbMaTs2mUBqP2vq9ThMwU5O DmR7IBWBzV9S1vPh3VK5aVhvrRC4C5x/H8c6igynd6q3ZKUn0pqFHNZn62PUggKoNOCzzbiqmdqXI nvekAK5OpCzQHHG1KN4Op5ITNJWkCAcAYVta4DgDb8bKFD8XSmL6IuGJgZBtCQdmxfL7aJ91ntsys /DQebpZsg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvcvY-0000CU-AQ; Wed, 15 Jul 2020 08:38:08 +0000 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 1jvcvV-0000Bo-Oa; Wed, 15 Jul 2020 08:38:05 +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 F2B1A300446; Wed, 15 Jul 2020 10:38:00 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B270023648708; Wed, 15 Jul 2020 10:38:00 +0200 (CEST) Date: Wed, 15 Jul 2020 10:38:00 +0200 From: Peter Zijlstra To: Leo Yan Subject: Re: [PATCH v2 2/6] arm64: perf: Implement correct cap_user_time Message-ID: <20200715083800.GC10769@hirez.programming.kicks-ass.net> References: <20200715020512.20991-1-leo.yan@linaro.org> <20200715020512.20991-3-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200715020512.20991-3-leo.yan@linaro.org> 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: Mark Rutland , Alexander Shishkin , Will Deacon , "Ahmed S. Darwish" , Adrian Hunter , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Paul Cercueil , Ingo Molnar , Catalin Marinas , Namhyung Kim , Thomas Gleixner , Jiri Olsa , "Ben Dooks \(Codethink\)" , linux-arm-kernel@lists.infradead.org, Kan Liang 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 On Wed, Jul 15, 2020 at 10:05:08AM +0800, Leo Yan wrote: > [leoyan: Use quot/rem to convert cyc to ns to avoid overflow] > + quot = rd->epoch_cyc >> rd->shift; > + rem = rd->epoch_cyc & (((u64)1 << rd->shift) - 1); > + ns = quot * rd->mult + ((rem * rd->mult) >> rd->shift); > + userpg->time_zero -= ns; I think we have mul_u64_u32_shr() for that. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel