From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796142031; b=tlIgQU2LgXxehgaTUlqWhS3wqNyJvHaXBzrIuq4ZcG8wrwsisQuJW/CxDiJcnYyf2P4B FA3dEG9ucT07KuklkDDlqHTji8V2QLemCn4c2MhBsXT5l/yPoXUWXW0QRvA6TB7I0k5Y2 y42NAmRkgQRJFHIw8Js6CSYjiOLiRqHkftOWWbcImFoGfIO8d8g1GOQ0cWsx8afVX2dU6 mk+mBiz+QVr9PMOYaZJ+Ygij4nR8SmUoeW12/JgkzFFYRwf/LdpYvFPBvR251iXGfc9JY eLRAfXaMFl5Nj2PLedg5J9zehhTzM53sGPo7VmEg3uhYo9SVPdMg+qTC0mhvHVAhoKg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796142031; 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:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=E72R/mGYyNPoiXI/rFiS86WJ82aw17T/9cG18AM2PNM=; b=DT9ksZ5ZIz3qYTmjmzxCdR7Gta7FsMASHEIZPLPj9cI8gu5UymhH9XbwqPSHj0Gv/wDF 4jAZ7ZqmuGqjXELgHGSsdBS/qcf1ZTj77TKvVzXm77JB86gJCIV7KyfZnsrohTCg7L1KR i8ANpv1W7aSFTeAXwnjmIBnn2UhaCGgu1OZr0/zeZZcxXByCpkuqaU9xObeggnE0tTp2p lvInTkjcDDHgZR2VrEUMpzCMDVKTmNZ6dAbvjysToHMQEwtNGQX2hfX9KlbAE4p61fMuL HVXUJ0QpKb4miNsRF7fvyVy6MqxUZkfwArfWUzR7iqt/Oo51p8huW11/SAibVAb5Low== 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=mwFbZcqU; arc=none smtp.remote-ip=74.125.82.52 Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (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 F1807606A6AC for ; Tue, 1 Dec 2026 16:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1807606A6AC 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=mwFbZcqU Received: by mail-dl1-f52.google.com with SMTP id a92af1059eb24-15ea896ddc8so19553547c88.0 for ; Tue, 01 Dec 2026 08:20:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796142029; x=1796746829; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=E72R/mGYyNPoiXI/rFiS86WJ82aw17T/9cG18AM2PNM=; b=mwFbZcqUs+1XqFYvmiQH/DMNi0jnm7u+pdpFKflMrFDM0xqujXIz18wQ3WEESwp8Rk /i2+BjICxE4rziH1CrjESPt5GGg8+QhWTWrKpKoBH7CIJ29nwkmtosYWy+iuNsNk+EiD sH00inCu2Peluh3de1Vd/gpvFa0BeQXt7IXWWBAjcgSbdbT8cK+UjcOKjL0HoiZeak1j 2tMfTmsgld9+8sda4zz9/TMxV5OyD2x/gUwewqr64xz9Gnrm0eJyoLtce2SHBUIwMbme uB++cLq8lrMWN5PhxMrxYfJCyyneD62JdC+d1ORX5RbutH3I2Ak2ChDzpy6vAOh2+rUV +qog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796142029; x=1796746829; h=content-transfer-encoding:mime-version:references:in-reply-to :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=E72R/mGYyNPoiXI/rFiS86WJ82aw17T/9cG18AM2PNM=; b=XUQ0+pSfBPc0/YaFidkz+YkMaCAYhJSlfJuEysgXzdxDoF2M8MK0naGAdPhKONHppN uBe+JepFK37GOjksfRE3B06ZjVabncX/86ZUAUfyZ0+E2zyG/ThNJimXnfqMqqn5kZPW bX//McbG24RC3Tr8qiZH7Up62WMwz9ejelXHRrNlQt9Ux9fs4pOocEGQcLTUUB1r19sp BH/e0kbW7sQXS9VSPDUO0wppjds7txhrRbaOSbeL3C3bb25R23p7ZNXpE8fyaNiy2ozz lbgDGG6cH3BCD+iHf3UvkgXWw+XHpKNKIepJLUUi9kVHnwuu/sY8dgPFCJSQjOcM9E1J ST1g== X-Forwarded-Encrypted: i=1; AL+hErHhwezzqoOuYEAGJTt2NkrWjdZ7L3EH42M3YbHRTabFLeVwx6U1d3Ad3of1JteE2r6xufU4AbJ3fFu3b8k=@vger.kernel.org X-Gm-Message-State: APuU4Z9Xkxj2WtnjbeoBkoHbwdxvcX0qtAXZyPYFmmzhTJjIdpfYhUEp rnx2ipBzYpAn7iVhO78yaujUqe3lHMHsdaxoGtjROZY71Ek+JkLMGJMI X-Gm-Gg: AZFdTZeUPIU+wEQ0dLdP+Gwchxf7DGHYEx/nKKGIc3hqDsP4WDzLkb2hQk29Ht+IHhu ZemOyZKfglhXzubsXGTXdodrJWyT07aI2bkXJZeAnIoSVFDU5637mA2yxFhDHFMqihUbr4xF2ZJ lxRw5uKuW9qCZG5nWJd1pT8tzB2EsN6W8ih8CqdUPx89FCHdOudTof6080M1tMZJ0xfmrIfF3GG C6bir5AafCCTGiOxeos52FDyjkACb3yawGedM0FRk8iPQ7IXrXOGfD+xQuMX64akp9IuInA9kl4 e760zgiEmSOiktmRgUYpzA/hHB0BcWeVkj4/PK9QUzkX+NEmD8EZa2BJtYo4p/K1GgVE8R4mOMq DAUQNhzRy+zVYNB3PJdjTP1C2LEb07wO70vOud71R/NWYXDgZsWNG2Qeg6Rj17qNTDAuCrGgj9n 6BpWKft49IRAbM6sKQ5OLSY9JwDXrjKSAMVphKzjmE/uUHq+LXVT4aI5GwLeK0KK2LK7Y5bLw0l a3I7Ii5x/7dWsI3ebF2ZCVq07LZzClGJpkNCmoz5Ek1uiquAXwpmX30O1e2n0WaPa0sdRNWXsHb u0os4PTY9ixC1s0CTtjxmw/ZZ1d7Im3PCTuX62R7fsHLfwSpILjbtfxZrRQDS+zNv5nPkifOwq4 tafVnzjdDJCBQYssb0pJlm4zdoULs X-Received: by 2002:a05:7300:6da7:b0:36c:3b8a:8090 with SMTP id 5a478bee46e88-3856c9a302amr25953770eec.2.1796142028422; Tue, 01 Dec 2026 08:20:28 -0800 (PST) Received: from kernel.. ([212.87.193.62]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386c7c62a91sm71632752eec.17.2026.12.01.08.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 08:20:27 -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 16/17] rcutorture: Document how to check SRCU NMI coverage Date: Wed, 2 Dec 2026 00:18:14 +0800 Message-ID: <20261201161815.1637481-17-kunwu.chan@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261201161815.1637481-1-kunwu.chan@gmail.com> References: <20261201161815.1637481-1-kunwu.chan@gmail.com> 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 Describe how to enable the guest PMU, run the coverage checker and confirm that a PMU-off run reports SKIP. The x86 KVM example uses the separate QEMU CPU-selection fix. The same methodology applies on arm64 KVM; adjust the QEMU CPU option accordingly. Signed-off-by: Kunwu Chan --- Documentation/RCU/torture.rst | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Documentation/RCU/torture.rst b/Documentation/RCU/torture.rst index 1ad5cc793811..d6fcc900ccab 100644 --- a/Documentation/RCU/torture.rst +++ b/Documentation/RCU/torture.rst @@ -304,6 +304,58 @@ the following summary at the end of the run on a 12-CPU system:: TREE09 ------- 752238 GPs (139.303/s) [rcu: g13075057 f0x0 ] n_max_cbs: 99011 +Checking NMI coverage +===================== + +NMI-safe SRCU readers can run from the per-CPU perf-counter NMI. This +needs a guest PMU because the test uses perf counters to generate NMIs. The x86 KVM example below requires the +separate rcutorture fix that honors an explicit QEMU CPU selection. +Check the saved ``qemu-cmd`` to verify the effective CPU option. +For example, an ordinary expedited SRCU run can use:: + + kvm.sh --configs SRCU-P --cpus 4 --duration 5m \ + --kconfig 'CONFIG_FORCE_NEED_SRCU_NMI_SAFE=y' \ + --qemu-args '-cpu host,pmu=on' \ + --bootargs "rcutorture.reader_flavor=0x2 rcutorture.gp_exp=1 \ + rcutorture.nmi_readers=1 rcutorture.nmi_calls=1 \ + rcupdate.rcu_normal=0 rcupdate.rcu_normal_after_boot=0 \ + srcutree.convert_to_big=0" \ + --datestamp srcu-exp-nmi-small + +Use ``srcutree.convert_to_big=1`` and a fresh ``--datestamp`` for BIG. ``reader_flavor=0x2`` selects +full-barrier NMI-safe readers in place of SRCU-P's default FAST_UPDOWN. +The expedited updater runs in task context. + +In addition to the normal result checks, require actual NMI coverage:: + + kvm-recheck-nmi.sh \ + tools/testing/selftests/rcutorture/res/srcu-exp-nmi-small/SRCU-P both + +After stopping the NMI producers and the statistics thread and draining +callbacks, the kernel prints a final ``NMI coverage:`` record. The checker +requires exactly one complete record before the same flavor reports +``End of test: SUCCESS``. It returns 1 for failure or a missing, invalid +or duplicate record, including when the kernel predates this record. + +``readers`` requires samples of protected objects, ``calls`` requires +nonzero callback submissions and the same number of completions, and +``both`` requires both. All modes reject samples of objects that have +passed through two or more grace periods. The checker returns 0 when the +requested coverage was observed, or 4 when the run succeeded with valid +statistics but the requested activity was absent. Use the normal console +checks for general kernel diagnostics. See NMI Reader Batch in the +console log for close-call analysis. + +Observe fastpath hits separately. To check autonomous callback +progress, observe completion before the cleanup barrier. + +For the PMU-off control, rerun kvm.sh with ``-cpu host,pmu=off`` and a +fresh ``--datestamp``. If torture reports SUCCESS, expect a zero-count +summary and SKIP from the coverage checker. +Check a fresh run's QEMU arguments because +``kvm-again.sh`` reuses the saved ``qemu-cmd``. + + Repeated Runs ============= -- 2.43.0