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 B443AC27C75 for ; Tue, 11 Jun 2024 14:48:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 428AA6B0095; Tue, 11 Jun 2024 10:48:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D77A6B0096; Tue, 11 Jun 2024 10:48:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 277916B0098; Tue, 11 Jun 2024 10:48:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0A5966B0095 for ; Tue, 11 Jun 2024 10:48:23 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9F18A121334 for ; Tue, 11 Jun 2024 14:48:22 +0000 (UTC) X-FDA: 82218888444.06.3E25CCB Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf20.hostedemail.com (Postfix) with ESMTP id 522591C000E for ; Tue, 11 Jun 2024 14:48:19 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YbegQu1I; spf=pass (imf20.hostedemail.com: domain of djwong@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718117301; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1HK/6p5NGEgX/O1J+T8oezo/vaeEoKynRzSTzBhjnFs=; b=Ik8AC5MOxnSmVHTDUxxlhNzKe9jNvuT86uqKstwFeT6d9473HJPsuiREsYhlWpnNQXADyA 6WR8RBbmqjAWHGZvPsF8NJ7k1+NQuV490vt1259/Ra9genxfIFRX3hO0Xs2MoztP20OWC6 U3akzThb9jbjjf1eDEjjgc+Jwe896ak= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YbegQu1I; spf=pass (imf20.hostedemail.com: domain of djwong@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718117301; a=rsa-sha256; cv=none; b=dT5wmi22J3IuxQBKaggopr8tZ6rLbXnrhUOZjHwKMCAGmyBELP8tLFWvUXG3CnzeUDzRtg EmsYerlknRobrWLEEe/JmMUdC77z8ZDfNLNvnuAkZCJ29MjncGunppZBKXkL/u5ZMTkEVR Y/MsQ04xv4GKyjlZKIfTgZhLRpIvcp0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 0A6FCCE1BAE; Tue, 11 Jun 2024 14:48:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3840CC2BD10; Tue, 11 Jun 2024 14:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718117296; bh=tSXLhE5A82AHcFb1qYX6yXouGrFwwmpKyD2aNdbGHFs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YbegQu1IyCSdxxTgJxE8Tvgx00EkdJzoV2KkT7n7a+ibty13ulDI+4grnMt5b5Nyh ujcQL3T9REjvw4gMDqSRSfl1DkDw2ZyVTglUrJPQTnEhpCufdgggwbdUe+h4K447L9 z9kCAJT9/ogX4VwumaT2wdYNrWjkpzLlFF81AWdDuM6JyeHF42S9BBh6b1UgQY487V ykT+q4mGatOfl3FmUCY2nlPHxKqOQFe+o26/E1JnT7x0yHPDM67v0SlPfEwWrwFKIF YgBVVsPOUWRCrvYrL7ZThJjmpb9p7vTjUQ2bIglNhPysjc5ooOWPHj/2ZtC6rpCRxd v9ZC4t0Qf6FpA== Date: Tue, 11 Jun 2024 07:48:15 -0700 From: "Darrick J. Wong" To: Luis Chamberlain Cc: patches@lists.linux.dev, fstests@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, ziy@nvidia.com, vbabka@suse.cz, seanjc@google.com, willy@infradead.org, david@redhat.com, hughd@google.com, linmiaohe@huawei.com, muchun.song@linux.dev, osalvador@suse.de, p.raghav@samsung.com, da.gomez@samsung.com, hare@suse.de, john.g.garry@oracle.com Subject: Re: [PATCH 3/5] fstests: add fsstress + compaction test Message-ID: <20240611144815.GJ52977@frogsfrogsfrogs> References: <20240611030203.1719072-1-mcgrof@kernel.org> <20240611030203.1719072-4-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240611030203.1719072-4-mcgrof@kernel.org> X-Rspam-User: X-Rspamd-Queue-Id: 522591C000E X-Rspamd-Server: rspam01 X-Stat-Signature: nfgnqzwaeapa7xpk5fqf7wkhypjm4ynh X-HE-Tag: 1718117299-893488 X-HE-Meta: U2FsdGVkX18aQH3qyDKUrf7/N5YyEMhr/UJszoagg1A3/BM6VpBLLD716hmttOTTtZfeQHZTAIlskghrCswBexbDGzZmObrZO2XHxCPl3aPdekvRcKjDafQHDoEnS9axndClrO3chlFYLZuF219wfZRuC6bMt8JpINWYkkrlUS/LFlLIDCWZ+WUuYGFScl/DtYcbG7An3jHthEs7A/JaQjR39/X+LC7ZW3hEzrNkw7ziVifuEzvpc1NXa0jmJrmLHUmCe+SUf1GroOOFOto5TheEd2SHH8tVQpTKilS8nHoFXBGnvfMGtbfphfR8X0+NAAPMbrN6cKz9scG5/3z3+kTrSmRrvS+APq7dXO1IpufC4i+F/ZMSd37HdySGVdt4AGcfXZGHt6XvHy9o8Wv/xyuTvWCklNCSN1kdJC2m3BCtbsvpzo05hadrEhssy2b+RR9eLnRUPwV1NjDxIeUMrG372HyS2b+6BrDKvxw2IH5wxlSN5yLkaRMeZV28MBthoZyrQAtxuZG9ihdkIXg06Lssq3dUA565bGAJPm2RdimNd/UYXUFAshD+WffPX4yRKpDiLDoRjq6v5pcCfUq946sn2kAa7zFyMZTkWBBQIVlWMZCehUjz7RiMp+fD9wdfZxDBd94eME8oDXkJ0hqnwtmOALtSVEubAvXVJZNe0jcFZcAi61bYTq+mDreYwq+FwEP0VQPaYjDwhTjpU6+oErht0LooZhCJ2gmn5gRiAkXJJIN7BN5AMBR0jlhYMZVN3c/TrSy0RwQITPEPf1vuWT8pvGsjoSjY+XgR8k5R4idqGi0h50SYzFekZJu3iMMd03vSoMLEG5erjlbz9oMlanIYZ0J0+t7TliW6taOM/vRtAxOk+qsAIA7X4BRMcHT7SUO93y5dlkXMzochqZqUihg8szeJd2a5lyGTYnIJZMeffRIKmJgvLynD71syUXPepyKCwSN06teIsntefJ6 DHEioq4b bBTRTCEmZeFkS5/TOXbwByB2wkWY6RPx1jkZI04+QmFvNfHChS8F1mFbspucygAs3V0LZsqG9mKBYvHHHkvogDmuAbkBtkT4p+X6fFjNPO8neWD+fy3ZxcJDTpd/dKo7MjnmjssYTsXm5qDX+XOXo9Tx26yeZ8/5oW4XMUxdU4LnYFeSpgpI5B3lew+/Fbeh97pJGorrURO43baI1BQQ0XERkkohsd+Uo1uoL32oqxgHWbt1rPXCDcHH/YhUfctSOgwy4J6tYLeITzpQKi9QYBEHVde2Hk8fYCnOLhnDdVUyMnWw= 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 Mon, Jun 10, 2024 at 08:02:00PM -0700, Luis Chamberlain wrote: > Running compaction while we run fsstress can crash older kernels as per > korg#218227 [0], the fix for that [0] has been posted [1] that patch > was merged on v6.9-rc6 fixed by commit d99e3140a4d3 ("mm: turn > folio_test_hugetlb into a PageType"). However even on v6.10-rc2 where > this kernel commit is already merged we can still deadlock when running > fsstress and at the same time triggering compaction, this is a new > issue being reported now this through patch, but this patch also > serves as a reproducer with a high confidence. It always deadlocks. > If you enable CONFIG_PROVE_LOCKING with the defaults you will end up > with a complaint about increasing MAX_LOCKDEP_CHAIN_HLOCKS [1], if > you adjust that you then end up with a few soft lockup complaints and > some possible deadlock candidates to evaluate [2]. > > Provide a simple reproducer and pave the way so we keep on testing this. > > Without lockdep enabled we silently deadlock on the first run of the > test without the fix applied. With lockdep enabled you get a splat about > the possible deadlock on the first run of the test. > > [0] https://bugzilla.kernel.org/show_bug.cgi?id=218227 > [1] https://gist.github.com/mcgrof/824913b645892214effeb1631df75072 > [2] https://gist.github.com/mcgrof/926e183d21c5c4c55d74ec90197bd77a > > Signed-off-by: Luis Chamberlain > --- > common/rc | 7 +++++ > tests/generic/750 | 62 +++++++++++++++++++++++++++++++++++++++++++ > tests/generic/750.out | 2 ++ > 3 files changed, 71 insertions(+) > create mode 100755 tests/generic/750 > create mode 100644 tests/generic/750.out > > diff --git a/common/rc b/common/rc > index e812a2f7cc67..18ad25662d5c 100644 > --- a/common/rc > +++ b/common/rc > @@ -151,6 +151,13 @@ _require_hugepages() > _notrun "Kernel does not report huge page size" > } > > +# Requires CONFIG_COMPACTION > +_require_vm_compaction() > +{ > + if [ ! -f /proc/sys/vm/compact_memory ]; then > + _notrun "Need compaction enabled CONFIG_COMPACTION=y" > + fi > +} > # Get hugepagesize in bytes > _get_hugepagesize() > { > diff --git a/tests/generic/750 b/tests/generic/750 > new file mode 100755 > index 000000000000..334ab011dfa0 > --- /dev/null > +++ b/tests/generic/750 > @@ -0,0 +1,62 @@ > +#! /bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (c) 2024 Luis Chamberlain. All Rights Reserved. > +# > +# FS QA Test 750 > +# > +# fsstress + memory compaction test > +# > +. ./common/preamble > +_begin_fstest auto rw long_rw stress soak smoketest > + > +_cleanup() > +{ > + cd / > + rm -f $runfile > + rm -f $tmp.* > + kill -9 $trigger_compaction_pid > /dev/null 2>&1 > + $KILLALL_PROG -9 fsstress > /dev/null 2>&1 > + > + wait > /dev/null 2>&1 > +} > + > +# Import common functions. > + > +# real QA test starts here > + > +_supported_fs generic > + > +_require_scratch > +_require_vm_compaction > +_require_command "$KILLALL_PROG" "killall" > + > +# We still deadlock with this test on v6.10-rc2, we need more work. > +# but the below makes things better. > +_fixed_by_git_commit kernel d99e3140a4d3 \ > + "mm: turn folio_test_hugetlb into a PageType" > + > +echo "Silence is golden" > + > +_scratch_mkfs > $seqres.full 2>&1 > +_scratch_mount >> $seqres.full 2>&1 > + > +nr_cpus=$((LOAD_FACTOR * 4)) > +nr_ops=$((25000 * nr_cpus * TIME_FACTOR)) > +fsstress_args=(-w -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus) > + > +# start a background trigger for memory compaction > +runfile="$tmp.compaction" > +touch $runfile > +while [ -e $runfile ]; do > + echo 1 > /proc/sys/vm/compact_memory > + sleep 5 > +done & > +trigger_compaction_pid=$! > + > +test -n "$SOAK_DURATION" && fsstress_args+=(--duration="$SOAK_DURATION") Maybe put this with the other fsstress_args definition above, but otherwise this looks reasonable. Reviewed-by: Darrick J. Wong --D > + > +$FSSTRESS_PROG $FSSTRESS_AVOID "${fsstress_args[@]}" >> $seqres.full > +wait > /dev/null 2>&1 > + > +status=0 > +exit > diff --git a/tests/generic/750.out b/tests/generic/750.out > new file mode 100644 > index 000000000000..bd79507b632e > --- /dev/null > +++ b/tests/generic/750.out > @@ -0,0 +1,2 @@ > +QA output created by 750 > +Silence is golden > -- > 2.43.0 > >