Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1051765imm; Fri, 28 Sep 2018 11:03:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV60BeHRHGM4xHRkgr1C7cz9W3mJIPwirrP/ktA4oPyKzX2n08U6NhYou/Bgt1+uyrFU8UtzO X-Received: by 2002:a62:4ec9:: with SMTP id c192-v6mr17939193pfb.221.1538157793584; Fri, 28 Sep 2018 11:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538157793; cv=none; d=google.com; s=arc-20160816; b=wLhAUdI4YtKEapFT7hdjSr2Zc2Pl5CP7QrJTC2F6Mj6CVeUtb6+ENyrybLc8yKbZwr u6wfvB/zkJRYm7bmUGZhFl5Zi7Yvg6u6TiSQCFpXFTFVL4pUb9AWRTiXvhxPFCOtCGwg bf0N3V7NsSUzqOiKpzqbOyOgxCcfxYcyhiETk1AI8vmHnBL+ms21cFAJY33uTvD7lsE+ T/yj7ET5i4MvmxgjnBF54XjUky5/Jt3lN0hGRHp/e6iZkdySd15d+vTN0ssOZgpGIGuB 1SCIKB6vNaJDHyxVQWhombNUP/SQTqnKtuiXaTgHRw3t2fL/2owSFRDwsZqJtC3BnQPs W/LA== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bItNCzbIip1U0eRatOVgiKLhunondv56R2ZU+g5mRGg=; b=ZkNhpfCPS0tDIPbqlZMAVbxWRNnwtn6+nIYvkRV5OkFOpNgcwBP8fSX0uAvbIfRfDY Iv6NKIT+uhvZ9URx9yfoW3/XcyBd5id4e8tpzVqdKcloKzSdEFFPvWlqRigBmMYPWFlJ CIjwAdK/qpJ8ZCSPyKBfUeaDD7RnGML0c6nZhqrxHVDMKH5mEJBZRybYnudC8zxWGbS6 rXIiHe/GuEs9zDzOwGx7Wkwaz8ILIJJM33gMNSKeLrkdYlRQWgGRtL95iMC12dkw4FmU EgiREp+1MidN5fUmx++sOKcG0cv+Wtqe8y8ldUvkXCq3eUHxcX0luni9DYNn9laacwgJ 1slg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=TrQ8p7Vk; 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 1-v6si5361170plr.326.2018.09.28.11.02.57; Fri, 28 Sep 2018 11:03:13 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=TrQ8p7Vk; 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 S1727230AbeI2A1g (ORCPT + 99 others); Fri, 28 Sep 2018 20:27:36 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55905 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbeI2A1g (ORCPT ); Fri, 28 Sep 2018 20:27:36 -0400 Received: by mail-wm1-f67.google.com with SMTP id 206-v6so3078966wmb.5 for ; Fri, 28 Sep 2018 11:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bItNCzbIip1U0eRatOVgiKLhunondv56R2ZU+g5mRGg=; b=TrQ8p7Vket9a4tmyqKnxpATG9DBuJ5Px2QyTIgtorKte38PRYEiTvFQB6Uxtw/1LVX NhetuzwgbyGLDbNKdHEopsHGopsO5GVZ6pbPkZO1F82LyYqwC5klPHtka5Xh3CeFX10y thBibmOz0okXEaqxQ5OBOKb2pq3SF56AeM/iPJLxorJYbR5RMjmn8QhCHMYyId2Gbxnh cVPgohEIxyLyTavR8ttNbVFvJIIyv+b7AEUFekL/BeIQRiMd5LTQF3v5wxvL+7zwWFpZ hNZMCLVyNHJARdBOVwZgqyqGgvT1qjkkRdAALK7Jnk35yZXMOKbeULOUmwN5clOnGH++ BBdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bItNCzbIip1U0eRatOVgiKLhunondv56R2ZU+g5mRGg=; b=JFoh/EyOs7ufgCGB7zzmhNjSp9q7dPomx0dd+Kd0TGPKdCBbkp0MlcbXXM9dymJL4P qKCh7lyUb3LrI1dOSRj5JznKzYVjACL5jD9pQvLpe0rTaqjlzYi0TOqAihheSQkJXOzv B1rZ6VQdkLSrlfF7E+HHNmuQzFhZTVjlRcKnr5vhqEdaW7IAC3VxCxjJZWWbuLrVrd3d zUj2lq/rRG5Wvayy6ezLHGkM/3rZZv+OBJUMYPkPLPgTc1B7WFwToZBGFQVJXXsjemo3 CcaQjpGqoqdE9GSBiK1GdtZW1GZDFhN62yT+Idvo/cIOaZJvNfuSa9+VPiuuFiIo4cEF 4SSw== X-Gm-Message-State: ABuFfojgFxVwWlkbJdsn7qSRLfp88bc6GqtXQmzsxNZ+nQUfEp5UQnIg q3x7hcCFhUnwZXUT9sFnOFAWq4iuFIsNsqRn4d+u7w== X-Received: by 2002:a1c:9355:: with SMTP id v82-v6mr2574458wmd.128.1538157757987; Fri, 28 Sep 2018 11:02:37 -0700 (PDT) MIME-Version: 1.0 References: <74fb6ce22f62e0fb48b91ca9918b74cedbcecaf1.1538096323.git.luto@kernel.org> <20180928103726.07761672@mschwideX1> <0B38810F-3E22-45A8-9D5D-EDEABD214148@amacapital.net> <20180928165321.0ddaf948@mschwideX1> In-Reply-To: <20180928165321.0ddaf948@mschwideX1> From: Andy Lutomirski Date: Fri, 28 Sep 2018 11:02:26 -0700 Message-ID: Subject: Re: [PATCH] futex: Set USER_DS for the futex_detect_cmpxchg() test To: Martin Schwidefsky Cc: Thomas Gleixner , Geert Uytterhoeven , Andrew Lutomirski , X86 ML , Peter Zijlstra , Ingo Molnar , Darren Hart , LKML , linux-s390@vger.kernel.org, Heiko Carstens , fthain@telegraphics.com.au Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 28, 2018 at 7:53 AM Martin Schwidefsky wrote: > > On Fri, 28 Sep 2018 07:11:44 -0700 > Andy Lutomirski wrote: > > > > On Sep 28, 2018, at 1:42 AM, Thomas Gleixner wro= te: > > > > > >> On Fri, 28 Sep 2018, Martin Schwidefsky wrote: > > >> On Fri, 28 Sep 2018 09:12:10 +0200 > > >> Geert Uytterhoeven wrote: > > >>> I don't know if that has happened, and whether it would work on s39= 0 now. > > >> > > >> commit 03b8c7b623c80af264c4c8d6111e5c6289933666 > > >> Author: Heiko Carstens > > >> Date: Sun Mar 2 13:09:47 2014 +0100 > > >> > > >> futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic(= ) test > > >> > > >> If an architecture has futex_atomic_cmpxchg_inatomic() implemente= d and there > > >> is no runtime check necessary, allow to skip the test within fute= x_init(). > > >> > > >> This allows to get rid of some code which would always give the s= ame result, > > >> and also allows the compiler to optimize a couple of if statement= s away. > > >> > > >> Signed-off-by: Heiko Carstens > > >> Cc: Finn Thain > > >> Cc: Geert Uytterhoeven > > >> Link: http://lkml.kernel.org/r/20140302120947.GA3641@osiris > > >> Signed-off-by: Thomas Gleixner > > >> > > >> > > >> Heiko created the CONFIG_HAVE_FUTEX_CMPXCHG to get around this issue= . > > >> We just skip the runtime check as well as arc, m68k and sh. Not sure > > >> about xtensa, the set it config option only for !MMU. > > > > > > Duh. grep would have told me. -ENOTENOUGHCOFFEE > > > > > > > > > > There=E2=80=99s another way to skin this cat: keep KERNEL_DS but pass a= valid pointer. > > I don=E2=80=99t suppose you remember why you didn=E2=80=99t do that? > > No, I don't remember. To use a valid kernel pointer with KERNEL_DS and > then test for =3D=3D 0 (vs -ENOSYS) imho should work. > There may be a much nicer solution. Unless I missed something, only mips and xtensa even have the possibility of cmpxchg being missing. We could just make those arches supply a futex-detecting helper.