Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1699756pxp; Thu, 17 Mar 2022 14:53:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRKjvbOfyumd69tbvNm0yCSb4a9dqfAkzmuqTrXIwGq2Tgu1SGI3/ghZ+WkjtxOFashHk2 X-Received: by 2002:a05:6a00:b53:b0:4fa:6304:6337 with SMTP id p19-20020a056a000b5300b004fa63046337mr2996115pfo.1.1647554030270; Thu, 17 Mar 2022 14:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647554030; cv=none; d=google.com; s=arc-20160816; b=cNrowWZaAMaIGYtxYm+8X4yae7bkWoPkEizW51ojJ5PY6PxDsf8KfigG5X0TYklOGB txfdF2ss2zkHtA372UzXGczsUo8GQ8bbkbVYOE2LXzgK6wySgAQ1pFABCe+VK8Vfg+UC ToGDwcRaEi8aiH68NO/0uiRLIctJ3nMg8sHi2Gi6xUDxkvGi+4J943u5/CwF7CQ1Ty6n B/w5hrzHWa8GqKP+t/1I6IwbST8U9lAogVMgze403TYCq+8t/p4jYDPOOgdxncLyJKCK LkAXLfRNJuZYOyc+VDjcXe+Z+pj/DJ2AzMTU5grkypx5x217E86ytlgwebeL6dffYMpM 8JWQ== 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=qRvk/VVnw4/zCdH06gyReu2Cz7SwRimW7RvRCfYZG4A=; b=y/t7TMIjz8766j+013pVm8mEkZoXuD2Cy+lrFyoJllggMYPjghWowzLDEng+kRLFrq DOl4vd9Tl3oPu6jwuUMGfT/vLjNm4RMoliTQY2PSXlXAuu/GBam7uHsxF47nyL9/u8ui +Bl6FZSd6oXuYmybIsNAdDzWrRyiK2Jyz+iX7+TwY4+frqXq1phCr1r9r7KGHvyLcggT Jy9qbp6cfaiR2VbwmUlFIQu8Lmtfa+iUCyiv5EkBDJmRPfiw6TuUA98PAXR1dU1qIP1x lYIqYzPNKkseLn179yxgA1L9bl9WPIlLA1qbJv5HvU8u4kOMUU4QyiAHd+FLWUCYnCmI OusQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=dCDHswjw; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bd8-20020a170902830800b00153b2d164b8si276993plb.192.2022.03.17.14.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 14:53:50 -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=@linux-foundation.org header.s=google header.b=dCDHswjw; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 86491D4CB5; Thu, 17 Mar 2022 14:22:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbiCQVXP (ORCPT + 99 others); Thu, 17 Mar 2022 17:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbiCQVXM (ORCPT ); Thu, 17 Mar 2022 17:23:12 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF3297A9A2 for ; Thu, 17 Mar 2022 14:21:54 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id w7so11133279lfd.6 for ; Thu, 17 Mar 2022 14:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qRvk/VVnw4/zCdH06gyReu2Cz7SwRimW7RvRCfYZG4A=; b=dCDHswjwXChioTR3TMtLF47+FPdp3xR2CaEXTo6XGOtouRJ2I30xou2UBTwg5UYt5h niC3YiH/fcpCugWi3ZcOsMK6xoTFUjOHwqBU9sBz7hGe2ACJVpQu065giZSEtMNG0lbA Gb7Bvip8XiGbNvYEe5dxzeYkcjGEseJM1fPnM= 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=qRvk/VVnw4/zCdH06gyReu2Cz7SwRimW7RvRCfYZG4A=; b=BysUJbaTRML1ug7hbGB0kca9po674Q09Inf/JSP5+heaFg35x2tfkohGphbhBzLn6F h5fKa4gLGleVab1IEqp6DiGph/LEIu+oj7hhIicB+0ua7HiDUoq+Wh6JpGwYVjdjhNEg Mr4/uAlPcFXcHgtz8MQ4H6SNGSt8Sr7t1PMhHhcVEzcMPrpIuOFhlQOvBuoCncr0EWA3 xdP6Aj8mMRnFEHbBmyQ8lBWxG6L/J9conr7eD63QZw/9BhWeGojuSAVKNmzlPyzp3NTl WE9EE1JSIt/tMdMSNzs0hCDjmJIEO+EtGaGYd0aAPcNqv9g3tDj+8RDmkDdmMBytBC2k Nhzw== X-Gm-Message-State: AOAM532Umf66peU2zCbVJoEaSCQlO8ReqrmGutyEB/mZlE/2ONqmjuEs nxYBgL/fQ7f7nJiHDTuPYzGlG6Pfg5qE3QTi0V4= X-Received: by 2002:a05:6512:3dac:b0:449:f740:eb87 with SMTP id k44-20020a0565123dac00b00449f740eb87mr3140579lfv.579.1647552113244; Thu, 17 Mar 2022 14:21:53 -0700 (PDT) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id p1-20020a05651238c100b004435d1d47fasm543466lft.102.2022.03.17.14.21.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Mar 2022 14:21:53 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id bu29so11219030lfb.0 for ; Thu, 17 Mar 2022 14:21:52 -0700 (PDT) X-Received: by 2002:a05:6512:b13:b0:448:90c6:dc49 with SMTP id w19-20020a0565120b1300b0044890c6dc49mr4276267lfu.542.1647552112472; Thu, 17 Mar 2022 14:21:52 -0700 (PDT) MIME-Version: 1.0 References: <20220210223134.233757-1-morbo@google.com> <20220301201903.4113977-1-morbo@google.com> In-Reply-To: From: Linus Torvalds Date: Thu, 17 Mar 2022 14:21:36 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5] x86: use builtins to read eflags To: Bill Wendling 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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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: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". Linus