From patchwork Wed May 31 13:59:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9757163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F3E6602F0 for ; Wed, 31 May 2017 14:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EAD3284B1 for ; Wed, 31 May 2017 14:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50DDD284C4; Wed, 31 May 2017 14:00:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A3B5F201F3 for ; Wed, 31 May 2017 14:00:14 +0000 (UTC) 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: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=nAmkDFRET07V0sg93owFV9pI2KeeUl5MwBlz6s6xjD0=; b=tJ8xYTMOWbpDTo JzTTwUPEtKw5PqmKSCDxw2BtWVmZR0gnNeKCQI8Q0ys5AeShfNyDa6JLgNkvWFbjkhzO/kwDarFgL PXJAKco62gmLs598Wvz1lZG/tVAKwvwkfeZLmJTxfhrV92tK2k0ugXC6ia9lZbO70VQk2rFoCFcQA hqmHRyu+TC/+FZ5B3HZzna0KUarS2ZFJtGqgGmn6aqaeh6e6NTOaDHM6gSldl9OOyI/ZdeBAWCY9K d0BR7u8IU36w2pFaIBJbSN6rFYy7Kh6bxMxBb0gkkZqPSY6xKohHIP63/agUZNIr4pMol0vVhhUhJ szia6iRRGF4RGsu5g0lg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dG4AW-00082u-HJ; Wed, 31 May 2017 14:00:12 +0000 Received: from mail-co1nam03on0070.outbound.protection.outlook.com ([104.47.40.70] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dG4A7-000817-3m for linux-arm-kernel@lists.infradead.org; Wed, 31 May 2017 13:59:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=NwR+wbArPUhO/C5VfV/HTGaonfRb1rd/9XVRYCF/pGY=; b=dbfN9pv57wR/z2WsBB8InekLDS6slZzW1sAU/MqoXtnIkj0b8kGzrA3ZWuaIG7on9KgYJ50fBk07No1Ua6jyZ/39sP03cOdVFU0tCdh/D3P+q0Jd7oJwhIWT4xmkf1Onv/OnWw+uKzgeW9gjzdN3chS3EpyuH249WVwW+N3TUjA= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (176.59.48.101) by DM2PR0701MB1277.namprd07.prod.outlook.com (2a01:111:e400:5118::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9; Wed, 31 May 2017 13:59:22 +0000 Date: Wed, 31 May 2017 16:59:10 +0300 From: Yury Norov To: Will Deacon Subject: Re: [PATCHv2 1/2] arm64:vdso: Rewrite gettimeofday into C. Message-ID: <20170531135910.4rxkh4lcfsbjye5t@yury-thinkpad> References: <1496190860-5116-1-git-send-email-apinski@cavium.com> <20170531124430.GG9723@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170531124430.GG9723@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [176.59.48.101] X-ClientProxiedBy: HE1PR0802CA0011.eurprd08.prod.outlook.com (2603:10a6:3:bd::21) To DM2PR0701MB1277.namprd07.prod.outlook.com (2a01:111:e400:5118::15) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR0701MB1277: X-MS-Office365-Filtering-Correlation-Id: 73c83a34-c622-4d8e-8638-08d4a82d3def X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DM2PR0701MB1277; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1277; 3:CcEptB7+G6483hYhwcdKkSAEqq3N1vn8ZuNhx7XLalZBaTq3V8NBmEgm4HXobJm/zTJspsR7dr3JI6qFvvY8YSeKXDfh2tHf5NBolthWXAW0VFcjb8k4p2n2RgvZWNH35IbfnTsEeYsk/dupxNf9xNh7BITnDjuQx9gB9USPUxbruXgru78GvL1JLeD7kTXGK1JVBhgt2AVAVE6mQGSo5eSxmqAkqdTAnBeD3WdV26iSIY7+TCXW+rhKHfYe7hljAXI9wczezFTOff1cXrHkLJD1DVpXbU0qX0RxnuYIPQmYhqEYB9ZjGKa7Do+KfjEVUcITskpUizOZY+YRQVZFJw==; 25:4clPiLM9T+6b1RJo5G8wOr1Y4xl7pB5bpD7kff72/RNT9fvRDkiJI597T2DnoKxJ343OAfJCHXQ5qr+STGjStTbJrf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NWU3qJgaBAp4HTsgv5liyhNjRSwdr/08T/oioxbjQYxEv6N5B1dPvkETwqDblhj4OPN8G58Qh0N/MSKWS+hVfl7MWwBKoJOwkGqp2xq+1mGwvej9Bnud8OA17y7/263ZZXkn34Z9k+29cJNU5150Mzax5puXN4XCXqDFzMXJhfE0FGPL9H78lksvH/q5krR/vaa7Ag6DunsfwOkmUzqjUp/f+ArZ3p5pNtoK0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(3002001)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:DM2PR0701MB1277; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0701MB1277; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1277; 4:2Qts/+tPVO1xOr/MPma/rLDzhS9y31/5QoKPvPgJU+/2cP9BpXv4flVUy/ezLbJtx89x224m7OD/EraZ+R08eMkHaPoFccN6/cGepxS1fJGRmY8LR4DX4hDwPakRpgKdoTxBaqNy4gvpBdEvlffzqugUXY/+T8L/KaZ0gP3UeMz22fzwMlj3ctfNR/U1N+NL+4Gt/gx8fmh6MwHfe8W8VEpRnTqzzB+2eEve2JreMIPBHv/LBWZ6/h6non4WRMkTW4yuhHQc7uaYycfRvFLaAtnm5LbuxSh76m7E9Liudz/bBV1wkHvTnbWl9Tmpw+C3oBvysK8XnK19nyAloRGhl7TdVPukvVSepivSo9lIinPBlZsXPzP7h+rqWupD4eATuMbESIfMaQflSqWW/JvK/r968ldVD3ljN596qB4wqcX0oNeG+TpTwWvLWn9wpOOBazofwj3DVBYLUYCRLzhNKV/L4X05AdaxfNuzm+begEIbfEQKuvKG1Y4aYpsWe5aDR/RWGB9debPFJ+WW0dej1ttnv+30ine0ZASFoo/DcwfIqLt5LIG+U2v8VDjdYan4L+Z9zIU5cWIpmARMJFuMUBlo7uwL9oo2/70rp9rgDvnC+v6R8n0vXeR8R/fpiQ/nqPLHcm9h5rzQexBRUUfAXeHzKagdRhZMsxS1ammgW40qmniiL8LnK8FAKdUMZKy1RwWXNlH0DNjXAVmj8OJOieYvNNR72azuzkpRi5QhRRFJawB0es5B/uo6e9FGziDhAxz2QMAQsdLPtkZJhd1Mpg== X-Forefront-PRVS: 0324C2C0E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(39840400002)(39450400003)(39850400002)(39400400002)(39410400002)(24454002)(9686003)(7736002)(53936002)(25786009)(23726003)(33716001)(72206003)(53546009)(305945005)(6496005)(1076002)(229853002)(38730400002)(5660300001)(478600001)(6246003)(2906002)(110136004)(6116002)(575784001)(3846002)(2950100002)(4001350100001)(42882006)(6916009)(189998001)(42186005)(8676002)(33646002)(76506005)(81166006)(83506001)(6666003)(4326008)(50466002)(50986999)(76176999)(54356999)(47776003)(66066001)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0701MB1277; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0701MB1277; 23:7J6ksO7faPWkIndYj9LqvEu3CdJqIsGg4i5G1KO?= =?us-ascii?Q?A8n9sYogGcXaK88KGLV3mI5fDwekgTSa8sL0gb4qVtPHMX6ciSC9mI9ps3cT?= =?us-ascii?Q?XMmULnqYR6wfRbzsL4PFN0c1YdII+3rHSp6YY+rEBZlLVS9d1JZwn0xpZx1y?= =?us-ascii?Q?w45dSkk+3WTf0oVa+p9PiFrIY2zuWDVEMpfIT5CspTfbaUuMx7b2fQe93ws1?= =?us-ascii?Q?YPoTvsgS2oeqeBEHqO/cg+B0yPpmTtjDGoqqtn+hIIXwOJsyYp6zaJ3UVFsb?= =?us-ascii?Q?9XimTvcJ5XoY3FTJ19fyT/5y5XQfA071ZPQoD+A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yY3VA0ZwgBGYwgMRAcQbUVgYSCJJ1IeVY7yLU5AI1Afi/UbmJ8VlkFQ?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1277; 6:WrSUpuWgd8exv0qta//xAC3p/1qHAm3HMnBvz9pCu4Mmh7NKUNqHWxFPRG3UEkN6mX6RqYbZxRtg7gAJEoWZLrLYibQxBVaEM1Aarv6gbc/fEOofYyPAswP+kfXgyUJULZCKachHk2cRbQ4KxKsY7se1jIjHbqGtNvE6z/2lQbCMk1PQtPQflFGHcGGUk/20+YxoVIXmYOVN86MKnqU8oU90VR26GCfB53AzgfW3FsH14hc6TgS0YqtpAIvzjyed8EXRHtklHaFpBv758516Lq9E9Zin8lCOcVgK3irss/TOyRuizskDB4fRffrqgA/nJh8fS/10SfHNu9VahNVMXY39VVyXBVWLb5o9eG2khSIsgZRV8BrJf8SqCkiDFSa/FYVwEens+PE80uqcUONd8/uqv8vZBv+2fcehLwG16QErAKIbFaKC4G3wHIrT+dzKg24RBWL4phvHjJlOVq3Ygc7Kt+efx8A0heqaVzZQqfCtVtK7TW3AvGJTkI/H1MZCMJ78BVcySliWnldQvyM0sg==; 5:ehfpoxGbzrWn8R7ogejOQ9Z4DJOZUkBDF/sOnOXT6iEwAdbXXWUBsgSzEVmivhLDIRNNgrwuH4x3m51cAKGOY9d3/0AAap0Dj9Vbe/DWMx+m819QC0ntPcLLfZCfIeiXTfNlYWsr1Go0CCj0nQ1mYQ==; 24:MmqTSHysvx1Kk5+LSFjlJ4/yFkxoUPe3MvqQkx4q57hisaoSD8oj4lDN4xt18qtksU2MUwW3uOdfUfM0/qKtFS1G8YXlRCbzeNTpnJGYpsw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0701MB1277; 7:c8IxoO6RmkX+A3D0Ad0r6SY4DEyjQ2m8hk9SNzcydHPpLL+0gDdSmoE5Or+B07RmWXxTebgtrQsTb9xVunJs2egm1JOy62K8040wReJ7+tFk1edDIcXDsHI4rOrSvAV0FGgD8ZQ0tiiBWi2FX1THY5uc+onnybgANXeVU0hko9AVx12VYlutL8Ns0hPqBV3CLoKvjVuMKHqRkMhir86icmuTeeUI8fFzNdc4OxxRwjG5yj3pYtTpY5Qd+nMI7frY2TGmaFFTQSvDJHO3xnGUBprjZUp6xoocjsAAaJXIlYaDPHphxGa6XLmwRPfnTraUyScQg/wJk6OkzPOkZ4ov0A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2017 13:59:22.2497 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0701MB1277 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170531_065947_242883_E661E4A5 X-CRM114-Status: GOOD ( 20.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, catalin.marinas@arm.com, kevin.brodsky@arm.com, nathan_lynch@mentor.com, linux-kernel@vger.kernel.org, john.stultz@linaro.org, Andrew Pinski , dave.martin@arm.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 X-Virus-Scanned: ClamAV using ClamSMTP On Wed, May 31, 2017 at 01:44:30PM +0100, Will Deacon wrote: > Hi Andrew, > > Thanks for posting this, but please try to cc the maintainers in future -- I > almost missed it! > > On Tue, May 30, 2017 at 05:34:19PM -0700, Andrew Pinski wrote: > > This allows the compiler to optimize the divide by 1000. > > And remove the other divide. > > > > On ThunderX, gettimeofday improves by 32%. On ThunderX 2, > > gettimeofday improves by 18%. > > > > Note I noticed a bug in the old implementation of __kernel_clock_getres; > > it was checking only the lower 32bits of the pointer; this would work > > for most cases but could fail in a few. > > > > Changes from v1: > > * Fixed bug in __kernel_clock_getres for checking the pointer argument. > > * Fix comments to refer to functions in arm64. > > I tested this patch on a few platforms I have access to and didn't see the > perf regressions I saw when I looked at this in the past with an older > toolchain (it was mostly about the same, with a couple of improvements). > > So, in principle, I'm not opposed to moving this into C. However, we're > currently close to a "vDSO-explosion" on arm64 with people wanting a compat > variant and also an ILP32 variant. Hi Will, This is the patch for ilp32. It's based on v1 but should be OK for v2 too. If vdso rework will be upstreamed prior to ilp32 series, I'll incorporate it in ilp32. Yury From e6f22d8ea41e6f7919de30509ac95989cd8076a4 Mon Sep 17 00:00:00 2001 From: Yury Norov Date: Wed, 24 May 2017 15:02:43 +0300 Subject: [PATCH 28/28] arm64a/ilp32:vdso: Rewrite gettimeofday into C. Signed-off-by: Yury Norov --- arch/arm64/kernel/vdso-ilp32/Makefile | 20 +++++++++++++++++--- arch/arm64/kernel/vdso/gettimeofday.c | 9 ++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/vdso-ilp32/Makefile b/arch/arm64/kernel/vdso-ilp32/Makefile index 0671e88ce860..ecf62e7d1c8b 100644 --- a/arch/arm64/kernel/vdso-ilp32/Makefile +++ b/arch/arm64/kernel/vdso-ilp32/Makefile @@ -11,10 +11,22 @@ obj-ilp32-vdso := gettimeofday-ilp32.o note-ilp32.o sigreturn-ilp32.o targets := $(obj-ilp32-vdso) vdso-ilp32.so vdso-ilp32.so.dbg obj-ilp32-vdso := $(addprefix $(obj)/, $(obj-ilp32-vdso)) -ccflags-y := -shared -fno-common -fno-builtin +ccflags-y := -shared -fno-common -fno-builtin -fno-stack-protector +ccflags-y += -DDISABLE_BRANCH_PROFILING ccflags-y += -nostdlib -Wl,-soname=linux-ilp32-vdso.so.1 \ $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) +# Force -O2 to avoid libgcc dependencies +CFLAGS_REMOVE_gettimeofday-ilp32.o = -pg -Os +CFLAGS_gettimeofday-ilp32.o = -O2 -mcmodel=tiny -mabi=ilp32 + +# Disable gcov profiling for VDSO code +GCOV_PROFILE := n + +# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared +# down to collect2, resulting in silent corruption of the vDSO image. +ccflags-y += -Wl,-shared + obj-y += vdso-ilp32.o extra-y += vdso-ilp32.lds vdso-ilp32-offsets.h CPPFLAGS_vdso-ilp32.lds += -P -C -U$(ARCH) -mabi=ilp32 @@ -46,8 +58,8 @@ $(obj)/vdso-ilp32-offsets.h: $(obj)/vdso-ilp32.so.dbg FORCE #$(obj-ilp32-vdso): %.o: $(src)/../vdso/$(subst -ilp32,,%.S) # $(call if_changed_dep,vdso-ilp32as) -$(obj)/gettimeofday-ilp32.o: $(src)/../vdso/gettimeofday.S - $(call if_changed_dep,vdso-ilp32as) +$(obj)/gettimeofday-ilp32.o: $(src)/../vdso/gettimeofday.c + $(call if_changed_dep,vdso-ilp32cc) $(obj)/note-ilp32.o: $(src)/../vdso/note.S $(call if_changed_dep,vdso-ilp32as) @@ -60,6 +72,8 @@ $(obj)/sigreturn-ilp32.o: $(src)/../vdso/sigreturn.S # Actual build commands quiet_cmd_vdso-ilp32ld = VDSOILP32L $@ cmd_vdso-ilp32ld = $(CC) $(c_flags) -mabi=ilp32 -Wl,-n -Wl,-T $^ -o $@ +quiet_cmd_vdso-ilp32as = VDSOILP32C $@ + cmd_vdso-ilp32cc= $(CC) $(c_flags) -mabi=ilp32 -c -o $@ $< quiet_cmd_vdso-ilp32as = VDSOILP32A $@ cmd_vdso-ilp32as = $(CC) $(a_flags) -mabi=ilp32 -c -o $@ $< diff --git a/arch/arm64/kernel/vdso/gettimeofday.c b/arch/arm64/kernel/vdso/gettimeofday.c index a0ab8b1bd53e..0c4a00b58963 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.c +++ b/arch/arm64/kernel/vdso/gettimeofday.c @@ -26,8 +26,15 @@ #include #include #include + +#ifdef __ILP32__ +#undef BITS_PER_LONG +#define BITS_PER_LONG 32 +#endif + #include + extern struct vdso_data _vdso_data; static notrace int gettimeofday_fallback(struct timeval *_tv, @@ -122,7 +129,7 @@ static notrace u64 get_clock_shifted_nsec(u64 cycle_last, u64 mult) res = res - cycle_last; /* We can only guarantee 56 bits of precision. */ - res &= ~(0xff00ul<<48); + res &= ~(0xff00ull<<48); return res * mult; }