From patchwork Sat Oct 28 21:15:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 159293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1401075vqb; Sat, 28 Oct 2023 14:16:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGk7KwTvpFshjy88pCpWSH/r7cDnxY0YeeBZlZHxkXkpbNh6DKCSzurDTTsJ1523hWYNDpf X-Received: by 2002:a05:6808:f01:b0:3a4:298f:b2e0 with SMTP id m1-20020a0568080f0100b003a4298fb2e0mr8728606oiw.26.1698527796882; Sat, 28 Oct 2023 14:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698527796; cv=none; d=google.com; s=arc-20160816; b=QRK4APFUpE3lDlMthczbSP17XuFVJvo9AfHjGw+fJetVe0vDs4LU6E++wKTbB+VQrU XHA5y4UF04RFhCm42B0KrIA8uZPKKhaGJabG3OhRpKi+7mJI0tBskq99qhgfA/pTkgNA c6Qkx622NODvIXbXvvnKhygCCNBw2DS0Yd5erI0I8EAVgp6mlPcbhCabHwsdNGYD7tzh RtmuyRB0RZqCGiKQwRbEWmsafKCBUQ5vwoqaHQNZCZeAEAZG1qio2q4EFnzLZc+oZp+E PT+7uTfdCRVhthqGhjC+DdLTubJla0MhKvnsi7e4c4cQRMbXuoDRxxFUmOeJTrN2XA9K ED7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:mime-version :content-transfer-encoding:content-language:accept-language :in-reply-to:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:dkim-filter; bh=eR4ECi1C+RsYauRNG0Oa6wKRBmELNPkutLhe+B7jobc=; fh=uxBAUgUSkBYxjd1CTtcj7MO+vdwExfJsOb4I3IkdCcM=; b=ocl/A/bH9RR+/+SV52S+z35iRntbxfjjLs/MyMgKf3KCFRSWRzA50RrK98Y7UYCC9V FyLXnbVw4e8h2PKXxJkn/dWZK5bD+bbv83xMeBA1y8X0UeIermbO14C42ZkojpxnAymZ ETh1Z4nY/o+2qYo+AqQs8arw8U7uWHY5dkoJiPPpDNPlI2fq/v9bmXJx4MqcSQgfycbj U5EQAfKGxAdscr25tw+HkQBxpp0SnVcXYH59aJrkMAA86GMgIuYmOboSj867gu7OmpoR PP5QblaPoOOcZ7GUhQagCC/EYPnX6uo1TtBFEDNZZOo2t3ELc4D15lUEptFkar2SxOfw lqdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jjaWoMKm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e28-20020aa7981c000000b006be053633ecsi2809645pfl.388.2023.10.28.14.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 14:16:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=jjaWoMKm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 715F48096A79; Sat, 28 Oct 2023 14:16:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229940AbjJ1VPs (ORCPT + 29 others); Sat, 28 Oct 2023 17:15:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbjJ1VPp (ORCPT ); Sat, 28 Oct 2023 17:15:45 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40B68E4 for ; Sat, 28 Oct 2023 14:15:41 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231028211539euoutp0142e29c438873fee95c3bbe1de6e9a1ad~SYfrxIV663100431004euoutp01K for ; Sat, 28 Oct 2023 21:15:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231028211539euoutp0142e29c438873fee95c3bbe1de6e9a1ad~SYfrxIV663100431004euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698527739; bh=eR4ECi1C+RsYauRNG0Oa6wKRBmELNPkutLhe+B7jobc=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=jjaWoMKmpeL2sLoVtVIJ4rBEKLLd2KsJYQnpEHdBiXJriXoTywXG7JA0og2/7E9L4 nh3HhyRmF4s0KfRNL2fV8cM/ugVIvmzKE6VHyE/hZDSmpARN7AkVO0+/3hrdTuAeGS B39ZTQ5pTxSF7SBjTBKGSvpsliXmO/RVLKc4DdkQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231028211538eucas1p2c2a45a33072dae2e110eb46cac041cea~SYfq672AJ1087910879eucas1p2A; Sat, 28 Oct 2023 21:15:38 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id DA.57.37758.AF97D356; Sat, 28 Oct 2023 22:15:38 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231028211538eucas1p186e33f92dbea7030f14f7f79aa1b8d54~SYfqiRzRj2326023260eucas1p1N; Sat, 28 Oct 2023 21:15:38 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231028211538eusmtrp26da1062912af33695c737ab5cb5b69ed~SYfqhpNZo1141411414eusmtrp2Y; Sat, 28 Oct 2023 21:15:38 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-f7-653d79fa5a08 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2B.F0.25043.AF97D356; Sat, 28 Oct 2023 22:15:38 +0100 (BST) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20231028211538eusmtip1dbcf26df78fa637ec241be47c974aeb8~SYfqUnhnc0467404674eusmtip1G; Sat, 28 Oct 2023 21:15:38 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 28 Oct 2023 22:15:37 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Sat, 28 Oct 2023 22:15:36 +0100 From: Daniel Gomez To: "minchan@kernel.org" , "senozhatsky@chromium.org" , "axboe@kernel.dk" , "djwong@kernel.org" , "willy@infradead.org" , "hughd@google.com" , "akpm@linux-foundation.org" , "mcgrof@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-xfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-mm@kvack.org" CC: "gost.dev@samsung.com" , Pankaj Raghav , Daniel Gomez Subject: [RFC PATCH 01/11] XArray: add cmpxchg order test Thread-Topic: [RFC PATCH 01/11] XArray: add cmpxchg order test Thread-Index: AQHaCePk2/Onfe3eA0ia1dQGCoKrAw== Date: Sat, 28 Oct 2023 21:15:35 +0000 Message-ID: <20231028211518.3424020-2-da.gomez@samsung.com> In-Reply-To: <20231028211518.3424020-1-da.gomez@samsung.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [106.110.32.103] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNKsWRmVeSWpSXmKPExsWy7djP87q/Km1TDS60mFvMWb+GzWL13X42 i8tP+Cyefupjsdh7S9tiz96TLBaXd81hs7i35j+rxa4/O9gtbkx4ymix7Ot7dovdGxexWfz+ MYfNgddjdsNFFo8Fm0o9Nq/Q8rh8ttRj06pONo9Nnyaxe5yY8ZvF4/MmuQCOKC6blNSczLLU In27BK6MV8/WsRU08lVMWbqLqYHxPXcXIyeHhICJxLkp75i6GLk4hARWMEq83rOKEcL5wigx Z+M5ZpAqIYHPjBLr//HCdJzp+AbVsZxR4unkncwQDlDRlx3P2SGcM4wSR57tYoFwVjJK3H95 jwmkn01AU2LfyU1gVSICs1klDi/uYARJMAvUSax5NosFxBYWsJS4seoSK4gtImAn8fDWS3YI W0/i3PVXbCA2i4CqxJPtG8BqeAWsJVae2gN2LKeAjcT9b9vBahgFZCUerfzFDjFfXOLWk/lM EE8ISiyaDVEvISAm8W/XQzYIW0fi7PUnjBC2gcTWpftYIGwliT8dC6Hu1JO4MXUKG4StLbFs 4WtmiBsEJU7OfAL2sYRAE5fE2mc/2SGaXSRufFsAZQtLvDq+BcqWkfi/cz7TBEbtWU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E CXMK2Ejc/7YdrJxRQFbi0cpf7BCrxCVuPZnPBPGCgMSSPeeZIWxRiZeP/0G9piNx9voTRgjb QGLr0n0sELaSxJ+OhVAn60ncmDqFDcLWlli28DUzxDmCEidnPmGZwCg9C8m6WUhaZiFpmYWk ZQEjyypGkdTS4tz03GIjveLE3OLSvHS95PzcTYzABLXt2M8tOxhXvvqod4iRiYPxEKMEB7OS CC+zo02qEG9KYmVValF+fFFpTmrxIUZTYBBNZJYSTc4Hpsi8knhDMwNTQxMzSwNTSzNjJXFe z4KORCGB9MSS1OzU1ILUIpg+Jg5OqQamtVN4di4qPqJW9uUiy9JTR6OSr77+oZN58HBy0mlj rV2/wkqcnLi/Hmj1VTzpycA2fRuHyt1LNnszbn2vFJ8bua0+pNPuTkzxli/OPRdfr5O/Zr9u 4bfNfZ58P5nt92YmyEsFH3/sNP2aiJC23dSJnoa/W9+ryPQa+ixZMWVjxofg/+83lyowMH29 fFbh9dyvPAd4dnM67THTdqvzipjd8sfUpmPqg4vNn92ZS1iuJion6zwJPOIQksO5fJnqn7Zw kVcx3Mvu7H/8/f2ErochM97c/v6E9eWUHOkY1k3uv+XuL1Z0CHta+1oldMaK+gfeAkqFCz+W BJhWPH6WrvJD2nztj0ARLbfcNVZfC3pllViKMxINtZiLihMBJkEZzNkDAAA= X-CMS-MailID: 20231028211538eucas1p186e33f92dbea7030f14f7f79aa1b8d54 X-Msg-Generator: CA X-RootMTR: 20231028211538eucas1p186e33f92dbea7030f14f7f79aa1b8d54 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231028211538eucas1p186e33f92dbea7030f14f7f79aa1b8d54 References: <20230919135536.2165715-1-da.gomez@samsung.com> <20231028211518.3424020-1-da.gomez@samsung.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 28 Oct 2023 14:16:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781035483253149287 X-GMAIL-MSGID: 1781035483253149287 XArray multi-index entries do not keep track of the order stored once the entry is being marked as used (replaced with NULL). Add a test to check the order is actually lost. Signed-off-by: Daniel Gomez Reviewed-by: Luis Chamberlain --- lib/test_xarray.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/test_xarray.c b/lib/test_xarray.c index e77d4856442c..6c22588963bc 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c @@ -423,6 +423,26 @@ static noinline void check_cmpxchg(struct xarray *xa) XA_BUG_ON(xa, !xa_empty(xa)); } +static noinline void check_cmpxchg_order(struct xarray *xa) +{ + void *FIVE = xa_mk_value(5); + unsigned int order = IS_ENABLED(CONFIG_XARRAY_MULTI) ? 15 : 1; + void *old; + + XA_BUG_ON(xa, !xa_empty(xa)); + XA_BUG_ON(xa, xa_store_index(xa, 5, GFP_KERNEL) != NULL); + XA_BUG_ON(xa, xa_insert(xa, 5, FIVE, GFP_KERNEL) != -EBUSY); + XA_BUG_ON(xa, xa_store_order(xa, 5, order, FIVE, GFP_KERNEL)); + XA_BUG_ON(xa, xa_get_order(xa, 5) != order); + XA_BUG_ON(xa, xa_get_order(xa, xa_to_value(FIVE)) != order); + old = xa_cmpxchg(xa, 5, FIVE, NULL, GFP_KERNEL); + XA_BUG_ON(xa, old != FIVE); + XA_BUG_ON(xa, xa_get_order(xa, 5) != 0); + XA_BUG_ON(xa, xa_get_order(xa, xa_to_value(FIVE)) != 0); + XA_BUG_ON(xa, xa_get_order(xa, xa_to_value(old)) != 0); + XA_BUG_ON(xa, !xa_empty(xa)); +} + static noinline void check_reserve(struct xarray *xa) { void *entry; @@ -1801,6 +1821,7 @@ static int xarray_checks(void) check_xas_erase(&array); check_insert(&array); check_cmpxchg(&array); + check_cmpxchg_order(&array); check_reserve(&array); check_reserve(&xa0); check_multi_store(&array);