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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 CAD7BC33CA9 for ; Mon, 13 Jan 2020 17:09:44 +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 97E6E2187F for ; Mon, 13 Jan 2020 17:09:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ga2I/+G2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=c-s.fr header.i=@c-s.fr header.b="HtFNRPge" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97E6E2187F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=c-s.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Date:To:Subject: From:References:In-Reply-To:Message-Id:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Is+oS8XPLQa4EN5F9SjrMtWflYy/8ljvCITl8xvCO4I=; b=ga2I/+G2pk4N2rLmeSbma8Qkul SejsJbipeFBzase/PG91Wh0641vpInOLTSKzR/4m6fHOuWjYOdMjukfpYN8AxmNj7+7Bun1+PPHE9 KC5Uk8lJ7eS/luJ8QjzAo6S6kPQJn3CXZ2EmIDfLZiKdSm/SqL0WSQMkpxVEOgyw2gi5tQJPP4v7S xML+kPeprquZrBn2F6KHt+QHGiBmj1EEYyDkCD0m5nBcsZecGJxcvRL3ym6swW1VXwFKVaXXxrJVn vBu4MhzdMGPR0OC+utntCcqHA8w+WhzgC5Xth5fn9Vfx4pbw5z6JLpp8ZM82ixogbBHlKVlL7APNZ FG6W+eBA==; 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 1ir3Dh-0003Cz-R3; Mon, 13 Jan 2020 17:09:41 +0000 Received: from pegase1.c-s.fr ([93.17.236.30]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ir3Cp-0002Ko-8j for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2020 17:08:50 +0000 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 47xKmk72cCz9txyx; Mon, 13 Jan 2020 18:08:38 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=HtFNRPge; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id mjoWBsPHa-lT; Mon, 13 Jan 2020 18:08:38 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47xKmk5mb2z9txyq; Mon, 13 Jan 2020 18:08:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1578935318; bh=Eb2ZF+M9WBtPogiQVXilo9gV/urkBEO8lF9A3E/Edxw=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=HtFNRPgemN7felkbeT+FB0EwFPgnVRgimg07M9iZM8wdrHwAwhSoKmrDZbQvBZlfA n+uw1euzbaRGoi7intJLkB8fWtUVdQpvovV7HtTph8+lzZUOYBROTg3WQ6RYuxMmZf qrbTgWxm7Zg/Bj13VNbh0acYZyo3CV4jtooAuD9I= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 24A058B7C9; Mon, 13 Jan 2020 18:08:44 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id mGn9IhJ8RRPM; Mon, 13 Jan 2020 18:08:44 +0100 (CET) Received: from po14934vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E3A8A8B7BE; Mon, 13 Jan 2020 18:08:43 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id B3CB164A1D; Mon, 13 Jan 2020 17:08:43 +0000 (UTC) Message-Id: <9e4f75ca93c46b8aa0239f561f3a61dc713577f3.1578934751.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [RFC PATCH v3 05/12] lib: vdso: Avoid duplication in __cvdso_clock_getres() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , arnd@arndb.de, tglx@linutronix.de, vincenzo.frascino@arm.com, luto@kernel.org Date: Mon, 13 Jan 2020 17:08:43 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200113_090847_644402_CF596208 X-CRM114-Status: GOOD ( 12.04 ) 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: x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org 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+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org VDSO_HRES and VDSO_RAW clocks are handled the same way. Don't duplicate code. Before the patch: clock-getres-monotonic-raw: vdso: 737 nsec/call clock-getres-monotonic-coarse: vdso: 753 nsec/call clock-getres-monotonic: vdso: 691 nsec/call After the patch: clock-getres-monotonic-raw: vdso: 715 nsec/call clock-getres-monotonic-coarse: vdso: 715 nsec/call clock-getres-monotonic: vdso: 714 nsec/call Signed-off-by: Christophe Leroy Reviewed-by: Andy Lutomirski --- lib/vdso/gettimeofday.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index d75e44ba716f..decd3f2b37af 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -184,7 +184,6 @@ static __maybe_unused int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) { const struct vdso_data *vd = __arch_get_vdso_data(); - u64 hrtimer_res; u32 msk; u64 ns; @@ -192,27 +191,21 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) if (unlikely((u32) clock >= MAX_CLOCKS)) return -1; - hrtimer_res = READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res); /* * Convert the clockid to a bitmask and use it to check which * clocks are handled in the VDSO directly. */ msk = 1U << clock; - if (msk & VDSO_HRES) { + if (msk & (VDSO_HRES | VDSO_RAW)) { /* * Preserves the behaviour of posix_get_hrtimer_res(). */ - ns = hrtimer_res; + ns = READ_ONCE(vd[CS_HRES_COARSE].hrtimer_res); } else if (msk & VDSO_COARSE) { /* * Preserves the behaviour of posix_get_coarse_res(). */ ns = LOW_RES_NSEC; - } else if (msk & VDSO_RAW) { - /* - * Preserves the behaviour of posix_get_hrtimer_res(). - */ - ns = hrtimer_res; } else { return -1; } -- 2.13.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel