From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B2F9C48BC3 for ; Tue, 20 Feb 2024 02:28:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 184EA6B0087; Mon, 19 Feb 2024 21:28:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 135406B008A; Mon, 19 Feb 2024 21:28:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3E3A6B008C; Mon, 19 Feb 2024 21:28:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E53576B0087 for ; Mon, 19 Feb 2024 21:28:16 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B11B21604C0 for ; Tue, 20 Feb 2024 02:28:16 +0000 (UTC) X-FDA: 81810597792.20.EF784D2 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf21.hostedemail.com (Postfix) with ESMTP id 633841C0002 for ; Tue, 20 Feb 2024 02:28:14 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="ltWv/YZq"; spf=pass (imf21.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708396095; a=rsa-sha256; cv=none; b=ezU19fwVZOwnHJCUekr9Rpuakt2SHXtuaXJXRODwErfFEQv/+5tcCUnWDbWxN8Mu/QREzV Jr9wj7pEfwkAAo8b/od8uqreH+t+/I3aMwNx/yIrRl4UgK4rvUHxKf3CgPfsoaevemP59h WLrLcpMvA7tol+611B45BfayIdfVANM= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="ltWv/YZq"; spf=pass (imf21.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708396095; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ndhIQTbpvgCOJH+JSwApusG48hxze6GXsVsyY1smj50=; b=NIKwJlW37yoKzXz8qvfpVBc+XbaANmdN0mb8qFITMD4QSLkh/zYZNM8W0TviBJC3anF8ud 0/yJAL/txGylCkLXalyoFhvOONQ6FMJP4BUxGXzZmYeOV+jH9PFLZS+J1T9AQEoguHlX7E +CTrn019I2bSu8OxhbIYsrWz+yWZrB8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id ACCEDCE1400; Tue, 20 Feb 2024 02:28:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB511C433F1; Tue, 20 Feb 2024 02:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708396090; bh=g19aHEmjFQ5tSUUNdPZtI2asKF0wN+dEKgAolGDccIo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ltWv/YZqIm7Ia0akbwKFqWLV83KaIHAYNaIacwP1NBARaD8lrJCVtwtg0c68+w24W jOKItH+DtztnP7owYaHqcDtXAK17W5jcR83LJ7h6pTn7cDNLqu4ofWGkLZ8zvlo8oS 5j4V0FS5Q/0Ui5x/QbbdkrdBv6g9SHDMbxV1l7FQ= Date: Mon, 19 Feb 2024 18:28:08 -0800 From: Andrew Morton To: Luis Chamberlain Cc: willy@infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, gost.dev@samsung.com, p.raghav@samsung.com, da.gomez@samsung.com, kernel test robot Subject: Re: [PATCH] test_xarray: fix soft lockup for advanced-api tests Message-Id: <20240219182808.726500bf3546b49ac05d98d4@linux-foundation.org> In-Reply-To: <20240216194329.840555-1-mcgrof@kernel.org> References: <20240216194329.840555-1-mcgrof@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 633841C0002 X-Stat-Signature: 9c63o7qzf4c77ik95ps1sd5fnfq36bdr X-Rspam-User: X-HE-Tag: 1708396094-647787 X-HE-Meta: U2FsdGVkX19MOOL7a/VnJa5CiyfCJ+1bI5llXiGSEncjp/mpvWzOlrxE8cjhrt3qlAxLcgWoJETfMXWGSUMwN2x32Lhqu3oD0l6YO722jTS1xZJvYDDPZuLip6uZOmp2nwbBIQ3QTWERC9jWOnrepGOom1ywAdG6S/zzGpFaIUDvKNJfx5H3ihwK0DfldISPbrCNMHh81PtQ3gFU7nHWbWxaY6vQuJzMykW20BwZWBV1MJhRxoCZWZSFTsUp4oHMBUIAtFvSFy+M7088d1asbTQMnrNCvAtvTXraYxZIoNMlXhlxHTyOUagthhfQtLVueUssWjOQ+ZRl1s5eZ75Ny0KJFuEHHmYHZtLu4yXbBQAKwpAvEBueT+L25ZrQfftM4QjqTOJsulhF1qNaIqM6GfdIvscytOG5KgO8YsDpQq/VyH8hdwGU4yMn1iTPtay/e1jDT9Afli4wzXiYw2tzo1hi6RtvVRGwDV8NFYfJGO4urYJ+Zrz8GKobqgU3fL5SV252x1675Q6GKU9UUuJCBRoVZ4J5Dxw8IzUhFvwmF78gVURh64qcT6m9btl6cJMviJLlxeDFGvDVf5pOqn5M7XJQTZrs/1vbi0lGFEWNe5YmtH9yY1/0ZGsr/Hsjn0nMRHNRX1YxzPxkgwiQ5/dIRJZMzK9tq/SLpGmH0bev+bR3jEYBaNjdaNQqNdcmZv+yJJIEfr6BqW5N4lum0B5edoxYjK4q/XCgfhJ8wYb2vAKJuEs21ru3iEMz8e7yt6cUrbCKKP7KV58eI5sISa8QmR+DsBrsdo2sydXLKwlhSE66LJix73DCyHHDR0v8K03R4KNcjkNUwRcpTo4Mb5TZfv5yXVPtdDCQyOr0u/8YqVcUQ5RMMWhheN9wiseuhmW3+UFQF5kdKTi99Q1CXXmly+eHZXDaJ9fuDMU1yKXJRhXvhkl9hyhE5BgJdH3DmZoV7p1TvbSGpwpByQZ8Q5X ueYIDQi+ URXXUU1deF1fjJ/s8X5N6zDYbYrYJEP1C/zDK9df3XJKFu7G3ytaqP6EkqPKlAXqGx3imCUPL0u1yvRSjRt9Wo/HxoG1vQTCwHBuLvrxZddIbcYxnMPRTLb4qtIpmiH06DIFxqwcaDFSsLkauKhBoqi4qriNuVCLbsR5PFO5orK0h3xqjBmnh2ZzzSVjptj5i/bZ3q/vJWQrBU5/G5Mgw4/y9/GSv/jfyxy4o38oo10GqjAQJRNiBJQwuODxByBSKI3Blkx40HsXjaCQHmOLZmoGcWD/3E4CYF0Z6XJPI85A8mmugEjUT5vj39iEm/3VxUB2Lqzgf5Gkksb7CbUaRQyRfYxuRmztvDNpj X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, 16 Feb 2024 11:43:29 -0800 Luis Chamberlain wrote: > The new adanced API tests So this is a fix against the mm-unstable series "test_xarray: advanced API multi-index tests", v2. > want to vet the xarray API is doing what it > promises by manually iterating over a set of possible indexes on its > own, and using a query operation which holds the RCU lock and then > releases it. So it is not using the helper loop options which xarray > provides on purpose. Any loop which iterates over 1 million entries > (which is possible with order 20, so emulating say a 4 GiB block size) > to just to rcu lock and unlock will eventually end up triggering a soft > lockup on systems which don't preempt, and have lock provin and RCU > prooving enabled. > > xarray users already use XA_CHECK_SCHED for loops which may take a long > time, in our case we don't want to RCU unlock and lock as the caller > does that already, but rather just force a schedule every XA_CHECK_SCHED > iterations since the test is trying to not trust and rather test that > xarray is doing the right thing. > > [0] https://lkml.kernel.org/r/202402071613.70f28243-lkp@intel.com > > Reported-by: kernel test robot As the above links shows, this should be Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202402071613.70f28243-lkp@intel.com > --- a/lib/test_xarray.c > +++ b/lib/test_xarray.c > @@ -781,6 +781,7 @@ static noinline void *test_get_entry(struct xarray *xa, unsigned long index) > { > XA_STATE(xas, xa, index); > void *p; > + static unsigned int i = 0; I don't think this needs static storage. PetPeeve: it is unexpected that `i' has unsigned type. Can a more communicative identifier be used? I shall queue your patch as a fixup patch against test_xarray-add-tests-for-advanced-multi-index-use and shall add the below on top. Pleae check. --- a/lib/test_xarray.c~test_xarray-fix-soft-lockup-for-advanced-api-tests-fix +++ a/lib/test_xarray.c @@ -728,7 +728,7 @@ static noinline void *test_get_entry(str { XA_STATE(xas, xa, index); void *p; - static unsigned int i = 0; + unsigned int loops = 0; rcu_read_lock(); repeat: @@ -746,7 +746,7 @@ repeat: * APIs won't be stupid, proper page cache APIs loop over the proper * order so when using a larger order we skip shared entries. */ - if (++i % XA_CHECK_SCHED == 0) + if (++loops % XA_CHECK_SCHED == 0) schedule(); return p; _