From: Costa Shulyupin <costa.shul@redhat.com>
To: longman@redhat.com, ming.lei@redhat.com, pauld@redhat.com,
juri.lelli@redhat.com, vschneid@redhat.com,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Naveen N Rao" <naveen@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Zefan Li" <lizefan.x@bytedance.com>, "Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
"Costa Shulyupin" <costa.shul@redhat.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
cgroups@vger.kernel.org
Subject: [RFC PATCH v3 3/3] DO NOT MERGE: test for managed irqs adjustment
Date: Mon, 16 Sep 2024 15:20:44 +0300 [thread overview]
Message-ID: <20240916122044.3056787-4-costa.shul@redhat.com> (raw)
In-Reply-To: <20240916122044.3056787-1-costa.shul@redhat.com>
shell script for testing managed interrupts
status adjustments.
Targets: managed_irq_affinity_adjust(),
irq_restore_affinity_of_irq(), managed_irq_isolate()
Managed interrupts can be created in various ways. One of them:
1. create qcow2 image
2. run
virtme-ng -v --cpus 4 --rw --user root \
--qemu-opts '\-drive id=d1,if=none,file=image.qcow2 \
\-device nvme,id=i1,drive=d1,serial=1,bootindex=2'
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
Changes in v2:
- use shell script only
v1:
- https://lore.kernel.org/lkml/20240516190437.3545310-8-costa.shul@redhat.com/
---
tests/managed_irq.sh | 113 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
create mode 100755 tests/managed_irq.sh
diff --git a/tests/managed_irq.sh b/tests/managed_irq.sh
new file mode 100755
index 0000000000000..bd97f47991a0b
--- /dev/null
+++ b/tests/managed_irq.sh
@@ -0,0 +1,113 @@
+#!/bin/zsh
+
+# shell script for testing IRQ status adjustment.
+# Targets: managed_irq_affinity_adjust(),
+# irq_restore_affinity_of_irq(), managed_irq_isolate()
+
+# cpu# to isolate
+#
+isolate=1
+
+managed_affined=$(
+ cd /sys/kernel/debug/irq/irqs/;
+ grep -l -e "affinity: $isolate$" /dev/null $(grep -l IRQD_AFFINITY_MANAGED *)
+)
+test_irq=${managed_affined%% *}
+
+[ -z $test_irq ] && { echo No managed IRQs found;exit 1}
+
+rm -rf 0.irqs
+cp -R /sys/kernel/debug/irq/irqs 0.irqs
+
+cd /sys/fs/cgroup/
+echo +cpuset > cgroup.subtree_control
+mkdir -p test
+echo isolated > test/cpuset.cpus.partition
+
+effective_affinity=/proc/irq/$test_irq/effective_affinity
+test_irq_debug=/sys/kernel/debug/irq/irqs/$test_irq
+
+errors=0
+
+check()
+{
+ local _status=$?
+ if [[ $_status == 0 ]]
+ then
+ echo PASS
+ else
+ let errors+=1
+ echo FAIL:
+ cat $test_irq_debug
+ fi
+ return $_status
+}
+
+check_activated()
+{
+ echo "Check normal irq affinity"
+ test 0 -ne $((0x$(cat $effective_affinity) & 1 << $isolate))
+ check
+ grep -q IRQD_ACTIVATED $test_irq_debug
+ check
+ grep -q IRQD_IRQ_STARTED $test_irq_debug
+ check
+ ! grep -q IRQD_IRQ_DISABLED $test_irq_debug
+ check
+ ! grep -q IRQD_IRQ_MASKED $test_irq_debug
+ check
+ ! grep -q IRQD_MANAGED_SHUTDOWN $test_irq_debug
+ check
+}
+
+check_shutdown()
+{
+ echo "Check that irq affinity doesn't contain isolated cpu."
+ test 0 -eq $((0x$(cat $effective_affinity) & 1 << $isolate))
+ check
+ ! grep -q IRQD_ACTIVATED $test_irq_debug
+ check
+ ! grep -q IRQD_IRQ_STARTED $test_irq_debug
+ check
+ grep -q IRQD_IRQ_DISABLED $test_irq_debug
+ check
+ grep -q IRQD_IRQ_MASKED $test_irq_debug
+ check
+ grep -q IRQD_MANAGED_SHUTDOWN $test_irq_debug
+ check
+}
+
+echo "Isolating CPU #$isolate"
+echo $isolate > test/cpuset.cpus
+
+check_shutdown
+
+echo Reset cpuset
+echo "" > test/cpuset.cpus
+
+check_activated
+
+echo "Isolating CPU #$isolate again"
+echo $isolate > test/cpuset.cpus
+
+check_shutdown()
+
+echo "Isolating CPU #3 and restore CPU #$isolate"
+echo 3 > test/cpuset.cpus
+
+check_activated
+
+echo Reset cpuset
+echo "" > test/cpuset.cpus
+
+rmdir test
+cd -
+
+rm -rf final.irqs
+cp -R /sys/kernel/debug/irq/irqs final.irqs
+
+echo Expected to be without major differences:
+diff -r 0.irqs final.irqs && echo No differences
+
+echo errors=$errors
+(return $errors)
--
2.45.0
prev parent reply other threads:[~2024-09-16 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-16 12:20 [RFC PATCH v3 0/3] genirq/cpuhotplug: Adjust managed interrupts according to change of housekeeping cpumask Costa Shulyupin
2024-09-16 12:20 ` [RFC PATCH v3 1/3] sched/isolation: Add infrastructure for dynamic CPU isolation Costa Shulyupin
2024-10-02 9:44 ` Thomas Gleixner
2024-09-16 12:20 ` [RFC PATCH v3 2/3] genirq/cpuhotplug: Adjust managed irqs according to change of housekeeping CPU Costa Shulyupin
2024-10-02 10:09 ` Thomas Gleixner
2024-09-16 12:20 ` Costa Shulyupin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240916122044.3056787-4-costa.shul@redhat.com \
--to=costa.shul@redhat.com \
--cc=bhelgaas@google.com \
--cc=bsegall@google.com \
--cc=cgroups@vger.kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dietmar.eggemann@arm.com \
--cc=hannes@cmpxchg.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=mgorman@suse.de \
--cc=ming.lei@redhat.com \
--cc=mingo@redhat.com \
--cc=mkoutny@suse.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=pauld@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).