Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1706099pxp; Thu, 17 Mar 2022 15:03:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4o+j0+QHjD2133rq8F9+z+svCNtMRYr6ICDK+0vbnD6fnnmP6g3ouNxHXSa0/5mnQNXP4 X-Received: by 2002:a63:7cb:0:b0:380:f89f:c9a2 with SMTP id 194-20020a6307cb000000b00380f89fc9a2mr5305960pgh.264.1647554606455; Thu, 17 Mar 2022 15:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647554606; cv=none; d=google.com; s=arc-20160816; b=ilg9XFOKaE5Vu9AhVvEkk5MkmEyuv763+nHelQX40kKhULgp7aGsZUgzMiRFG1iMr5 rMwWqeT4Hxe1Oc+CeAxaYcQ1zU2woo2988slrZ1m2PsBlY9i2RnpzOTJ5tuY/KI6tE6C RFv/OMBfaDSJtS2W0hi1QtbxJl/SJv5UR0UDlzD9W6IK+VE7/i98yb08CcKJAmoKwOsW yN+OHvuiwK3QbtkMIOLpjTw/xQdKecrCA7rhOgbFRnZAdhI303/YOq+CydrpE3POgkJD p3/l28w1LDnQ/fDFBK2vnD+gandw8kZSJRWSKqBkUDGNaN6Sy/TEzU5dJL51+JAvVT7D TogA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IPOIkmx/1ZEzac6tX87LtTmxD7qv0ZDR17y94CVjDjM=; b=ofTfFmQPT5Cprh4qAKEqXfYI8zz9k+ngHzVjxM95/FdBFaJSfYcccp3/0zaZM9Jh88 Pd0tpKPndsI4QngwIT+Dj5HsZ6Y9A5mFPZOkpzdreuAz5yXcQFIy7nrR8mpuOWOsP71E HQD0hWS9E115eoEjuzV4vHEc3S78dIxm35gWUt09MGh+DXZm+J3rpTp8wpqpcs3SK4L+ J2Jvc89m0rf+0G8KE/dmqGLYdt0RgB9Bfp9cjByfuXx/iZFowDyVsZkeyhDVZXw/UQVU l947+GGnRH8TIYzQFL1i9bpOcHawkpXxKwqcVtSaCNDT3IG+DixitTv28ENvm+wWG4td g8yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PPA8dRi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pi7-20020a17090b1e4700b001bd14e01f2esi10202198pjb.28.2022.03.17.15.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 15:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PPA8dRi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52BC2173377; Thu, 17 Mar 2022 14:45:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230368AbiCQVq4 (ORCPT + 99 others); Thu, 17 Mar 2022 17:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbiCQVqy (ORCPT ); Thu, 17 Mar 2022 17:46:54 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E1E411A9B2 for ; Thu, 17 Mar 2022 14:45:37 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id d19so7897151pfv.7 for ; Thu, 17 Mar 2022 14:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IPOIkmx/1ZEzac6tX87LtTmxD7qv0ZDR17y94CVjDjM=; b=PPA8dRi4KI3FwJ1U/1S2LJsZEyxCAqZHA8pGlFu0lhXkTkpwruUj6vS3P/MD4h7Z9Q irjoPWQIUZtr1wg3ZfXIk7I4s8Vw/LtWDH9EultQ9EYJwNjUPdXj7Ya9P+2LlSsCko3Y XZKsqFy3IRVk3HZx7XNt59NGkxb1MlAj+3XhXng6bAtmwnDFWhDVO/sDNnnYWl+4R1g+ j0qXbx3o//DiCZcjkQZEHSBxwYc/lMHnUgTL6PweZCYjBImpNvtPFOVr+YBwNAwpEqBW 0RBNL0R6oO+CdphmVSZLHuhzGjygGU1X2DMvFj516Nd+sgD1Y7xyniu/9KhIM2zz1nnB YVog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IPOIkmx/1ZEzac6tX87LtTmxD7qv0ZDR17y94CVjDjM=; b=LgCxUDJukZReZwjcF2yUy6+iqTdkr+7uMEyAf4WA4ZtFO6iRtohbt3nDpo41IvX4sh 1UWPA6De1XKCtkchhNnTd/rAhngJ98DbPal9gI5HTLXVIP9vuQmoYZcZUAPCaZCr3gG/ YKgESsbdxnRiYs78GVZw9ytClmSZ5UCvtpneKBleE70FfOvNc6Itjg5DUOGqbvsoRBKC Mlc9ZVLcQPQ9LCZ/7SDwWa9K/ND3BqdQA82XzTTOhcO9yO2JnIeljD7VM1DRzHuIcqGB etHubLD2BVJ/oILqRneP0AYgG61fa9795cQpVAKSK1Z5xNRA4H+s8FFc2aOrHNHYzc3Q rk0g== X-Gm-Message-State: AOAM530aaSdDNaVfTaKcXhOv+iDjw15gg2fRQB6D0ped+P9z2F/7pAc0 iMRuTylAhGgEjjjqi3ctDon+p1XEN7L4uH3yOi8H X-Received: by 2002:a05:6a00:1596:b0:4f9:f992:9f69 with SMTP id u22-20020a056a00159600b004f9f9929f69mr6437304pfk.7.1647553536437; Thu, 17 Mar 2022 14:45:36 -0700 (PDT) MIME-Version: 1.0 References: <20220210223134.233757-1-morbo@google.com> <20220301201903.4113977-1-morbo@google.com> In-Reply-To: From: Bill Wendling Date: Thu, 17 Mar 2022 14:45:25 -0700 Message-ID: Subject: Re: [PATCH v5] x86: use builtins to read eflags To: Linus Torvalds Cc: Nick Desaulniers , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Nathan Chancellor , Juergen Gross , Peter Zijlstra , Andy Lutomirski , llvm@lists.linux.dev, LKML , linux-toolchains Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 17, 2022 at 2:21 PM Linus Torvalds wrote: > > On Thu, Mar 17, 2022 at 2:10 PM Bill Wendling wrote: > > > > > > As a result, we mark pretty much all system instructions as being > > > memory clobbers, because that actually works. > > > > For now. > > No. Forever. > > If you change the compiler to ignore memory clobbers in inline asms, > we'll stop using clang again. > > This is not some kind of "threat". This is literally just a plain fact. > > If you turn your compiler into garbage, we can't use it. > > End of discussion. > > > > Whether they actually clobber memory or not is immaterial, and is not > > > why we do it. > > > > I understand that. My point is that it's not a guarantee that the > > compiler won't change in the future. > > YES IT DAMN WELL IS. > > If I have an inline asm thing, and I tell the compiler "this inline > asm reads or writes memory in ways you don't understand", and you then > move externally visible memory operations around it - or move other > inline asms that do the same thing around it - then your compiler is > simply not a compiler any more. > > IT IS BROKEN SHIT. > > See? > > That memory clobber is not a "please mister compiler, can you pretty > please take this into account". > > That memory clobber is a "if you don't take this into account, you are > now no longer a working compiler, and thank Gods we have > alternatives". > > This is not a "in ten years things can change" kind of issue. This is > a very fundamental and simple thing. > > I don't understand why you can't just admit that. > > This is as simple as 2+2 being 4. That's black and white. > > There is no "the compiler might optimize it to be 3 at some future date". > I'm NOT saying that it WILL change or that it SHOULD change. I'm also not saying that your concern isn't justified. What I am saying is that unless you're using a compiler feature that's DEFINED as having a certain effect, then you are not using that feature correctly, regardless of how it's acted in the past. And it has the potential to bite you in the ass sooner or later. We've all seen such things happen before. I'm not thick and you don't have to yell about this. We're on the same page! :-) It would be much much better if there was a feature that was defined to act in the way you want it to. But I'm not offering one at the moment or even with the change that started this thread. -bw