Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6899665ybi; Thu, 1 Aug 2019 00:01:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyohrJjp2QUGa0ZPwZhAKyT6W4x+8O0JLTwuNlZrc+p25GHcMQMYOJq3PPfbucS4EuecvfR X-Received: by 2002:aa7:9e9a:: with SMTP id p26mr52709433pfq.25.1564642883962; Thu, 01 Aug 2019 00:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564642883; cv=none; d=google.com; s=arc-20160816; b=vHOBUtLjDBua4uVwtSRECuo0ii55GPq1bfiBEoHDnXNBd4k4h1XSKR8DhplbQy1uFK d4C+fiaWJFLxSTEYP6H/n+WxNvSPkNbeoGPTBYlrNHwZ81ZfG+lcIjckN2n17e//pYXC zguImY/5dEVCBtuKtf8f+stPaCiZAVrhuYLmTjpA33qXD8+KlqvRLVvk+cylBk4i0kl9 R2o9SVuwDO5ZFoTm+uNVly2E8anEfKwJCVE5/Nqru1yl9nrtSCu5wFmU5rj8HPevrxOO AEWNUE71KCXTIN60boJGGbPLL97QlmrpPolugfmUCMF14Q6jUOemAYQvKIvBcahyTJJb y6cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+tEMMNal8vxVq1+78G++nVivGbQUNOdjLgvUCgSBBt8=; b=ZV8pRJrTXc5py3ScGOR4fIjXCJwMksM6YyAXtxlVHpRqpFvBSiBQOfkGM5XjodGymT XnQfE1vTHkAk5gKuLLGY2JsDK010dHoOnBFqMUPsaWjMuHIPQlaOrnkwy7QZfJH1xkEO QB9aWt+OZNFEhCnL+N4Yp0aRUqvOhzSvZ6zRUuQbwipkZghxBAjuzN303gYRSU16RrLR MOtNW0ZTfAHgpHF3gFOVAMjpM8JPqqrpBrPYSViOCfiId1BOkeE9vNTdQpZTkkNbPEBW 4wYmyHXJj+avDJcEzOl8KJjvUVsAK1OAWlFju4adu47zttCALUlU3xqdq8kSIeEtwJqE Y1iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P+MZwFJ0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si32748169pll.333.2019.08.01.00.01.08; Thu, 01 Aug 2019 00:01:23 -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=@kernel.org header.s=default header.b=P+MZwFJ0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727600AbfHAFVt (ORCPT + 99 others); Thu, 1 Aug 2019 01:21:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbfHAFVs (ORCPT ); Thu, 1 Aug 2019 01:21:48 -0400 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0266A2183F for ; Thu, 1 Aug 2019 05:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564636907; bh=u+NSo7Xr4J1UtkMZ3fciXvWnaLTy5NZ6RahWBeS9LmE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=P+MZwFJ0im+H+jO2fdD2ReQyiopW4KXhSD0+dSryuJtAdLRRf9MwQokeX4GA+O2mw qoPaBTHr1IaaYhk5SOC2u03JldrYrYhzao9pkQomuzC5ZOQIe5FvitYlfgaM9CSa3P QzrSXrduG+A/0A0uYljv5kQhk9KTf5NUmASyzN2E= Received: by mail-wr1-f54.google.com with SMTP id y4so72091782wrm.2 for ; Wed, 31 Jul 2019 22:21:46 -0700 (PDT) X-Gm-Message-State: APjAAAW0k3NNiC7emX6BpZL82DLEFi2EwZwOUwFF5l+WeP/Vb07m+7jK RuBQGjR7lsUKRAtgg/Doa9BYb/8f0KYVVOwE54w7nQ== X-Received: by 2002:adf:cf02:: with SMTP id o2mr118390659wrj.352.1564636905321; Wed, 31 Jul 2019 22:21:45 -0700 (PDT) MIME-Version: 1.0 References: <20190729215758.28405-1-dima@arista.com> <20190729215758.28405-29-dima@arista.com> In-Reply-To: <20190729215758.28405-29-dima@arista.com> From: Andy Lutomirski Date: Wed, 31 Jul 2019 22:21:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCHv5 28/37] x86/vdso: Enable static branches for the timens vdso To: Dmitry Safonov Cc: LKML , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Adrian Reber , Andrei Vagin , Andy Lutomirski , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , Vincenzo Frascino , Linux Containers , criu@openvz.org, Linux API , X86 ML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 29, 2019 at 2:58 PM Dmitry Safonov wrote: > > From: Andrei Vagin > > 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. What you need is, IMO, a static-branch-ish thing that is per mm. This has a fundamental problem that the vDSO can be modified using FOLL_FORCE. Perhaps any CoW of the vDSO should implicitly switch the static branch on, which at least gives some degree of correctness even if it's a bit surprising. --Andy