From: Bart Van Assche <bvanassche@acm.org>
To: "André Draszik" <andre.draszik@linaro.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Avri Altman" <avri.altman@wdc.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Peter Griffin <peter.griffin@linaro.org>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Will McVicker <willmcvicker@google.com>,
Manivannan Sadhasivam <mani@kernel.org>,
kernel-team@android.com, linux-arm-msm@vger.kernel.org,
linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 2/2] scsi: ufs: core: move some irq handling back to hardirq (with time limit)
Date: Mon, 28 Jul 2025 08:19:11 -0700 [thread overview]
Message-ID: <c385f1c4-f27b-4dc7-b4a2-d35a9fc77a91@acm.org> (raw)
In-Reply-To: <76af97e49cb7f36c8dc6edc62c84e72d6bb4669c.camel@linaro.org>
On 7/28/25 7:49 AM, André Draszik wrote:
> Btw, my complete command was (should probably have added that
> to the commit message in the first place):
>
> for rw in read write ; do
> echo "rw: ${rw}"
> for jobs in 1 8 ; do
> echo "jobs: ${jobs}"
> for it in $(seq 1 5) ; do
> fio --name=rand${rw} --rw=rand${rw} \
> --ioengine=libaio --direct=1 \
> --bs=4k --numjobs=${jobs} --size=32m \
> --runtime=30 --time_based --end_fsync=1 \
> --group_reporting --filename=/foo \
> | grep -E '(iops|sys=|READ:|WRITE:)'
> sleep 5
> done
> done
> done
Please run performance tests in recovery mode against a block
device (/dev/block/sd...) instead of running performance tests on
top of a filesystem. One possible approach for retrieving the block
device name is as follows:
adb shell readlink /dev/block/by-name/userdata
There may be other approaches for retrieving the name of the block
device associated with /data. Additionally, tuning for maximum
performance is useful because it eliminates impact from the process
scheduler on block device performance measurement. An extract from a
scrip that I use myself to measure block device performance on Pixel
devices is available below.
Best regards,
Bart.
optimize() {
local clkgate_enable c d devfreq disable_cpuidle governor nomerges
iostats
local target_freq ufs_irq_path
if [ "$1" = performance ]; then
clkgate_enable=0
devfreq=max
disable_cpuidle=1
governor=performance
# Enable I/O statistics because the performance impact is low and
# because fio reports the I/O statistics.
iostats=1
# Disable merging to make tests follow the fio arguments.
nomerges=2
target_freq=cpuinfo_max_freq
persist_logs=false
else
clkgate_enable=1
devfreq=min
disable_cpuidle=0
governor=sched_pixel
iostats=1
nomerges=0
target_freq=cpuinfo_min_freq
persist_logs=true
fi
for c in $(adb shell "echo /sys/devices/system/cpu/cpu[0-9]*"); do
for d in $(adb shell "echo $c/cpuidle/state[1-9]*"); do
adb shell "if [ -e $d ]; then echo $disable_cpuidle > $d/disable; fi"
done
adb shell "cat $c/cpufreq/cpuinfo_max_freq > $c/cpufreq/scaling_max_freq;
cat $c/cpufreq/${target_freq} >
$c/cpufreq/scaling_min_freq;
echo ${governor} > $c/cpufreq/scaling_governor; true" \
2>/dev/null
done
if [ "$(adb shell grep -c ufshcd /proc/interrupts)" = 1 ]; then
# No MCQ or MCQ disabled. Make the fastest CPU core process UFS
# interrupts.
# shellcheck disable=SC2016
ufs_irq_path=$(adb shell 'a=$(echo /proc/irq/*/ufshcd); echo ${a%/ufshcd}')
adb shell "echo ${fastest_cpucore} > ${ufs_irq_path}/smp_affinity_list;
true"
else
# MCQ is enabled. Distribute the completion interrupts over the
# available CPU cores.
local i=0
local irqs
irqs=$(adb shell "sed -n 's/:.*GIC.*ufshcd.*//p' /proc/interrupts")
for irq in $irqs; do
adb shell "echo $i > /proc/irq/$irq/smp_affinity_list; true"
i=$((i+1))
done
fi
for d in $(adb shell echo /sys/class/devfreq/*); do
case "$d" in
*gpu0)
continue
;;
esac
local min_freq
min_freq=$(adb shell "cat $d/available_frequencies |
tr ' ' '\n' |
sort -n |
case $devfreq in
min) head -n1;;
max) tail -n1;;
esac")
adb shell "echo $min_freq > $d/min_freq"
# shellcheck disable=SC2086
if [ "$devfreq" = "max" ]; then
echo "$(basename $d)/min_freq: $(adb shell cat $d/min_freq) <>
$min_freq"
fi
done
for d in $(adb shell echo /sys/devices/platform/*.ufs); do
adb shell "echo $clkgate_enable > $d/clkgate_enable"
done
adb shell setprop logd.logpersistd.enable ${persist_logs}
adb shell "for b in /sys/class/block/{sd[a-z],dm*}; do
if [ -e \$b ]; then
[ -e \$b/queue/iostats ] && echo ${iostats} >\$b/queue/iostats;
[ -e \$b/queue/nomerges ] && echo ${nomerges} >\$b/queue/nomerges;
[ -e \$b/queue/rq_affinity ] && echo 2 >\$b/queue/rq_affinity;
[ -e \$b/queue/scheduler ] && echo ${iosched} >\$b/queue/scheduler;
fi
done; true"
adb shell "grep -q '^[^[:blank:]]* /sys/kernel/debug' /proc/mounts
|| mount -t debugfs none /sys/kernel/debug"
}
next prev parent reply other threads:[~2025-07-28 15:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 14:16 [PATCH v2 0/2] scsi: ufs: core: interrupt handling optimisations André Draszik
2025-07-25 14:16 ` [PATCH v2 1/2] scsi: ufs: core: complete polled requests also from interrupt context André Draszik
2025-07-25 14:16 ` [PATCH v2 2/2] scsi: ufs: core: move some irq handling back to hardirq (with time limit) André Draszik
2025-07-25 21:08 ` Bart Van Assche
2025-07-28 14:43 ` Neil Armstrong
2025-07-28 14:49 ` André Draszik
2025-07-28 15:19 ` Bart Van Assche [this message]
2025-07-28 16:55 ` Neil Armstrong
2025-07-29 11:20 ` André Draszik
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=c385f1c4-f27b-4dc7-b4a2-d35a9fc77a91@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=avri.altman@wdc.com \
--cc=kernel-team@android.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=martin.petersen@oracle.com \
--cc=neil.armstrong@linaro.org \
--cc=peter.griffin@linaro.org \
--cc=stable@vger.kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=willmcvicker@google.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).