Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8127950ybn; Tue, 1 Oct 2019 03:43:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwn3B1oiMwxni0DCLfAzGDLXuIAyjKgV3cFyh8ZXfG+DSxoBsP98aLGfP5VwQLYew9s6Qzn X-Received: by 2002:a50:ce06:: with SMTP id y6mr23953679edi.282.1569926637259; Tue, 01 Oct 2019 03:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569926637; cv=none; d=google.com; s=arc-20160816; b=BenOkphA6uVSdkZOYArt+JuToXaazZzJYZGBaF1aV5ey2NpwfW7C9sdgqGWTNKd0th BDJDCdTf9QsJqZ6zYiRxyRJossUIQM/b2itvzuHbrwi7WSgscT9q276iNUX14/ZUi6P8 xcI5hEPgKHodyhxGltjgUb+rrEsVHoo7845q0YJH4KDlim+DQ6/wLN/34704hX99oEVp xAHIxaWtv8Tlb5DWlXNYtPYaghEogvA2dEsASoM6alcOf4p3S4zAGHDsN5ZMVFTVYtIo bVwQKJ5I7ThRH3cZ8swqNj3OUyXYjUmgjayYXq/cA7pmiEq39iOs+QH2Rw2oDndMKvUR Vb3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2/d6bzosu2zf1ANP81nydQ5QKAbWCaPx11efdQYnfQA=; b=0zICF/ebJhl9awLx1OmBlgTcPVcbt57fSD+WRcZ1XgyVRayJIk5dEnJegdb56O8ajA 27uLhGi9Xf3kf6d2qh3BT18t+QhoogCO6lCzeLrYFJFFWwOaJkGV8UNyykLJd5ZQxs++ 3OhMamea7DwtBtZt87gqSPhO/xJdk8NbdyP7qzO3dRTPRHSvlxp/NcMef1JYj2nJGjq7 lz3hIzKqgQFaxROn/T5adFH49dyZ8fwNCW6AD4QAUEtNl2WoVBtZ8dof9dZzxP3whI/0 sWf2M+Klif9SlK1kJ4cny0XouHbaAV553VaTNig7kK5Ma32oKUNCShwwk97iR/ueAdEw JKeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cwf1F1de; 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 e48si9287885eda.130.2019.10.01.03.43.32; Tue, 01 Oct 2019 03:43:57 -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=Cwf1F1de; 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 S1730876AbfJAKkv (ORCPT + 99 others); Tue, 1 Oct 2019 06:40:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:51268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfJAKkv (ORCPT ); Tue, 1 Oct 2019 06:40:51 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 533B321906; Tue, 1 Oct 2019 10:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569926449; bh=RjGesY7GpigpFIYyIbZJxfLAID7Ik88bqq8JTjW3xZo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Cwf1F1dehd7IynLxOYfvypyn3apYhqkQ82qyRJHxWTt5sxUqGuUJ/Czc/O9NW2Kns mG4D8ekmgwgbPTUEPNgonxupyl8tSywqpwNvHGgLsk0rE+VqtNKseqJICPsHohzyWu S4i2b2HZnyO4FK+G6rPck1giLDngCrkOvhvEC8Xc= Date: Tue, 1 Oct 2019 11:40:44 +0100 From: Will Deacon To: Masahiro Yamada Cc: Linus Torvalds , Nick Desaulniers , Nicolas Saenz Julienne , Andrew Morton , Ingo Molnar , Borislav Petkov , Miguel Ojeda , linux-arch , LKML , Catalin Marinas , Russell King , Stefan Wahren , Kees Cook Subject: Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly Message-ID: <20191001104043.cmgpa2lztwdwi35m@willie-the-truck> References: <20190830034304.24259-1-yamada.masahiro@socionext.com> <20190930112636.vx2qxo4hdysvxibl@willie-the-truck> <20190930121803.n34i63scet2ec7ll@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 01, 2019 at 06:39:34PM +0900, Masahiro Yamada wrote: > On Mon, Sep 30, 2019 at 9:18 PM Will Deacon wrote: > > I agree that the ARM code looks dodgy with > > that call to uaccess_save_and_enable(), but there are __asmeq macros > > in there to try to catch that, so it's still very fishy. > > I am totally fine with double-checking > the output from the compiler. Sure, but don't you find it odd that those checks didn't fire, and instead the failure occurred at runtime? > > > I fixed it already. See > > > https://lore.kernel.org/patchwork/patch/1132459/ > > > > You fixed the specific case above for 32-bit ARM, but the arm64 case > > is due to a compiler bug. As it happens, we've reworked our atomics > > in 5.4 so that particular issue no longer triggers, but the fact remains > > that GCC has been shown to screw up explicit register allocation for > > perfectly legitimate code when giving the flexibility to move code out > > of line. > > > > > The problems are fixable by writing correct code. > > > > Right, in the compiler ;) > > Not always. > > You showed a compiler bug case for arm64. > The 32bit ARM is not the case. I would be /very/ surprised if the same compiler bug didn't also apply to ARM, which is why I'm championing the conservative approach of restoring the old default behaviour rather than run the risk of runtime failures. > > If it helps, here is more information about the arm64 failure which > > triggered the GCC bugzilla: > > > > https://www.spinics.net/lists/arm-kernel/msg730329.html > > > You put multiple references here and there, > but they are all about arch_atomic64_dec_if_positive(). Right, but that's because it was the atomic64 selftest code which triggered the compiler bug in practice. Without a better understanding of why GCC got this wrong, we can't assume that no other register variables are affected. Will