From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796141919; b=Ekc+XPkdQLZOiXtdJ/Q6e4dH+VxNg370Bsdw/WVBPL3NQ43FkoRTwsuIVzLCmSE5wP9Q 8xK1Y8E8RcehALH/VjVmTGrVorLUQ/A/10P3oH+S92TF9IuG5AYaj3z+2x4PvyNsqBOre qLwtWn5L8GNNrGWjzfIf2q6kzzi3IgroKQQ784WTg/5nQPOd4Sg59NXtia3ZAInZdP6Je 61nsHdXjXgU7Av4nnvM9JX/ZDJwkv6VkQaI5UrxEa4Jc1LeSDC9HCQiyFYdMd8BYavXmi aQGbowkyAA8nQCdaFGKRRQpYbWsnR+U2mcQxW+MYkKcRA3vWZlrSOjAmXT2Ml1CxLbQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796141919; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=aMxWHk7BlKXNbHTVHuRYuVZIQqAGHW04vcGRMPPWYG4=; b=s3qFk505T3sU9AlWHdaiS23EUdF2zGiFNlk6+iliMRfGwVa3qL5tqEhkS4RQhYOyMAuh gQDxRx1Gw+45UCpXUw6yKnRtAzeJoA8eOlEcf+omGS1LvL2hl3Y9+C670h8hCRJeA65SU od3NF14ZcBa8BkeY7lz420xs+QedIhYQhZYM1Z2exmypqo+TUxcXEUacpEg/ZQl3FCgde BODetiiEbzdsaM4+NQCxsSPEUOB4jYSX2PK4tolPvXwp2KgyEEL25HU9KzN6NnG8a1v0o RjgThypWgzjUWZZ9aJ6EtlkDy850s0tEFUPNNkyBig3VmzliJiCkTNbuXzzqK406B9g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=RRfQSW6b; arc=none smtp.remote-ip=74.125.82.178 Received: from mail-dy1-f178.google.com (mail-dy1-f178.google.com [74.125.82.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 099DA606A325 for ; Tue, 1 Dec 2026 16:18:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 099DA606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=RRfQSW6b Received: by mail-dy1-f178.google.com with SMTP id 5a478bee46e88-38644aedba1so20181906eec.0 for ; Tue, 01 Dec 2026 08:18:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796141918; x=1796746718; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=aMxWHk7BlKXNbHTVHuRYuVZIQqAGHW04vcGRMPPWYG4=; b=RRfQSW6bUgdbbXBJ/8rCEIJW2lpaz5BvFEFnRR/natog4g1Xo2jDezieLueSq2P37d RMFguQYxvi80U5cO4FZ52wM6QD188px/kdmv+Hyq1mRIZ+YdG8KIG1eMwrZr1G5b4HxZ EPzEun8GQVjI+cuHa+3q58odmK99+X9kqlvtajDatfKzKoOjnoBfcF7rgCnBB8d9YIx5 KsCr7h78jfLsOro+YjQv+j4sm8ti/odSdn/pf8lP7CowCyoyrk3iOeNl7ilJBEpDTTSg mNRuv/ZSasqKdtuwpduEchU+33jXoKXDPpgjK4N518VYFp42BD/ByGMl44AuynIrdyQY 6q2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796141918; x=1796746718; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aMxWHk7BlKXNbHTVHuRYuVZIQqAGHW04vcGRMPPWYG4=; b=k3vUB8GsgH0smgK+wn4RHf+bAvg7nTdfxPEERwdP0m7f8/IcVlSYuKuUcn6Iipm4wo YLaNLD/FJX+ijespxMEKzqGzD0hC9hxOalerpVGR3SaIgBoLqWLSIf6vqRaKpfBIzYx/ RLC9W30Ay2d3pwcnPYIBq8Qj87b/v1NO1/X9h7DL9WuIQV0UAFo/92efmYFDA2lCEDKV nol1hODSmul3fCEG/qcTizhveSmO4nuLYTRqW18kSxSvoPmioKJaQBK+vI0+gMdWGaX0 aWZ7rIldjx2AB5tvX/CPL397Eo0WIoS/cOa/NSH0GJpxlkHwtPYFjB5qm7q71Amd1d+l Phdg== X-Forwarded-Encrypted: i=1; AL+hErH5goL6d0bsKSO/vTWCKrtraI2W0j/NyXsO0pQcuuBnzoTMK5oz5dyJaBEnSiT8tR1aYOO3WDuuFLCfZiE=@vger.kernel.org X-Gm-Message-State: APuU4Z+IN4zDVExaGiEMcyjlYJfrnioO46SpWFKeQz8bBqyj5P1kdAjl tRsYgsbFO9g/PpHQW16D0JLWBxopb285xr2DGWc/+XQ41TUI4MoJ/F/e X-Gm-Gg: AZFdTZfOjZtbUmWteOOg2LXY847StEMtSfyLgQRzdewlJFqZpSPDq+Ts+voL6/HyBz8 8T0zUoZ2KYiQrEbM2UXMsMJtr0Tsmv3MMAXw/sav9MqoOP3TyL0e8CH4ZgqusvuW5PPwukHdkba O+Yfpcd11KrBywrLSErI0oqAqYTmfRxm9bsw8ZCV9lQm8sx5zFa6xk+thDKj4gbmR+BbQYgy6yQ m6GjQ2bX4DlKK5wC7ZPZUORgEej4hsJkc9sa5SSU/YZr622J5UCIFJXOVU12EKqQ+bHLXtO4Dg5 b9vXEAyzxXsQF1swUmRyvXAdz62CLL6nsJwUnN/CZbW8BBUkLeeFnLOF96c1o827PkLw2RMSBSy UGnq6AwVY9cgmJTGQA/Le+3XNjoXT+bKbKJtC9N+aj350GRbIUZt6LTKbZvSd1pf3Pp4GIhi6gF 07mcpXtqLdwmphGTK2LtY7tMHjdwlW55T8aszUVIcMBi7jNSYvJNMqs7GBibjDF1HJRGqsDBqZh XtpRKSUIYEVbYRjchtZytwM7ybiZjAwi2JxA9tfwwIlfKIvKLFgtKv3eiJ06OLbXq+avrz94SQA 93LX5IWyxmx/yAblASC42ElmrVI+T1Xk0ay0/f/lQUDYfswx3wCqjHZ5ZNN9ZAo6k0Sn7lKEXZA sjh8GB+4= X-Received: by 2002:a05:7301:42a:b0:387:1643:3897 with SMTP id 5a478bee46e88-3871643391dmr5076066eec.21.1796141917520; Tue, 01 Dec 2026 08:18:37 -0800 (PST) Received: from kernel.. ([212.87.193.62]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386c7c62a91sm71632752eec.17.2026.12.01.08.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 08:18:36 -0800 (PST) From: Kunwu Chan To: paulmck@kernel.org, rcu@vger.kernel.org Cc: dwmw2@infradead.org, jiangshanlai@gmail.com, josh@joshtriplett.org, work@onurozkan.dev, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, dave@stgolabs.net, jfern@kernel.org, frederic@kernel.org, neeraj.upadhyay@kernel.org, boqun@kernel.org, urezki@gmail.com, qiang.zhang@linux.dev, puranjay@kernel.org, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Kunwu Chan Subject: [PATCH 00/17] srcu: Try idle expedited GPs in the caller Date: Wed, 2 Dec 2026 00:17:58 +0800 Message-ID: <20261201161815.1637481-1-kunwu.chan@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit David Woodhouse asked for the reader-free fastpath to also be used from synchronize_srcu_expedited(). On eligible idle Tree SRCU domains with full-barrier readers, this series tries to finish an expedited grace period in the caller: when both ordered reader scans pass, the caller avoids queueing its completion callback, sleeping and being woken by the worker. The attempt uses the normal grace-period completion path and preserves the guarantee that a cookie obtained before synchronize_srcu_expedited() polls complete after it returns. Preemption is disabled before either mutex is taken and held across both. If either scan misses after the grace period starts, irq_work is queued before the mutexes are released so the worker can continue that grace period while the caller falls back to the normal synchronous wait. In nested x86 KVM tests with the vCPU stopped and no bus registration, memslot move p50 fell from 8.95 to 5.15 and from 12.58 to 4.77 us in two paired groups. Immediately after MMIO eventfd registration, the first wait always entered with a grace period already in flight and used the worker, so p50 stayed near 19.6 ms; the second wait completed in the caller in under a microsecond. With one sleep between calls, single-writer expedited API p50 fell from 17.2 to 3.0 us on four-vCPU x86 RT BIG and from 24.1 to 5.8 us on 32-vCPU arm64 RT BIG. With two arm64 writers, p50 stayed near 39 us, and the x86 RT SMALL two-writer p99 rose in two of three pairs and fell in the third. In an unbroken FIFO loop, the first sequence-maintenance fallback keeps later calls on the worker: the fallback callback wakes the writer before the worker drops the callback count, so the callback queue never looks empty. A sleep between calls drains the count and restores caller completion. Patches 1-4 prepare, implement and tune the caller path. Patches 5-11 add parser selftests, report completed writer waits and add optional expedited wait bursts. Patches 12-17 print one final NMI coverage record after the producers stop and callbacks drain, check it and document the workload. A successful run without the requested NMI activity reports SKIP, and a missing or invalid final record reports FAIL. Tested on x86-64 and arm64 KVM. The base and every patch built with W=1 in ordinary and PREEMPT_RT configurations (36 x86 builds, plus the arm64 base and tip). All 43 x86 KVM runs met their expected results: SMALL and BIG exercised NMI readers and callbacks, both PMU-off runs reported SKIP, and 60-second hotplug runs matched NMI callback counts. Directed trace runs covered caller completion and both forced scan misses, with the worker finishing the original grace period before the caller queued its fallback in both cases. Two arm64 RT runs converted SMALL to BIG at runtime. Eight LKMM litmus cases gave the expected results, and the writer-progress and NMI shell suites passed 33 and 31 cases under mawk, gawk and BusyBox awk. The documented x86 kvm.sh recipe needs the separate QEMU CPU-selection fix; the guest tests set the CPU option directly. Kunwu Chan (17): srcu: Move callback mutex acquisition to the GP end wrapper srcu: Let GP completion take a size-state snapshot srcu: Try idle expedited GPs in the caller srcu: Check only the boot CPU callback queue in SMALL domains rcutorture: Add selftests for console writer progress rcutorture: Compare console version counters exactly rcutorture: Recognize completed writer waits in console logs rcutorture: Emit the version with the statistics prefix rcutorture: Report completed synchronous writer waits rcutorture: Use writer wait counts in kernel stall diagnostics rcutorture: Add consecutive expedited waits per writer iteration rcutorture: Check NMI coverage rcutorture: Test NMI coverage result classification rcutorture: Test NMI summary field validation rcutorture: Test NMI console-log boundaries rcutorture: Document how to check SRCU NMI coverage rcutorture: Document directed SRCU NMI tests Documentation/RCU/torture.rst | 101 ++++++++++ .../admin-guide/kernel-parameters.txt | 5 + kernel/rcu/rcutorture.c | 67 +++++-- kernel/rcu/srcutree.c | 150 ++++++++++++++- .../rcutorture/bin/kvm-recheck-nmi-test.sh | 172 ++++++++++++++++++ .../rcutorture/bin/kvm-recheck-nmi.sh | 72 ++++++++ .../bin/parse-console-progress-test.sh | 123 +++++++++++++ .../selftests/rcutorture/bin/parse-console.sh | 46 ++++- 8 files changed, 710 insertions(+), 26 deletions(-) create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck-nmi-test.sh create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-recheck-nmi.sh create mode 100755 tools/testing/selftests/rcutorture/bin/parse-console-progress-test.sh base-commit: 68dcfb0e34ee3a9628f6b5ce7e06931b5248bb9e -- 2.43.0