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: 13439584 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B443C4167B for ; Sat, 28 Oct 2023 21:15:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjJ1VPp (ORCPT ); Sat, 28 Oct 2023 17:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjJ1VPo (ORCPT ); Sat, 28 Oct 2023 17:15:44 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16A3AE1 for ; Sat, 28 Oct 2023 14:15:41 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231028211539euoutp028ebaf1ab72968557b223d727f9a207bb~SYfrudE6K0879208792euoutp02E for ; Sat, 28 Oct 2023 21:15:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231028211539euoutp028ebaf1ab72968557b223d727f9a207bb~SYfrudE6K0879208792euoutp02E 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+AbVsZxR4unkncwQDlDRlx3P2SGcM4wSR57tYoFw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fnFJbZK0YYWRnqGlhZ6RiaWeobG5rFWRqZK+nY2Kak5mWWpRfp2CXoZr56tYyto5KuYsnQX UwPje+4uRk4OCQETiTMd35i6GLk4hASWMkqcO7WZDSIhI7Hxy1VWCFtY4s+1LjaIoo+MEl0d q6CcM4wSrxb9h3JWMkrMuvqRHaSFTUBTYt/JTewgCRGB2awShxd3MIIkmAXqJNY8m8UCYgsL WErcWHUJbIeIgJ3Ew1sv2SFsPYlz11+B3cEioCrxZPsGsBpeAWuJlaf2MHcxcgBty5Xob8sE 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> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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);