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=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_NEOMUTT autolearn=unavailable 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 65A9BC43381 for ; Thu, 7 Mar 2019 23:49:28 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 344BF20851 for ; Thu, 7 Mar 2019 23:49:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZLHsGFbg"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="zZnOTmnt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 344BF20851 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fA01gTDnsdeh9DNci5XH887FK9AHVXPYU2B+xGWqgs4=; b=ZLHsGFbgR12X/1 tT7sKJU3+1dQlzkH1Yv7aRf319un02j71isfsc8zEbNNSwUGtFW1Gq9hypIhpKHFQwJI3vMCAG8Ga MBmv6WVcR6/MZ91UlGNAlFOzSVz4g2BCsK6JiwS9mdBfVlOD7i7cH2pi9Zfaq56LrXelwou8Mj0sE A4tyduUvOeKnHaw7VA0kwCUs2wBi3ReG8s9FkJK/Mv74Dk1g/rrQd9oLv6XlFDkVr8c9Jx83XKWpN vKFvsCdg0O+jLqk5zB827hDUNl6lC9WSYgoKXWxNFlPKRPZuH7B3lKezz43YkUWkyLqeQH2LtYZIW PjCIWDTdGR3OmWlDbe3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h22lP-0001YQ-92; Thu, 07 Mar 2019 23:49:23 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h22lM-0001XP-3P for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2019 23:49:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fNN6eajNaTJ8SgJrVM+PEBr9uc/iJQPWs0J51MBsxeQ=; b=zZnOTmnt8jCCtjK0oroO2JFZr L2Hv8eLwSi2K+nfg+xSTnV7hmtoy867ijmIhE5/zOnWtc3iINHroM6qek69Eu8yOi1ud6ejLNcCuy ho81ETKFworqh+3YpdspGNyfiVl65InYkWr8rFDQSjaw0kZAQ+eDxJ9M5d63gHNxFdF0cSFEWROIW 0yAbIR51rzaAsaHKvWBYtDVS623wvYt3uiKR6A5QNtEmmnSmTB3d2b9qZcvRAYXNj+7l/M2gb35Qa hwi7BG+dIXClTWQxq76ZC+nV8rJFbq9C+FU7gdVV2YPvv6wAKkuJhfxnwGgDcRz8R7DP070Id9x6V 92BKPfTaA==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:55006) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1h22l3-0000RU-2X; Thu, 07 Mar 2019 23:49:01 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1h22ks-0005Hh-Ty; Thu, 07 Mar 2019 23:48:50 +0000 Date: Thu, 7 Mar 2019 23:48:50 +0000 From: Russell King - ARM Linux admin To: Nick Desaulniers Subject: Re: [PATCH 2/2] ARM: futex: make futex_detect_cmpxchg more reliable Message-ID: <20190307234850.nsbpkfcit3lnmytu@shell.armlinux.org.uk> References: <20190307091514.2489338-1-arnd@arndb.de> <20190307091514.2489338-2-arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190307_154920_146439_D796FD60 X-CRM114-Status: GOOD ( 22.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mikael Pettersson , Mikael Pettersson , Arnd Bergmann , Peter Zijlstra , LKML , Ingo Molnar , Darren Hart , Thomas Gleixner , Dave Martin , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Mar 07, 2019 at 11:39:08AM -0800, Nick Desaulniers wrote: > On Thu, Mar 7, 2019 at 1:15 AM Arnd Bergmann wrote: > > > > Passing registers containing zero as both the address (NULL pointer) > > and data into cmpxchg_futex_value_locked() leads clang to assign > > the same register for both inputs on ARM, which triggers a warning > > explaining that this instruction has unpredictable behavior on ARMv5. > > > > /tmp/futex-7e740e.s: Assembler messages: > > /tmp/futex-7e740e.s:12713: Warning: source register same as write-back base > > > > This patch was suggested by Mikael Pettersson back in 2011 (!) with gcc-4.4, > > as Mikael wrote: > > "One way of fixing this is to make uaddr an input/output register, since > > "that prevents it from overlapping any other input or output." > > > > but then withdrawn as the warning was determined to be harmless, and it > > apparently never showed up again with later gcc versions. > > > > Now the same problem is back when compiling with clang, and we are trying > > to get clang to build the kernel without warnings, as gcc normally does. > > > > Cc: Mikael Pettersson > > Cc: Mikael Pettersson > > Cc: Dave Martin > > Link: https://lore.kernel.org/linux-arm-kernel/20009.45690.158286.161591@pilspetsen.it.uu.se/ > > Signed-off-by: Arnd Bergmann > > --- > > arch/arm/include/asm/futex.h | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h > > index 0a46676b4245..79790912974e 100644 > > --- a/arch/arm/include/asm/futex.h > > +++ b/arch/arm/include/asm/futex.h > > @@ -110,13 +110,13 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, > > preempt_disable(); > > __ua_flags = uaccess_save_and_enable(); > > __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n" > > - "1: " TUSER(ldr) " %1, [%4]\n" > > - " teq %1, %2\n" > > + "1: " TUSER(ldr) " %1, [%2]\n" > > + " teq %1, %3\n" > > " it eq @ explicit IT needed for the 2b label\n" > > - "2: " TUSER(streq) " %3, [%4]\n" > > + "2: " TUSER(streq) " %4, [%2]\n" > > __futex_atomic_ex_table("%5") > > - : "+r" (ret), "=&r" (val) > > - : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT) > > + : "+&r" (ret), "=&r" (val), "+&r" (uaddr) > > + : "r" (oldval), "r" (newval), "Ir" (-EFAULT) > > : "cc", "memory"); > > uaccess_restore(__ua_flags); > > Underspecification of constraints to extended inline assembly is a > common issue exposed by other compilers (and possibly but in-effect > infrequently compiler upgrades). > So the reordering of the constraints means the in the assembly (notes > for other reviewers): > %2 -> %3 > %3 -> %4 > %4 -> %2 > Yep, looks good to me, thanks for finding this old patch and resending, Arnd! I don't see what is "underspecified" in the original constraints. Please explain. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel