Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1868909pxb; Fri, 25 Mar 2022 07:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWX1k/CdpgVxFD6ZnpR9AhvgZhln4R/l3JUF9UgajZWTuupetYLFz+3Va+ymSMscjgp78S X-Received: by 2002:a17:907:761c:b0:6d6:e553:7bd1 with SMTP id jx28-20020a170907761c00b006d6e5537bd1mr11545989ejc.5.1648217160146; Fri, 25 Mar 2022 07:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648217160; cv=none; d=google.com; s=arc-20160816; b=mH8FWyh7rh6xsEdd1qe6wmY42F23sBnt4h0d0mP9hqmNC5ghXTC0KupeTxgGqLhDu2 dIA8DzBVuXztVVPdJcPnmue2mTpQWaWc9Vp1ZDOcYAb/CRm13Unt2hsymo0zu6KxEPZT G3A3BvYP2hEMEny4aXqVHHkiQ/WOU6GB5j+dC91+4/t8G/R83cGSDJbB8MWT7EjP2WqG LH0R9Z0ACNiqhr5597nxT9MT0eUjEMA3Axcv14wETwoLvlrsC6ZZDhsE4JpwsUwiqXo6 VUnKQwvqFGnQ/KB53RxOH9S7aif8zPb9eGIUnF4YC1s9eS2+3x1gsYwQs/UtTy3GXwNx Ap+g== 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=nV5zT/IPWfHfMALgu8jZtBHLqrJVNpVUru45QGm3f4Q=; b=DNokghGYSowxOL2RFMSLi98kjdpIxdLrfey3t4eij0Tk2nSWJ5ci/u8cGAOfNZubaz GkLOxmXDcuznL3ckMYlbFY+2YQFwHSjeGQyayXwyktaD45GLNmcF7/t3kQ2qWJM6CuJm qHPt4lnd1zTQbmmHDy108tfNQJj90Cs5HZvOsAlc7g2TciOnM5sJ0ih0mnwCRKBtDoKY 2xaKcx1AfTwBBiag0xlgv4RMoWt3v/A3b1oHQyADRh3wqJSIpGqO7LwYfUUdrmJRYwno Kv7iEXdQnDvm/K5rKHu4mMVOjULJpQQaa9ZJv5o0sCcjPdnOjx8D2vil+jTDiQwjySpj f8yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EDGC6GZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id da3-20020a056402176300b00418c2b5bf6bsi2693892edb.589.2022.03.25.07.05.28; Fri, 25 Mar 2022 07:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=EDGC6GZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245724AbiCWRTA (ORCPT + 99 others); Wed, 23 Mar 2022 13:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233723AbiCWRS7 (ORCPT ); Wed, 23 Mar 2022 13:18:59 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 085917A99E for ; Wed, 23 Mar 2022 10:17:28 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id b5so2774162ljf.13 for ; Wed, 23 Mar 2022 10:17:28 -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=nV5zT/IPWfHfMALgu8jZtBHLqrJVNpVUru45QGm3f4Q=; b=EDGC6GZYd561Kfvi+UNV2Jbxs/RFabbWODAha5eN/uNyRfD+AR/HATK85SzSZjR0bd n9O/SCH17cisoXSg4p2AvG+0P0kJyIroKhhFJWOvyzrM9sAd8WNRvrUWMMf55mee7TcP ov5fPu7eDU8aOW8biKmHQDFZc31HOUmWJsRcE= 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=nV5zT/IPWfHfMALgu8jZtBHLqrJVNpVUru45QGm3f4Q=; b=xgCEq48ar1ViXu7fX8Pw1FtLfwxiLaX0kP7wZY3ZWg3qVAIdwStQ0jmiFC8iJ0w0HY //Upszn1kImBbrR/ihC5mcp70HCoRqQeHM/JTLvhPjvMk+VxFlEwdpaa16FLXkJ43LjA fE2f+QbCceMtQHOlB4gFuFYNGMNU8rH2YoZ5OZgwCNsDnB2DPH2v1Vj7nQwyZMEvnrBc rv4cxITtEyqilgECSf+J2LyS5rdwt9wfDniqRpZzmW+Do4Y3vpcroL/dlKDoClIh0c3t eF49Oq1k8dggxwBTNP28CvGZxds3wQ73cRSwEL8iJpB66J+Tb5pVXiMShIjJOVBIyL2E f/8Q== X-Gm-Message-State: AOAM53130m2VgvvwDGUYTO5K1/0g32pjNIeSAFOSK0qcBDjXvjFKSZ60 tTIaPoGN+gu57kF0IEfxOTV4cRvf6bKIIdo/GIs= X-Received: by 2002:a2e:9a92:0:b0:249:7e2e:3aa5 with SMTP id p18-20020a2e9a92000000b002497e2e3aa5mr869701lji.86.1648055846818; Wed, 23 Mar 2022 10:17:26 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id z13-20020a056512308d00b0044874828803sm42003lfd.309.2022.03.23.10.17.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Mar 2022 10:17:25 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id w7so3819887lfd.6 for ; Wed, 23 Mar 2022 10:17:25 -0700 (PDT) X-Received: by 2002:a05:6512:3055:b0:44a:3914:6603 with SMTP id b21-20020a056512305500b0044a39146603mr644774lfb.435.1648055844654; Wed, 23 Mar 2022 10:17:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Wed, 23 Mar 2022 10:17:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] locking/local_lock: Pretend to use the per-CPU variable if not needed. To: Sebastian Andrzej Siewior Cc: Borislav Petkov , Ingo Molnar , Linux Kernel Mailing List , Peter Zijlstra , Will Deacon , Waiman Long , Boqun Feng , Thomas Gleixner , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Wed, Mar 23, 2022 at 4:09 AM Sebastian Andrzej Siewior wrote: > > Replace this_cpu_ptr() with __ll_cpu_ptr() which points to > this_cpu_ptr() when it is used. Ok, so that's just really ugly. Is there really no way to just fixthis_cpu_ptr() to not generate crap code when the result isn't used? I get the feeling that the real problem is that on x86, we have this: #define arch_raw_cpu_ptr(ptr) \ ({ \ unsigned long tcp_ptr__; \ asm volatile("add " __percpu_arg(1) ", %0" \ : "=r" (tcp_ptr__) \ : "m" (this_cpu_off), "0" (ptr)); \ (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \ }) and that "volatile" is just *WRONG*. That volatile is what literally tells the compiler "you can't remove this if it isn't used". But there's no point to that. So how about we (a) just revert commit 9983a9d577db4 (b) remove that bogus 'volatile' Doesn't that fix the problem? Linus