Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2778102ybl; Mon, 20 Jan 2020 09:09:47 -0800 (PST) X-Google-Smtp-Source: APXvYqz6GEUahMGB83XKawWkJ6Y9AAbehQuaZMLu5JlFOm7F4Afntd8z8Hk8txG5Bh0vJ9JDYSpc X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr385741otn.22.1579540187144; Mon, 20 Jan 2020 09:09:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579540187; cv=none; d=google.com; s=arc-20160816; b=cqJlbad3684gBlg9h2GeaT1OLxzS5qsPkusmzYtooEUwpfe5Fq9SP0QEZhKsLDMvvt 41Pur7/9a35XNGfR2/1fqlY1fbxtnrxZ5kOLb+0BZI2BwsTIbt6IQ76lqzoWfzDErACQ cUHW7f1aM2cRei+lnViHfIbQQiqpOICQJJ8jhGnFwwPh4xiQdRY5N1VHJpHoKb9ant/O e9wxrq1lyhVqeT85e7FwE1ZfabwhuaRW4TFWpZITRjXyMvhon2weC7Eh4n0XheJHQU3Q 7LsnCKOAngrNPa6fPZZPpe5CovXalJeJNq0i/Zfa4wTEIp7AG6UjGheQvwffxA9CMD/B NETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=yzfJ9FjkQyCVlK+cgsOTuMQ4XbfRfoKvMNM6nb5r3UI=; b=k5/HImk45+KNtD0CUeCcfvqRDNyahSruw7LmUFLmmFp3hRocfBgbnkB4P9a8axo1IG /br33trKdTK+V1qJpEyvLBbsm19tvPe0Kngl00e1S6rD91wR9wQvOVtT96CYreGYVbG+ aruXl2utDfZ5B5Gso7q1O5+YPWU48r/JDPkf14y2X7HanSzR2hmdOf9LnTYsIb7t4k0L 8CJkV69sos4h3+OFPw9ySxcoTa1CVAD0NqkagBSV9IhjwFW1DJoCvFoB7AdX10ExSbx0 ec70WNEHJxleqy+AhDJa4bEq7y/lMe+3l/i4Sk9EgAPppVKiux6KfAuI3CkKqlxBIVg8 tIYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="mcD/ZnPp"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si19922274otn.100.2020.01.20.09.09.34; Mon, 20 Jan 2020 09:09:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="mcD/ZnPp"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728596AbgATRI2 (ORCPT + 99 others); Mon, 20 Jan 2020 12:08:28 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:40130 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgATRI1 (ORCPT ); Mon, 20 Jan 2020 12:08:27 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 481dR74f1Jz9txwZ; Mon, 20 Jan 2020 18:08:19 +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=mcD/ZnPp; 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 PB6Od9Chvw6v; Mon, 20 Jan 2020 18:08:19 +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 481dR73Lf3z9txwY; Mon, 20 Jan 2020 18:08:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1579540099; bh=yzfJ9FjkQyCVlK+cgsOTuMQ4XbfRfoKvMNM6nb5r3UI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=mcD/ZnPpMb3Gvs1Fu8ShcsW/tjiI8vxX1spQWPagvARRgwMyLCX57drTZw4IIlWTT 7Eth0yTjCJCPdeskFUImvSrga71e/3E6dNmtljCIVLukdQbR9DnwBYxaBmMNs9f2yF MQDPuMtMbdR8t0a+nujkuIfoduw1FWTj9Hb24lhc= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AEDC08B7D2; Mon, 20 Jan 2020 18:08:24 +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 nJxXjRrAsRPz; Mon, 20 Jan 2020 18:08:24 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 85F838B7CC; Mon, 20 Jan 2020 18:08:23 +0100 (CET) Subject: Re: [RFC PATCH v4 00/11] powerpc: switch VDSO to C implementation. To: Segher Boessenkool Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , nathanl@linux.ibm.com, arnd@arndb.de, tglx@linutronix.de, vincenzo.frascino@arm.com, luto@kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org References: <20200117085851.GS3191@gate.crashing.org> <3027b6d2-47a9-a871-7c52-050a5f9c6ab7@c-s.fr> <20200120151936.GB3191@gate.crashing.org> From: Christophe Leroy Message-ID: <4b0e5941-c37e-3c85-3809-45f33ce35657@c-s.fr> Date: Mon, 20 Jan 2020 18:08:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20200120151936.GB3191@gate.crashing.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 20/01/2020 à 16:19, Segher Boessenkool a écrit : > On Mon, Jan 20, 2020 at 02:56:00PM +0000, Christophe Leroy wrote: >>> Nice! Much better. >>> >>> It should be tested on more representative hardware, too, but this looks >>> promising alright :-) >> >> mpc832x (e300c2 core) at 333 MHz: >> >> Before: >> >> gettimeofday: vdso: 235 nsec/call >> clock-gettime-realtime: vdso: 244 nsec/call >> >> With the series: >> >> gettimeofday: vdso: 271 nsec/call >> clock-gettime-realtime: vdso: 281 nsec/call > > Those are important, and degrade ~15%. That is acceptable IMO, but do > you see a way to optimise this (later)? Not easy I think. First we have the unavoidable ASM entry function that can't be dropped because of the CR[SO] bit the set on error or clear on no error and that can't be done in C. In our ASM VDSO, fixed shifts are used, while in generic C VDSO, shifts are generic and read from the VDSO data. And there is still some funny code generated by GCC (8.1), like: 620: 7d 29 3c 30 srw r9,r9,r7 624: 21 87 00 20 subfic r12,r7,32 628: 7d 07 3c 31 srw. r7,r8,r7 62c: 7d 08 60 30 slw r8,r8,r12 630: 7d 0b 4b 78 or r11,r8,r9 634: 39 40 00 00 li r10,0 638: 40 82 00 84 bne 6bc <__c_kernel_clock_gettime+0x114> 63c: 81 23 00 24 lwz r9,36(r3) 640: 81 05 00 00 lwz r8,0(r5) ... 6bc: 7d 69 5b 78 mr r9,r11 6c0: 7c ea 3b 78 mr r10,r7 6c4: 7d 2b 4b 78 mr r11,r9 6c8: 4b ff ff 74 b 63c <__c_kernel_clock_gettime+0x94> This branch to 6bc is totally useless: - copying r11 into r9 is pointless as r9 is overwritten in 63c - copying back r9 into r11 is pointless as r11 has not been modified inbetween. - loading r10 with 0 then overwritting r10 with r7 when r7 is not 0 is pointless as well, could have directly put the result of srw. in r10. Christophe