Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4135807rwj; Tue, 20 Dec 2022 06:34:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf7j19HkwMqbt2N08ptF2UZNls74JrCFBO5KI6YXGaEnKl8nvzGNEJm2AygsKuiSoi/ubiJF X-Received: by 2002:a17:906:dc4c:b0:7c1:28a7:f7a0 with SMTP id yz12-20020a170906dc4c00b007c128a7f7a0mr53333811ejb.31.1671546858069; Tue, 20 Dec 2022 06:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671546858; cv=none; d=google.com; s=arc-20160816; b=P4a7dlTDCcVijyOIO/ASh2BGXqRLkWfi+c9FO4bjw0oUsTTqbjr9s9cxZcKlYodUM9 Q9UGY6mtaBRIavtjzJZXIOyy6NUACHDICHQ3LYLXwp/OfVs7Pe4mfAXepD2dCy1cB/zG O7b3a1YaiTmHXZEBYV/FlHMJn06KPh9d12x80nhDtysIm7TlnK4ICFYmLI8+IG1bKNJa Ip7zRuW8YgVqSc7Doz5crjYlKfTPeE16HvbJrRmUmvtK4ZgSKnnxpLV1/R1n9/Gzk7op IZK2YuyUuwyVd0a+S9JTMWHHLcy/vT91InUBjyZuHixfafT0dwLD9Yb1gxOvjejdjIq1 SyPg== 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=T/NCsYKC04yFcK1fgm0juUVbSixz96HJYgI6+8cFKck=; b=gUNglDj/V6lFPfjjtnQ7S61nzFqwA79GDg7tuIT4wmPJAQMgpiAUzXjynv+3/hGASE 3i5tye9kGYxkoGxXpuob/ue5YRr5jIVNQpNJfgGkMSMDZ45T5Z+PMXy7zoZB7BnFO0jU d1b+/4Zkk8wGcsCO/rU7bJbujkdOF7jVwmpFRuw15N1SMsG3AVTUm0jcVPEqrnlJua1f IB9NUoZpWaObiAavxMQPNxQ1Y/guBnm4rxSH+UAxA40VZ/nuKgrgP04zwXebtbG6kjvc dhi0vlyf+SNBjUmMfIJdtcslkI4V4YMPnahp6zI79X2XqYIMEhL2r8BtvbLIU82Jwkon pa/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=aW5RhtAs; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 ga25-20020a1709070c1900b008269916aa9dsi5101605ejc.160.2022.12.20.06.33.54; Tue, 20 Dec 2022 06:34:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=aW5RhtAs; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232195AbiLTOcY (ORCPT + 99 others); Tue, 20 Dec 2022 09:32:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233905AbiLTObt (ORCPT ); Tue, 20 Dec 2022 09:31:49 -0500 Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E236186F2 for ; Tue, 20 Dec 2022 06:31:48 -0800 (PST) Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-144bd860fdbso15633139fac.0 for ; Tue, 20 Dec 2022 06:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=T/NCsYKC04yFcK1fgm0juUVbSixz96HJYgI6+8cFKck=; b=aW5RhtAsBkNvIR682pacJYjMBchjsl6CBpgm1GNt+MoU0xR7oZIbXklJVEhSA5imlQ 5u50ol+9QlNXecXRFfrW9BlWpiEgwr54V46RQJ7vPMFVZN8nUM7UL5cjfEyDNsEd6TlT I+s90R9sBzg5F4fXqzDg5UVxzzA1ZnYyjdfck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T/NCsYKC04yFcK1fgm0juUVbSixz96HJYgI6+8cFKck=; b=PkPnlJA/puNC7ha3ICdgq7NZM10HgUpLA2dvKGVtxr1sL2aoWnarlx1lxuc7exDd1j Oz22LzE9s9/Dp+xpjaRUDPrOq3Z7zF5xnf1lOiD9xqQjtwvk0kEKIuuVwwaR/Lk5ZM+e zKvG6vDhlNqtqVMKlWRbmaRJYFpTiqIS4JBRTlZ4T2wE5DIXXNsHsZO46S/KeFm7IEBO xb9LmX2SvOlk4U5cL2pJQDwRBX7BftXOiNSIDBYEJf9qOprSC0dZLE+145wPqwUPOLPR 4wWeUdCFXAprluQBJtmbqrN1U30AxkV48ob9rYFUawcfVitnoZfex9XbFPjTD7ZO8CjO TUnA== X-Gm-Message-State: AFqh2krDrCqvuIEH7v/0X024UDh8QkluEHgwEerv5BzNScXSVsBE/kYx LcUZ2zdOwYOYEG5HTXw6EIMqrn994d6pJH2N X-Received: by 2002:a05:6870:75cc:b0:14b:b6de:5039 with SMTP id de12-20020a05687075cc00b0014bb6de5039mr8780658oab.57.1671546707702; Tue, 20 Dec 2022 06:31:47 -0800 (PST) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com. [209.85.222.182]) by smtp.gmail.com with ESMTPSA id i6-20020a05620a248600b006fc2f74ad12sm9086145qkn.92.2022.12.20.06.31.46 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 06:31:46 -0800 (PST) Received: by mail-qk1-f182.google.com with SMTP id a25so5315423qkl.12 for ; Tue, 20 Dec 2022 06:31:46 -0800 (PST) X-Received: by 2002:ac8:4988:0:b0:3a7:ef7b:6aa5 with SMTP id f8-20020ac84988000000b003a7ef7b6aa5mr8424356qtq.436.1671546695878; Tue, 20 Dec 2022 06:31:35 -0800 (PST) MIME-Version: 1.0 References: <20221219153525.632521981@infradead.org> <20221219154119.154045458@infradead.org> In-Reply-To: From: Linus Torvalds Date: Tue, 20 Dec 2022 08:31:19 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH 05/12] arch: Introduce arch_{,try_}_cmpxchg128{,_local}() To: Peter Zijlstra Cc: Boqun Feng , corbet@lwn.net, will@kernel.org, mark.rutland@arm.com, catalin.marinas@arm.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, borntraeger@linux.ibm.com, svens@linux.ibm.com, Herbert Xu , davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, joro@8bytes.org, suravee.suthikulpanit@amd.com, robin.murphy@arm.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, Arnd Bergmann , penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, Andrew Morton , vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-crypto@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org 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 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-crypto@vger.kernel.org On Tue, Dec 20, 2022 at 5:09 AM Peter Zijlstra wrote: > > On Mon, Dec 19, 2022 at 12:07:25PM -0800, Boqun Feng wrote: > > > > I wonder whether we should use "(*(u128 *)ptr)" instead of "(*(unsigned > > long *) ptr)"? Because compilers may think only 64bit value pointed by > > "ptr" gets modified, and they are allowed to do "useful" optimization. > > In this I've copied the existing cmpxchg_double() code; I'll have to let > the arch folks speak here, I've no clue. It does sound like the right thing to do. I doubt it ends up making a difference in practice, but yes, the asm doesn't have a memory clobber, so the input/output types should be the right ones for the compiler to not possibly do something odd and cache the part that it doesn't see as being accessed. Linus