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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 DED87C433FF for ; Thu, 1 Aug 2019 06:48:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 943B7216C8 for ; Thu, 1 Aug 2019 06:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730519AbfHAGsj (ORCPT ); Thu, 1 Aug 2019 02:48:39 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:34108 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730472AbfHAGsh (ORCPT ); Thu, 1 Aug 2019 02:48:37 -0400 Received: from pd9ef1cb8.dip0.t-ipconnect.de ([217.239.28.184] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1ht4sm-00078d-HJ; Thu, 01 Aug 2019 08:48:12 +0200 Date: Thu, 1 Aug 2019 08:48:10 +0200 (CEST) From: Thomas Gleixner To: Andy Lutomirski cc: Dmitry Safonov , LKML , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Adrian Reber , Andrei Vagin , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Vincenzo Frascino , Linux Containers , criu@openvz.org, Linux API , X86 ML Subject: Re: [PATCHv5 28/37] x86/vdso: Enable static branches for the timens vdso In-Reply-To: Message-ID: References: <20190729215758.28405-1-dima@arista.com> <20190729215758.28405-29-dima@arista.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Jul 2019, Andy Lutomirski wrote: > On Mon, Jul 29, 2019 at 2:58 PM Dmitry Safonov wrote: > > As it has been discussed on timens RFC, adding a new conditional branch > > `if (inside_time_ns)` on VDSO for all processes is undesirable. > > > > Addressing those problems, there are two versions of VDSO's .so: > > for host tasks (without any penalty) and for processes inside of time > > namespace with clk_to_ns() that subtracts offsets from host's time. > > > > The timens code in vdso looks like this: > > > > if (timens_static_branch_unlikely()) { > > clk_to_ns(clk, ts); > > } > > I'm confused. Now we effectively have *three* versions: the vDSO > without timens, and vDSO with timens but with it switched off, and the > vDSO with timens on. This seems like too much. The problem is that if you have a single VDSO, then omce one process joins a time namespace _ALL_ other processes get an extra conditional with at least one extra cache line as a bonus. This has been discussed at Plumbers last year and the agreement was to create VDSO plain (no namespace support) and VDSO extra (namespace support). The performance hit of the conditional + one etra cache line for tasks which do not use a time name space is measurable. That also avoids the whole mess of dealing with the static branch being flipped. The time name space property is determined on fork/exec _before_ anything can touch the VDSO and depending on it the approriate version of the VDSO is loaded. Thanks, tglx