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 9536BC27C55 for ; Tue, 11 Jun 2024 03:02:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C68776B00A9; Mon, 10 Jun 2024 23:02:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BAB996B00AC; Mon, 10 Jun 2024 23:02:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B19F6B00AA; Mon, 10 Jun 2024 23:02:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 61FA16B00AB for ; Mon, 10 Jun 2024 23:02:11 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 11FD21C1E54 for ; Tue, 11 Jun 2024 03:02:11 +0000 (UTC) X-FDA: 82217108862.12.31458E8 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf22.hostedemail.com (Postfix) with ESMTP id 6A706C0009 for ; Tue, 11 Jun 2024 03:02:09 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="tUD/4hEu"; spf=none (imf22.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718074929; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Hv/cXQiOxKNgXmCwyVTUDGGov4wBn8i/fmF48xSrHJk=; b=1d6GWcG9mH5rPomwdxExGixyQCbt5AJZpb7I/Inn2Xa20N83jej2KG4ge4C6/PYx+xtLa1 b/UE58t7K93gTYCD1yQ1KVNrnjjJ7EF9kxo+hs40EIZoTYBc+vWn8rvID46zQvPv7+9gx3 aRs7njMl/xtEkrEcXa3Jo3vbrnt+uQQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718074929; a=rsa-sha256; cv=none; b=HUoDeZZNR1vDn/gCDu1dQH/BDkFfaGrlQ6izmFYo40FBft8GiMAXOR2HNdByYiZSDf0vBf Vumaudwahys/pDyOqQ37BzSI7KWHw9khv+9756mB8B1bcmGgqNen1crOD+g7oZWBj8xcOo X9u9grDOxQ2uqKFa024VGqIRs8nX6dc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="tUD/4hEu"; spf=none (imf22.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=Hv/cXQiOxKNgXmCwyVTUDGGov4wBn8i/fmF48xSrHJk=; b=tUD/4hEuSCcxRCkWHCYdICg4V1 aQVNu8MES9D2iMfkf0d6CXzkD+DIkcvF8xvtjLGMOZtsBapUP1fOpVyDi55ef/m6fYV9kO3JIGPdO 9Ob4C5GzLJfP0PbEi1m+Gu/HRRRL4+gP3QUFPEw495CaEPQFPLcrZUBdQ5lb76JIJpS5UKI0onozu 5d8/Vzt0VycLoHwFyKUXdqkiPUHM3htT+hGKeaTqq7eo60KpsXwEgCuz1cQPvJJpUYGgPdWPCvmSx wH1HMpvahXkxWBV0csveIVGfqMQ0V27EOOhyLTB8MFKaTBd9P7N18XQ2befZxRfYy8q1PuEBc+Z3z /nVhMneQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGrls-00000007DDK-294X; Tue, 11 Jun 2024 03:02:04 +0000 From: Luis Chamberlain To: patches@lists.linux.dev, fstests@vger.kernel.org Cc: 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, mcgrof@kernel.org Subject: [PATCH 3/5] fstests: add fsstress + compaction test Date: Mon, 10 Jun 2024 20:02:00 -0700 Message-ID: <20240611030203.1719072-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240611030203.1719072-1-mcgrof@kernel.org> References: <20240611030203.1719072-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: ojb5hc8hhr63zn3kixzysid5yrzgj3m5 X-Rspamd-Queue-Id: 6A706C0009 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1718074929-614954 X-HE-Meta: U2FsdGVkX19ocfTfS5vGa4TFEGl/gCkoI94nd9jIzjLDi50ughIpUzHeGJ8pYGMaJ6UuJmwHVbdtZehaJk5GH6WcxZjOZ43H7EySMJ6ZJlY5O/P/4JLt12Ql8MMlJQMQ8mYylfhwnUI/bNSud+IYrNPUpM75Dqjx1rSGNSr4R6CLb3sno6+BJ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irsZTTPXZrojB4NVr+HLI9a6CYNQSVzNItjr2wiojkKL436O2RMdxpCD7vIaB+mgc7MdKLZBEVkdtnNs5j1U0OcHq/Xlp1WivivA3OZ4cXaWhv5bLeY6da5Xr2c9pr0f5fWzUr05V7JnZDo8qi5Av6ERw2wQUfFjmTbKiyhG2OEOeF/v 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: 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") + +$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