Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1283762pxv; Fri, 16 Jul 2021 06:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbuNYUHrrupMXZBrf0+4mEPvvNrt/HjFUC0oaiLLSk/NBeCjIPJeaDSASW4orWOisuHhVR X-Received: by 2002:a05:6e02:c7:: with SMTP id r7mr6506519ilq.52.1626440631841; Fri, 16 Jul 2021 06:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626440631; cv=none; d=google.com; s=arc-20160816; b=F5Ag1Y6HFb7+eAX96V8Vxf47JqmiIDl5lJA604uskgvyb1Nvozk3kib7dxDItZOXTD Il8LXxeIxf3pZKWE+w/F5XZgIpWSE6XsazUy8Jc4LoZTCHxL37PaXOwdZitWRntirYfZ 4TXAiEzPlpdjWx8Zzz5lF94lJW/8uhIRfpNK1uu2WUDFHIRj2oWasn/9g7g+8+ZJHXBn YbiMKJJ8/JEHo7gFKdk4PDZrfZGu/9kZi+NpzQohd6efnjEUmPY+7ogdOXoRuia7D9J4 vQ25w2VO3QTCokW6DhtFz3KJtWsIaCudxrDL/iHgYJNs/70IsidXsA6m2GgXluhqBMuM MOIQ== 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=Bkq9P2VFsm4ppYWuB9WINu1JS/LrWhKDtoo14HRcB2Q=; b=EDQEbntWg975sj0I/YdP2MQnvaGhLpk+Bn9r254GJI7EzadhOOVSN2ptmXJopN+Nhm mx+e/jaQjOm0+k0u+AEiUqFZtEhc1Y6tMinFG6A8nAGrxMCIL4Czq6R4n68+cLdRBGoZ SgI+4RVsvi2TI6B03OkOzhvqCyTu0ipzdOIE/VNdlXCYux38vuWPS4xdBCC06dTgizla clWWcu1Ms/SZFw1a2o+ALlFQ9ZRwsZANJ/xgeIESCa/ae7nVU4Eiu2IYzoOqx3ZruiAQ 7FYBtgbsdCy/MZ6s3Xhi53pUcMbUuyXqTCtYA7ceyCrRZVqfjUsULg6558VOgtsX8Y9E VEUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=GfkhMt2V; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i19si11305347jab.103.2021.07.16.06.03.29; Fri, 16 Jul 2021 06:03:51 -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=pass header.i=@google.com header.s=20161025 header.b=GfkhMt2V; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238560AbhGPNFa (ORCPT + 99 others); Fri, 16 Jul 2021 09:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbhGPNF3 (ORCPT ); Fri, 16 Jul 2021 09:05:29 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E42C06175F for ; Fri, 16 Jul 2021 06:02:35 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id t4-20020a05683014c4b02904cd671b911bso1699409otq.1 for ; Fri, 16 Jul 2021 06:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Bkq9P2VFsm4ppYWuB9WINu1JS/LrWhKDtoo14HRcB2Q=; b=GfkhMt2V4wJ6lezJdIVpsqvAaAA3nesByteX7oepAsPKu2JImJDL4PdtVuu3P4AmRy X/HdTt0/EjWfSorA2Wb7mayEhHcrZ3lWKqQqwRvSTybAlbDa2wEfzb45Jsqv31vfaOad CpLWBqtIHoWf2HmYvYMze50CQcrl6Sdaox3FR1pCzsH/T53AEbVeJv7Qx/KxAlvk8crW IzZqqvLbqYeLf0f/ym5JZcujv8D2EBGj/94SnIkqyQj8bdUVK/agUdHglcX3RbU55gUO 0qEAmzs8DLPzdoOft/uF/WRqZ6fQfpDRlHCp/WVp395QWPYYFDFHpR+VoZLPLsF0k3FS 4IQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Bkq9P2VFsm4ppYWuB9WINu1JS/LrWhKDtoo14HRcB2Q=; b=WI1jGS9SWSK6Q4dII+MToSBQnjnbeciMnniahKSn1K0u/NyxyBLdZgjig41NYaTe1P mXjlg9EJg9FBuz3TUPtTsGB4rPC3ttRBixN33iBmPOD0KNqwlrvT8FCs7cJ+IuxODwbK hcUCqadpAvZVKl/TSg0NeOvvRafkZhzgrrvsGGx481+4rpAIOM8ngKvFdMbm2YAA3Qwg xiKmSGk3Q+QVAJ4YxCI7RMq3cRlmHEn3fpUlIDMrayb7xPesVO9++wEZSvX5k3tEQ1NN Iou0ziO2CFurbRx50Py7p4cBoqwsbHQF/7Lr7LeC94Yw8zNM1uXn1WekFl5m0oZrtKnH 2uNw== X-Gm-Message-State: AOAM532p7vbHxFSqgY0fii/jzAKiq84WYQQD0+aYG8kZ6mAFJqpIRExF mmP+EqIMaKSh1XGOXxa6c9vVHNZNHW5zG/ltoszhXw== X-Received: by 2002:a9d:6c9a:: with SMTP id c26mr2780403otr.17.1626440554357; Fri, 16 Jul 2021 06:02:34 -0700 (PDT) MIME-Version: 1.0 References: <20210713105253.7615-1-mark.rutland@arm.com> <20210713105253.7615-6-mark.rutland@arm.com> <20210716122114.GB78984@C02TD0UTHF1T.local> In-Reply-To: <20210716122114.GB78984@C02TD0UTHF1T.local> From: Marco Elver Date: Fri, 16 Jul 2021 15:02:21 +0200 Message-ID: Subject: Re: [PATCH 5/5] locking/atomic: add generic arch_*() bitops To: Mark Rutland Cc: linux-kernel@vger.kernel.org, Boqun Feng , Daniel Axtens , Ingo Molnar , Peter Zijlstra , Will Deacon Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 16 Jul 2021 at 14:21, Mark Rutland wrote: [...] > > Why not just: > > > > #define test_bit arch_test_bit > > > > and similar for the ones that use plain accesses? > > > > And not include instrumented-non-atomic.h here nor do the > > __is_defined(*_uses_plain_access) change to the instrumented header, > > which seems to overcomplicate things as it effectively just aliases the > > non-arch_ name to the arch_ name if *_uses_plain_access is defined. > > I'd done that to still permit the compiler to out-of-line the non-arch > forms if it wanted to. That said, I see that for the atomics we forced > those to be __always_inline anyway, so maybe that's not a concern. > > I'm happy either way. I'd prefer simplicity. In an optimized build, I think even if it decided to not inline, the perf and code size difference is a wash. Intuition tells me that inlining would even be preferred either way, but I've been wrong about that in the past. I think originally we turned the atomics __always_inline because of uaccess regions. Because debugging tools do work in uaccess regions, arch_* aren't necessarily appropriate. So something like a test_bit() in an uaccess region might actually generate a warning. This might be a valid argument for __always_inline irrespective of optimization potential (if there is any). Thanks, -- Marco