Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp664491pxk; Wed, 2 Sep 2020 11:27:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyj5KhUNWDUKjwkT79bajvUPg90lNvo1SQZSIkQp6Yv1Wqha441RQNHfHs16WpoS82SBjof X-Received: by 2002:a17:906:ca55:: with SMTP id jx21mr1325558ejb.110.1599071278918; Wed, 02 Sep 2020 11:27:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599071278; cv=none; d=google.com; s=arc-20160816; b=BWNQUYMqYftzPNsomRE5GXKOlsM+OCqxYrshnFixMwR/+KI1XjEyeTBa6/T/e6dRr3 GssXJJ7cqrf/YU3Jdos04ui8p9+vfSDxP6sNZHqyIqaULZ6Em/yACJjR2eXnR7tRj4EH Uk0yk2eSuPsj/KQRl3BB7Cw+NEeTiW2MKOpO1XYurhEeF8ihqMmcno1Qba/rh9rIiui+ WyN89CUjLRjD2OGATTMklQY/qXnoCtIA4qFHApcPWJqAV3j+DXo88SdJ7sLfGoTI+tq8 5YpkdTe6CARvFbeICn/U5j616d1NLYQQZPALZLZQ76aUrrIxD7g6MeSYkJQ0vZNsKeXY SaVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=toj5XDYJGTsAAc7YZakLaUE+SItkLOgxz+rwVKGxyVk=; b=ClVzedVc7pUWnrXXg3zQGtVedx/DQdlFfVm1OBsueHPDaiI+p1KQeQfo60FudgLPf8 yFWINcEEt+RkW7rVXsH2M3f2xqcY3OawKC3v39wUYdN0SMSSAnNMVCgxr9U4mMVlQD1P puQijzKVKt7hhk3J2y063OJdAhWRQ4l4ewFlMeDAd2uTNEoQ04RjHHv2qJwPnjnzp4+O Ry6DlEmM9g+Crqf8avtNlbwN01SuTZfRdxjvTUIGi9y0psOZSMKdbGwtj5biDJw1iEYu vQX3iBFGP6Tm4NZolckn5GPBfd9sBbPFWwpdPiM8I05HDS0/GDR2EeslPHaCuwJfrXGC nxSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=B911asU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pg3si201532ejb.388.2020.09.02.11.27.35; Wed, 02 Sep 2020 11:27:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=B911asU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727884AbgIBSYy (ORCPT + 99 others); Wed, 2 Sep 2020 14:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgIBSYx (ORCPT ); Wed, 2 Sep 2020 14:24:53 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B423DC061244 for ; Wed, 2 Sep 2020 11:24:52 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id db4so59500qvb.4 for ; Wed, 02 Sep 2020 11:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=toj5XDYJGTsAAc7YZakLaUE+SItkLOgxz+rwVKGxyVk=; b=B911asU341cmhWVtC9To5PWjxe+txwCyyfK7C4/76MicjwEZ38sIeb5CjhWGtLhoEv acXSrE81jWFvaq5LdkoioopHHB3dmVKJtxQ4Ej+wNLZ/Wkwqs3tZEApxxDOaaB6Q7GT8 LkUQNtIhQ64IGiIVeDeT32kH+HmuKYFs7wAX7PhcnDR1YstH+lJcTNAbkih5qLHDjepF 7/+A+3W2felZG8bFRt8e776C5g7vtdwrW8leCVEXqpC8TQzotcpDnEOmB13hmh6RmINp o347+OX/JUSKYKSow/UB2JofrFJjfYKbk7xO1+BOcpohrJpleuPver95BtJ6BxfjxLj8 +viw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=toj5XDYJGTsAAc7YZakLaUE+SItkLOgxz+rwVKGxyVk=; b=rOZjgglAIIOuuzDn3xWwe8y+hGmHzRLGVLd3pbr/2/CztJuSSRuc+ZnE23GwcvRQjR tA+5JY2qKRRkAqvjQuGYebElJHrmTPQQxDU3IvAAb1OnEcgEd+ZzYLkqtlU/5gycxEHo 4Bcu3mG+ILGTq+UT4rqJb2CFraFcnf5jHbWcrVsTZXUagErE2sk8/0PGG0bEKhnwPhwR qKl4WDkwp38NNAdfVES+6aB/gv/VabLMTY3x+do16PjBqxctd54cPaiaXxq7JtNyATNN zGEjT18gOYoBlj85r8WyBeIXWv0vBpCI3EIUFpgN8gLsEijmjlXbrEtEcC9qSZX77dNM Rvfw== X-Gm-Message-State: AOAM532JceQq3LdAeqyTyUJEUuVNVUB2/oQnMZdoDs7uK5sViY9UOjgM ZahHWglvnAP1mX0pXIgIDv4= X-Received: by 2002:a0c:f704:: with SMTP id w4mr7899061qvn.79.1599071091841; Wed, 02 Sep 2020 11:24:51 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id k6sm163427qti.23.2020.09.02.11.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 11:24:51 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Wed, 2 Sep 2020 14:24:49 -0400 To: Miguel Ojeda Cc: Arvind Sankar , Linus Torvalds , Sedat Dilek , Segher Boessenkool , Thomas Gleixner , Nick Desaulniers , "Paul E. McKenney" , Ingo Molnar , Arnd Bergmann , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "Kirill A. Shutemov" , Kees Cook , Peter Zijlstra , Juergen Gross , Andy Lutomirski , Andrew Cooper , LKML , clang-built-linux , Will Deacon , nadav.amit@gmail.com, Nathan Chancellor Subject: Re: [PATCH v2] x86/asm: Replace __force_order with memory clobber Message-ID: <20200902182449.GA3586123@rani.riverdale.lan> References: <20200823212550.3377591-1-nivedita@alum.mit.edu> <20200902153346.3296117-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 02, 2020 at 08:19:25PM +0200, Miguel Ojeda wrote: > On Wed, Sep 2, 2020 at 5:33 PM Arvind Sankar wrote: > > > > + * The compiler should not reorder volatile asm, however older versions of GCC > > + * had a bug (which was fixed in 8.1, 7.3 and 6.5) where they could sometimes > > + * reorder volatile asm. The write functions are not a problem since they have > > + * memory clobbers preventing reordering. To prevent reads from being reordered > > + * with respect to writes, use a dummy memory operand. > > I see you added the information to the commit message, but I'd still > reword this to something like: Ah sorry, I forgot to change the comment in the source as well. > > "The compiler should not reorder volatile asm, however GCC 4.9.x and > 5.x have a bug where they could sometimes reorder volatile asm. The > bug was fixed in 8.1, 7.3 and 6.5. The write functions are not a > problem since they have memory clobbers preventing reordering. To > prevent reads from being reordered with respect to writes, use a dummy > memory operand." > > The important point is that 4.9.x and 5.x *have* the bug and that is > the reason for having the hack. In the old wording it seems like the > bug is no more. Then one wonders why the hack is still there (i.e. > perhaps because we don't trust it, perhaps to support the rest of the > minor versions which are newer, perhaps to avoid regressions, perhaps > only the comment was updated, etc.). > > Cheers, > Miguel