Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp891408ybg; Sat, 26 Oct 2019 09:09:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfNxNXBrjqGD3uHIHx1Ze0FZ+UQtj4hoy/zDq/nWdrKLNoMGAayoyJaU+tWIZOh7e6QJG0 X-Received: by 2002:a17:906:1651:: with SMTP id n17mr8676355ejd.220.1572106141018; Sat, 26 Oct 2019 09:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572106141; cv=none; d=google.com; s=arc-20160816; b=VBhpZgSMotgCjDA3Rx07T3uWsneirPpy+0U3whEod8Fj5gcopOadeeIUT6mVXGVTGT k84/8O27tMuMSgy0vV63iKv9vwl+n5Oy+coG95b2G3URFk62WtDcYJv5dYUAfpAXGzgV 7c7wkKACoDP+tEuqmK6659HnowdMDymDIfH+UgfinTl5mgd7wVJh4BdllmlluxHqN1Gp acM3m25r6774+LBOa8lQz73ek+wFKputOVToiPsoiicXRiTWGCxnnuQ6DY+uRbCnObBw r3liwRQOn54PU1k2fpdv/eZV20tHP25xwrLFS+hUuz4c1Yhp1L9KsfY4YLawyEXF3QwB skUA== 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=CK0LYv4h3ZlYT/dhpa0t6Pn4VtjWWoV9J0PN7vV6RVE=; b=W9kNi3Eonpm75/rMa0AOP3/DFZ5xh2IK+nGl2EPnztvf2upqkZQJp0gghZ/sSkLIO7 ylO300SxvOzuYxumW2sCETuFqXSOJXzuh46rB4HYAhb1yXlcUkt7GlLTF5bXfMBi+Rlv BakYVLdhvwgQ2JmXByry/aLcQ0NfclP3RoPbAfVxlSYzdrr7SxIquut41OBq1B4YiQB6 yz9lymjC0tG/oCdCDQjv2Xi+FmbqHdZ4aGY4HozSZNOmDygydGBXbMUcS1XFEVpqttm2 Cf5nnS1UtylJ/HKzcZlps3vD6tTiEGAUtyg+w49RXsOlRfbCGHTgWpniTqV2OngUgNoQ aQww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=IljuDX+V; 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 gy5si3187416ejb.223.2019.10.26.09.08.35; Sat, 26 Oct 2019 09:09:01 -0700 (PDT) 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=IljuDX+V; 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 S1726318AbfJZQGz (ORCPT + 99 others); Sat, 26 Oct 2019 12:06:55 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:38514 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726202AbfJZQGy (ORCPT ); Sat, 26 Oct 2019 12:06:54 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 470m7v1pVHzB09bF; Sat, 26 Oct 2019 18:06:51 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=IljuDX+V; 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 BPqKipELns7U; Sat, 26 Oct 2019 18:06:51 +0200 (CEST) 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 470m7v0lmZzB09bC; Sat, 26 Oct 2019 18:06:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1572106011; bh=CK0LYv4h3ZlYT/dhpa0t6Pn4VtjWWoV9J0PN7vV6RVE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IljuDX+Vy3V0vg6689c0n53c/r+FxCnLFvIHof0rQfYvAfiuMaXATQ9P28TC8mDEf jA+07kuSHuY0YsBvdyO3ncrp00zygT/XNIgbP22Xtf3yCC4KCTtMXHPd/jx00oWJ+1 XAfTZpl1Sq+W4eLiQREvtc/NTf3MTepI015bsRc8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id BAF518B8B2; Sat, 26 Oct 2019 18:06:52 +0200 (CEST) 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 cIy1fqYXscf2; Sat, 26 Oct 2019 18:06:52 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 22E2C8B7C9; Sat, 26 Oct 2019 18:06:52 +0200 (CEST) Subject: Re: [RFC PATCH] powerpc/32: Switch VDSO to C implementation. To: Thomas Gleixner Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , vincenzo.frascino@arm.com, luto@kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <8ce3582f7f7da9ff0286ced857e5aa2e5ae6746e.1571662378.git.christophe.leroy@c-s.fr> <95bd2367-8edc-29db-faa3-7729661e05f2@c-s.fr> From: Christophe Leroy Message-ID: <439bce37-9c2c-2afe-9c9e-2f500472f9f8@c-s.fr> Date: Sat, 26 Oct 2019 18:06:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: 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 26/10/2019 à 17:53, Thomas Gleixner a écrit : > On Tue, 22 Oct 2019, Christophe Leroy wrote: >> Le 22/10/2019 à 11:01, Christophe Leroy a écrit : >>> Le 21/10/2019 à 23:29, Thomas Gleixner a écrit : >>>> On Mon, 21 Oct 2019, Christophe Leroy wrote: >>>> >>>>> This is a tentative to switch powerpc/32 vdso to generic C >>>>> implementation. >>>>> It will likely not work on 64 bits or even build properly at the moment. >>>>> >>>>> powerpc is a bit special for VDSO as well as system calls in the >>>>> way that it requires setting CR SO bit which cannot be done in C. >>>>> Therefore, entry/exit and fallback needs to be performed in ASM. >>>>> >>>>> To allow that, C fallbacks just return -1 and the ASM entry point >>>>> performs the system call when the C function returns -1. >>>>> >>>>> The performance is rather disappoiting. That's most likely all >>>>> calculation in the C implementation are based on 64 bits math and >>>>> converted to 32 bits at the very end. I guess C implementation should >>>>> use 32 bits math like the assembly VDSO does as of today. >>>> >>>>> gettimeofday:    vdso: 750 nsec/call >>>>> >>>>> gettimeofday:    vdso: 1533 nsec/call >>> >>> Small improvement (3%) with the proposed change: >>> >>> gettimeofday:    vdso: 1485 nsec/call >> >> By inlining do_hres() I get the following: >> >> gettimeofday: vdso: 1072 nsec/call > > What's the effect for clock_gettime()? > > gettimeofday() is suboptimal vs. the PPC ASM variant due to an extra > division, but clock_gettime() should be 1:1 comparable. > Original PPC asm: clock-gettime-realtime: vdso: 928 nsec/call My original RFC: clock-gettime-realtime: vdso: 1570 nsec/call With your suggested vdso_calc_delta(): clock-gettime-realtime: vdso: 1512 nsec/call With your vdso_calc_delta() and inlined do_hres(): clock-gettime-realtime: vdso: 1302 nsec/call Christophe