Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12248631rwl; Tue, 3 Jan 2023 11:13:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXulaiFN9HaS9bLXW9N2BN2nWtM8p/Bz1ueTP9ipK4F6Bal4Cb8KyD8DckwVeQLUFLAMXI70 X-Received: by 2002:a17:902:f7c2:b0:192:6cc9:922 with SMTP id h2-20020a170902f7c200b001926cc90922mr32833639plw.59.1672773184795; Tue, 03 Jan 2023 11:13:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672773184; cv=none; d=google.com; s=arc-20160816; b=uCVdTsm2cZKYzut5RVe3PBMrXsPsd1ey6aNKJDwkghF4m/k2+5XgwggbuDzW+riuj3 FQDRFgba7TCQ58otBaI1pnzO4IPVvYQ2PK8Cxw58zoqK030iP0koeVVz7BNo8oCyBYKm n/atnteuB706eTQeWRpy54Gi4dw9QbFb81hi74yxw59ZsjkM5n7ixF/MTC+EzUNS1RAJ hUw6Wguo5VuvI1bDO8hn17F/0Bkveyf36LmkWq1cabJ0sNWI91skmZ8rFsflLsF4znVK ANnUlKlJJfq/wU3JbemRcZg/eZEnqFVVO+lRJ+jw1KIE6sm4yhBambcDHbFeAyZTKOki btYg== 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=dfSqSd0mxRLyCP4JPwoGgPSv4V5DgFE+NWQibLY7nHY=; b=nZpfRIJoMcihUSMsx1sy2pPsb+7Nb8F7oLZQOxzQtGO9TMED/BkR9AKmQ6wPQT+QNp 7krsLdvlTWBQIx8ZUk2obV9s5/zO54wPErNHArimqfbQ1hduE9B0HZqMTBOLDbkmg+2J NH5Rq2nRX/xAGpOVhgkEHQzPGep47C56GVD0Jq5/zOgBPoJxBVUr3tMkPFJAAMwYfH2L tBZWQMr69eIOPWJBTWiLL/BV68HOxDSQCXQ0+TI67+V+h4hHV9H3SFHT/NQwzMcJRmDc dqetebonrniXR3eHyLTXR/DXAdFhuGfRvrvRNfkaICx36EiiNZf8vq52k7J2LaOWU43N Wo5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=LQt5OMzt; 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 e6-20020a170902784600b001890f5957c4si6664827pln.353.2023.01.03.11.12.51; Tue, 03 Jan 2023 11:13:04 -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=LQt5OMzt; 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 S233170AbjACTJG (ORCPT + 99 others); Tue, 3 Jan 2023 14:09:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238401AbjACTJA (ORCPT ); Tue, 3 Jan 2023 14:09:00 -0500 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E87113F34 for ; Tue, 3 Jan 2023 11:08:59 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id z12so25304903qtv.5 for ; Tue, 03 Jan 2023 11:08:59 -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=dfSqSd0mxRLyCP4JPwoGgPSv4V5DgFE+NWQibLY7nHY=; b=LQt5OMztUt6H+6pe/VIHwx3Jz4d08J1ZZ7gv40yLS2RfQ9FYAN2BdqaHFaDSeqruh5 UdriUa0s5l2hHmuDgCVQyqdP1mZma/3SqbLGsgMr+3W5DNoGaGK3GwMdoJI3ZUgmswPc hfRjTsp+o7b/O9CFRqovudaZXidsusavosKQY= 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=dfSqSd0mxRLyCP4JPwoGgPSv4V5DgFE+NWQibLY7nHY=; b=5x6t2BG2qtrD5f7XL/IveF4SGDGgbq0276Qyryfgu/jEwNjNyPEiMmR+h0/KHF+1dU 836/EcEp1LFCTEfqd8+x7Ya31uwryjB17msU0oiF+B4BB71osHq/pDSdYL9iCviyB0dI B27CYRnGbIIqhbNlUzwBK3+B8cY1R2nqGQSbqOHCF6lYz/Yi8aMsSI2kZxQFL7czqZSN jjRF5e72EJfetuLOCajABo8lsNwv8qRj7CnM56R7rwH3mfRTxsdwztVt5V79GDZDj8zr HHkw5EiwZX/nwizOC6SbsCOHpEvl2puq1JWV/W/61oiIZ96QQrrLxDL6BPCN5IV54Thg bX/Q== X-Gm-Message-State: AFqh2kr3gB6DTOWsml7aTfihUTGAJPomVDuJv3dCBvCE9VNRQzx+i7kM lbmgsTjKtM1R3XO3FDJs606uB+ryGcCMIwfH X-Received: by 2002:ac8:7c99:0:b0:3a7:e727:a015 with SMTP id y25-20020ac87c99000000b003a7e727a015mr54166748qtv.20.1672772938375; Tue, 03 Jan 2023 11:08:58 -0800 (PST) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com. [209.85.160.181]) by smtp.gmail.com with ESMTPSA id h24-20020ac87458000000b003a7ef7a758dsm19191213qtr.59.2023.01.03.11.08.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Jan 2023 11:08:57 -0800 (PST) Received: by mail-qt1-f181.google.com with SMTP id v14so22523718qtq.3 for ; Tue, 03 Jan 2023 11:08:56 -0800 (PST) X-Received: by 2002:a05:620a:1379:b0:6fc:c48b:8eab with SMTP id d25-20020a05620a137900b006fcc48b8eabmr1650146qkl.216.1672772925520; Tue, 03 Jan 2023 11:08:45 -0800 (PST) MIME-Version: 1.0 References: <20221219153525.632521981@infradead.org> <20221219154119.550996611@infradead.org> In-Reply-To: From: Linus Torvalds Date: Tue, 3 Jan 2023 11:08:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC][PATCH 11/12] slub: Replace cmpxchg_double() To: Heiko Carstens Cc: Peter Zijlstra , corbet@lwn.net, will@kernel.org, boqun.feng@gmail.com, mark.rutland@arm.com, catalin.marinas@arm.com, dennis@kernel.org, tj@kernel.org, cl@linux.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, Jan 3, 2023 at 9:17 AM Heiko Carstens wrote: > > On Mon, Dec 19, 2022 at 04:35:36PM +0100, Peter Zijlstra wrote: > > > > Signed-off-by: Peter Zijlstra (Intel) > > --- > > include/linux/slub_def.h | 12 ++- > > mm/slab.h | 41 +++++++++++-- > > mm/slub.c | 146 ++++++++++++++++++++++++++++------------------- > > 3 files changed, 135 insertions(+), 64 deletions(-) > > Does this actually work? Just wondering since I end up with an instant > list corruption on s390. Might be endianness related, but I can't see > anything obvious at a first glance. I don't see anything that looks related to endianness, because while there is that 128-bit union member, it's always either used in full, or it's accessed as other union members. But I *do* note that this patch seems to be the only one that depends on the new this_cpu_cmpxchg() updates to make it just automatically do the right thing for a 128-bit value. And I have to admit that all those games with __pcpu_cast_128() make no sense to me. Why isn't it just using "u128" everywhere without any odd _Generic() games? I could also easily see that if the asm constraints are wrong (like the "cast pointer to (unsigned long *) instead of keeping it pointing to a 128-bit type" thing discussed earlier), then code like this: + freelist_aba_t old = { .freelist = freelist_old, .counter = tid }; + freelist_aba_t new = { .freelist = freelist_new, .counter = next_tid(tid) }; + + return this_cpu_cmpxchg(s->cpu_slab->freelist_tid.full, + old.full, new.full) == old.full; would easily make the compiler go "the second word of 'old' is never used by the asm, so I won't initialize it". But yeah, that patch is hard to read, so hard to say. Does everything leading up to it work fine? Linus