* [PATCH v7 00/13] selftests/mm: fix failures and robustness improvements
From: Sayali Patil @ 2026-05-21 6:33 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
Hi all,
Powerpc systems with a 64K base page size exposed several issues while
running mm selftests. Some tests assume specific hugetlb configurations,
use incorrect interfaces, or fail instead of skipping when the required
kernel features are not available.
This series fixes these issues and improves test robustness.
Please review the patches and provide any feedback or suggestions for
improvement.
Thanks,
Sayali
---
v6->v7
- Rebased onto the latest mm-new branch, top commit of the base is
commit 0cec77cfd531 ("mm/filemap: fix page_cache_prev_miss() when no hole is found")
- Dropped "selftest/mm: align memory size to huge page size in
hugepage-mremap test":
Similar patch has already been merged.
- For "selftests/mm: skip uffd-stress test when nr_pages_per_cpu is zero":
Changed format specifier of bytes to %zu as per review
comment.
- For "selftests/mm: move hwpoison setup into run_test() and silence
modprobe output for memory-failure category":
Added condition to avoid executing the test pipeline for skipped tests and assign
ret directly.
v6: https://lore.kernel.org/all/cover.1777877814.git.sayalip@linux.ibm.com/
---
v5->v6
- For "selftests/mm: restore default nr_hugepages value via exit trap
in charge_reserved_hugetlb.sh":
Extended trap to include INT and TERM in hugetlb tests to ensure
nr_hugepages is restored on signal-based exits.
- For "selftests/mm: restore default nr_hugepages value via exit trap
in hugetlb_reparenting_test.sh":
Extended trap to include INT and TERM in hugetlb tests to ensure
nr_hugepages is restored on signal-based exits.
- For "selftests/mm: fix cgroup task placement and drop memory.current
checks in hugetlb_reparenting_test.sh":
Updated the subshell invocation to pass variables as positional arguments
instead of interpolating them into the command string as per review comment.
- For "selftests/mm: move hwpoison setup into run_test() and silence modprobe
output for memory-failure category":
Updated the condition to avoid unconditional module removal and ensures it is
only unloaded if loaded by the test.
v5: https://lore.kernel.org/all/cover.1776150071.git.sayalip@linux.ibm.com/
---
---
v4->v5
- For "selftests/mm: move hwpoison setup into run_test() and silence modprobe
output for memory-failure category":
Renamed LOADED_MOD to LOADED_HWPOISON_INJECT_MOD as per review comment.
- Dropped "selftests/cgroup: extend test_hugetlb_memcg.c to support all huge
page sizes":
Due to intermittent failures observed on some systems.
- Added Tested-by from Venkat for all patches.
- Added Reviewed-by from Zi yan for patches 7,8 and 13.
- Added Acked-by from Zi yan for patches 1 and 3.
v4: https://lore.kernel.org/all/cover.1775466329.git.sayalip@linux.ibm.com/
---
v3->v4
- selftests/mm: restore default nr_hugepages value via EXIT
trap in charge_reserved_hugetlb.sh:
Updated to use an EXIT trap to restore the original nr_hugepages
once at script termination, ensuring reliable restoration on all
exit paths.
- selftest/mm: fix cgroup task placement and drop memory.current checks
in hugetlb_reparenting_test.sh:
Updated to use a deterministic synchronization method by migrating the
workload process within a wrapper subshell before calling exec() to
ensure correct cgroup accounting.
- selftest/mm: align memory size to huge page size in hugepage-mremap
test:
Update test code directly to align memory allocations to the hugepage
size, rather than modifying run_vmtests.sh. This replaces the previous
commit “adjust hugepage-mremap test size for large huge pages” with
a cleaner, direct approach in the test itself.
- selftests/mm: ensure destination is hugetlb-backed in hugepage-mremap:
Updated to remove MAP_POPULATE flag for the mmap call as per review
comment.
- selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported:
Updated as per review comment to initialize features to zero and exit
on all uffd_get_features() failures, avoiding spurious test errors.
- selftests/mm: move hwpoison setup into run_test() and silence
modprobe output for memory-failure category:
Declared LOADED_MOD as local variable and avoided a redundant
skip message when the module is not found.
Updated logic to set exitcode to ksft_skip only when no failure has
been recorded.
- selftests/cgroup: extend test_hugetlb_memcg.c to support all huge
page sizes:
Updated to skip on memory constraints instead of returning
EXIT_FAILURE.
Updated the logic to fully account for the scenario when the
per-CPU stock is empty and a refill charges MEMCG_CHARGE_BATCH.
Updated to avoid overflow on 32-bit systems for memory.max value.
- Included "selftests/mm: restore default nr_hugepages value via
EXIT trap in hugetlb_reparenting_test.sh"
- Included "selftests/mm: free dynamically allocated PMD-sized
buffers in split_huge_page_test"
- Included "selftests/mm: clarify alternate unmapping in compaction_test"
- Dropped "selftests/mm: fix double increment in linked list cleanup in
compaction_test":
The behaviour is intentional.
v3: https://lore.kernel.org/all/cover.1774591179.git.sayalip@linux.ibm.com/
---
v2->v3
- selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported:
Rename function to check_uffd_wp_feature_supported() as suggested in review.
- selftest/mm: fix cgroup task placement and drop memory.current checks
in hugetlb_reparenting_test.sh:
Drop memory.current validation from the hugetlb reparenting test.
Keep tolerance at 7MB (reverting earlier increase to 8MB in v1).
- Included "selftests/mm: allow PUD-level entries in compound testcase of hmm
tests" patch:
Extend the compound testcase checks to accept PUD-level mappings.
- Included "selftests/mm: replace hardcoded THP size with runtime PMD page size in
hmm tests" patch:
Use read_pmd_pagesize() instead of TWOMEG and cap maximum THPs in
benchmarks to avoid integer overflow.
v2: https://lore.kernel.org/all/cover.1773305677.git.sayalip@linux.ibm.com/
---
v1->v2
- For "selftests/mm: ensure destination is hugetlb-backed in hugepage-mremap":
update FLAGS definition to MAP_HUGETLB | MAP_SHARED | MAP_POPULATE and
used it for mmap() calls as suggested during review.
v1: https://lore.kernel.org/all/cover.1773134177.git.sayalip@linux.ibm.com/
---
Sayali Patil (13):
selftests/mm: restore default nr_hugepages value via exit trap in
charge_reserved_hugetlb.sh
selftests/mm: fix hugetlb pathname construction in
charge_reserved_hugetlb.sh
selftests/mm: restore default nr_hugepages value via exit trap in
hugetlb_reparenting_test.sh
selftests/mm: fix hugetlb pathname construction in
hugetlb_reparenting_test.sh
selftests/mm: fix cgroup task placement and drop memory.current checks
in hugetlb_reparenting_test.sh
selftests/mm: size tmpfs according to PMD page size in
split_huge_page_test
selftests/mm: free dynamically allocated PMD-sized buffers in
split_huge_page_test
selftest/mm: register existing mapping with userfaultfd in
hugetlb-mremap
selftests/mm: ensure destination is hugetlb-backed in hugetlb-mremap
selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported
selftests/mm: skip uffd-stress test when nr_pages_per_cpu is zero
selftests/mm: move hwpoison setup into run_test() and silence modprobe
output for memory-failure category
selftests/mm: clarify alternate unmapping in compaction_test
.../selftests/mm/charge_reserved_hugetlb.sh | 45 +++++++++-----
tools/testing/selftests/mm/compaction_test.c | 3 +
tools/testing/selftests/mm/hugetlb-mremap.c | 32 +++-------
.../selftests/mm/hugetlb_reparenting_test.sh | 60 +++++++++---------
tools/testing/selftests/mm/run_vmtests.sh | 62 ++++++++++++-------
.../selftests/mm/split_huge_page_test.c | 27 +++++---
tools/testing/selftests/mm/uffd-stress.c | 6 +-
tools/testing/selftests/mm/uffd-wp-mremap.c | 13 ++++
8 files changed, 151 insertions(+), 97 deletions(-)
--
2.52.0
^ permalink raw reply
* [PATCH v7 02/13] selftests/mm: fix hugetlb pathname construction in charge_reserved_hugetlb.sh
From: Sayali Patil @ 2026-05-21 6:33 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The charge_reserved_hugetlb.sh script assumes hugetlb cgroup memory
interface file names use the "<size>MB" format
(e.g. hugetlb.1024MB.current).
This assumption breaks on systems with larger huge pages such as 1GB,
where the kernel exposes normalized units:
hugetlb.1GB.current
hugetlb.1GB.max
hugetlb.1GB.rsvd.max
...
As a result, the script attempts to access files like
hugetlb.1024MB.current, which do not exist when the kernel reports the
size in GB.
Normalize the huge page size and construct the pathname using the
appropriate unit (MB or GB), matching the hugetlb controller naming.
Fixes: 209376ed2a84 ("selftests/vm: make charge_reserved_hugetlb.sh work with existing cgroup setting")
Fixes: 29750f71a9b4 ("hugetlb_cgroup: add hugetlb_cgroup reservation tests")
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
.../selftests/mm/charge_reserved_hugetlb.sh | 42 +++++++++++++------
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
index e1945901fd20..a1cfd3a349db 100755
--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
@@ -94,6 +94,15 @@ function get_machine_hugepage_size() {
}
MB=$(get_machine_hugepage_size)
+if (( MB >= 1024 )); then
+ # For 1GB hugepages
+ UNIT="GB"
+ MB_DISPLAY=$((MB / 1024))
+else
+ # For 2MB hugepages
+ UNIT="MB"
+ MB_DISPLAY=$MB
+fi
function setup_cgroup() {
local name="$1"
@@ -103,11 +112,12 @@ function setup_cgroup() {
mkdir $cgroup_path/$name
echo writing cgroup limit: "$cgroup_limit"
- echo "$cgroup_limit" >$cgroup_path/$name/hugetlb.${MB}MB.$fault_limit_file
+ echo "$cgroup_limit" > \
+ $cgroup_path/$name/hugetlb.${MB_DISPLAY}${UNIT}.$fault_limit_file
echo writing reservation limit: "$reservation_limit"
echo "$reservation_limit" > \
- $cgroup_path/$name/hugetlb.${MB}MB.$reservation_limit_file
+ $cgroup_path/$name/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_limit_file
if [ -e "$cgroup_path/$name/cpuset.cpus" ]; then
echo 0 >$cgroup_path/$name/cpuset.cpus
@@ -142,7 +152,7 @@ function wait_for_file_value() {
function wait_for_hugetlb_memory_to_get_depleted() {
local cgroup="$1"
- local path="$cgroup_path/$cgroup/hugetlb.${MB}MB.$reservation_usage_file"
+ local path="$cgroup_path/$cgroup/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file"
wait_for_file_value "$path" "0"
}
@@ -150,7 +160,7 @@ function wait_for_hugetlb_memory_to_get_depleted() {
function wait_for_hugetlb_memory_to_get_reserved() {
local cgroup="$1"
local size="$2"
- local path="$cgroup_path/$cgroup/hugetlb.${MB}MB.$reservation_usage_file"
+ local path="$cgroup_path/$cgroup/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file"
wait_for_file_value "$path" "$size"
}
@@ -158,7 +168,7 @@ function wait_for_hugetlb_memory_to_get_reserved() {
function wait_for_hugetlb_memory_to_get_written() {
local cgroup="$1"
local size="$2"
- local path="$cgroup_path/$cgroup/hugetlb.${MB}MB.$fault_usage_file"
+ local path="$cgroup_path/$cgroup/hugetlb.${MB_DISPLAY}${UNIT}.$fault_usage_file"
wait_for_file_value "$path" "$size"
}
@@ -180,8 +190,8 @@ function write_hugetlbfs_and_get_usage() {
hugetlb_difference=0
reserved_difference=0
- local hugetlb_usage=$cgroup_path/$cgroup/hugetlb.${MB}MB.$fault_usage_file
- local reserved_usage=$cgroup_path/$cgroup/hugetlb.${MB}MB.$reservation_usage_file
+ local hugetlb_usage=$cgroup_path/$cgroup/hugetlb.${MB_DISPLAY}${UNIT}.$fault_usage_file
+ local reserved_usage=$cgroup_path/$cgroup/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file
local hugetlb_before=$(cat $hugetlb_usage)
local reserved_before=$(cat $reserved_usage)
@@ -312,8 +322,10 @@ function run_test() {
cleanup_hugetlb_memory "hugetlb_cgroup_test"
- local final_hugetlb=$(cat $cgroup_path/hugetlb_cgroup_test/hugetlb.${MB}MB.$fault_usage_file)
- local final_reservation=$(cat $cgroup_path/hugetlb_cgroup_test/hugetlb.${MB}MB.$reservation_usage_file)
+ local final_hugetlb=$(cat \
+ $cgroup_path/hugetlb_cgroup_test/hugetlb.${MB_DISPLAY}${UNIT}.$fault_usage_file)
+ local final_reservation=$(cat \
+ $cgroup_path/hugetlb_cgroup_test/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file)
echo $hugetlb_difference
echo $reserved_difference
@@ -369,10 +381,14 @@ function run_multiple_cgroup_test() {
reservation_failed1=$reservation_failed
oom_killed1=$oom_killed
- local cgroup1_hugetlb_usage=$cgroup_path/hugetlb_cgroup_test1/hugetlb.${MB}MB.$fault_usage_file
- local cgroup1_reservation_usage=$cgroup_path/hugetlb_cgroup_test1/hugetlb.${MB}MB.$reservation_usage_file
- local cgroup2_hugetlb_usage=$cgroup_path/hugetlb_cgroup_test2/hugetlb.${MB}MB.$fault_usage_file
- local cgroup2_reservation_usage=$cgroup_path/hugetlb_cgroup_test2/hugetlb.${MB}MB.$reservation_usage_file
+ local cgroup1_hugetlb_usage=\
+ $cgroup_path/hugetlb_cgroup_test1/hugetlb.${MB_DISPLAY}${UNIT}.$fault_usage_file
+ local cgroup1_reservation_usage=\
+ $cgroup_path/hugetlb_cgroup_test1/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file
+ local cgroup2_hugetlb_usage=\
+ $cgroup_path/hugetlb_cgroup_test2/hugetlb.${MB_DISPLAY}${UNIT}.$fault_usage_file
+ local cgroup2_reservation_usage=\
+ $cgroup_path/hugetlb_cgroup_test2/hugetlb.${MB_DISPLAY}${UNIT}.$reservation_usage_file
local usage_before_second_write=$(cat $cgroup1_hugetlb_usage)
local reservation_usage_before_second_write=$(cat $cgroup1_reservation_usage)
--
2.52.0
^ permalink raw reply related
* Re: [PATCH V4 1/2] tools/perf: Fix the check for parameterized field in event term
From: Athira Rajeev @ 2026-05-21 6:37 UTC (permalink / raw)
To: acme, jolsa, adrian.hunter, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, hbathini, Tejas.Manhas1,
Tanushree.Shah, shivani, Thomas Richter, Madhavan Srinivasan,
mpetlan
In-Reply-To: <20260504154205.21394-1-atrajeev@linux.ibm.com>
> On 4 May 2026, at 9:12 PM, Athira Rajeev <atrajeev@linux.ibm.com> wrote:
>
> The format_alias() function in util/pmu.c has a check to
> detect whether the event has parameterized field ( =? ).
> The string alias->terms contains the event and if the event
> has user configurable parameter, there will be presence of
> sub string "=?" in the alias->terms.
>
> Snippet of code:
>
> /* Paramemterized events have the parameters shown. */
> if (strstr(alias->terms, "=?")) {
> /* No parameters. */
> snprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
>
> if "strstr" contains the substring, it returns a pointer
> and hence enters the above check which is not the expected
> check. And hence "perf list" doesn't have the parameterized
> fields in the result.
>
> Fix this check to use:
>
> if (!strstr(alias->terms, "=?")) {
>
> With this change, perf list shows the events correctly with
> the strings showing parameters.
>
> Before the fix:
>
> # ./perf list|grep -w PM_PAU_CYC
> hv_24x7/PM_PAU_CYC/ [Kernel PMU event]
>
> With this fix:
>
> # ./perf list|grep -w PM_PAU_CYC
> hv_24x7/PM_PAU_CYC,chip=?/ [Kernel PMU event]
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Hi,
Can we please have this pulled in, if the changes looks fine.
Thanks
Athira
> ---
> Changelog:
> v3 -> v4:
> Updated commit message to show real example
> addressing review comment from Namhyung.
>
> v2 -> v3:
> Split the strstr correction in a single patch
>
> tools/perf/util/pmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 23337d2fa281..0b8d58543f17 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -2117,7 +2117,7 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,
> skip_duplicate_pmus);
>
> /* Paramemterized events have the parameters shown. */
> - if (strstr(alias->terms, "=?")) {
> + if (!strstr(alias->terms, "=?")) {
> /* No parameters. */
> snprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
> return buf;
> --
> 2.47.3
>
^ permalink raw reply
* [PATCH v7 01/13] selftests/mm: restore default nr_hugepages value via exit trap in charge_reserved_hugetlb.sh
From: Sayali Patil @ 2026-05-21 6:33 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
cleanup() resets nr_hugepages to 0 on every invocation, while the test
reconfigures it again in the next iteration. This leads to repeated
allocation and freeing of large numbers of hugepages, especially when
the original value is high.
Additionally, with set -e, failures in earlier cleanup steps (e.g.,
rmdir or umount returning EBUSY while background activity is still
ongoing) can cause the script to exit before restoring the original
value, leaving the system in a modified state.
Introduce a trap on EXIT, INT, and TERM to restore the original
nr_hugepages value once at script termination. This avoids
unnecessary allocation churn and ensures the original value
is reliably restored on all exit paths.
Fixes: 7d695b1c3695b ("selftests/mm: save and restore nr_hugepages value")
Acked-by: Zi Yan <ziy@nvidia.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/charge_reserved_hugetlb.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
index 44f4e703deb9..e1945901fd20 100755
--- a/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
+++ b/tools/testing/selftests/mm/charge_reserved_hugetlb.sh
@@ -17,6 +17,7 @@ if ! command -v killall >/dev/null 2>&1; then
fi
nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)
+trap 'echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages' EXIT INT TERM
fault_limit_file=limit_in_bytes
reservation_limit_file=rsvd.limit_in_bytes
@@ -70,7 +71,6 @@ function cleanup() {
if [[ -e $cgroup_path/hugetlb_cgroup_test2 ]]; then
rmdir $cgroup_path/hugetlb_cgroup_test2
fi
- echo 0 >/proc/sys/vm/nr_hugepages
echo CLEANUP DONE
}
@@ -599,4 +599,3 @@ if [[ $do_umount ]]; then
rmdir $cgroup_path
fi
-echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
--
2.52.0
^ permalink raw reply related
* [PATCH v7 03/13] selftests/mm: restore default nr_hugepages value via exit trap in hugetlb_reparenting_test.sh
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The test modifies nr_hugepages during execution and restores it from
cleanup() and again reconfigure it setup, which is invoked multiple
times across test flow. This can lead to repeated
allocation/freeing of hugepages.
With set -e, failures in cleanup (e.g., rmdir/umount) can also
cause early exit before restoring the original value at the end.
Move restoration of the original nr_hugepages value to a trap handler
registered for EXIT, INT, and TERM signals so it is always restored on
all exit paths. This also avoids unnecessary allocation churn across
repeated cleanup/setup cycles.
Fixes: 585a9145886a ("selftests/mm: restore default nr_hugepages value during cleanup in hugetlb_reparenting_test.sh")
Acked-by: Zi Yan <ziy@nvidia.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/hugetlb_reparenting_test.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
index 0dd31892ff67..11f914831146 100755
--- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
+++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
@@ -12,6 +12,8 @@ if [[ $(id -u) -ne 0 ]]; then
fi
nr_hugepgs=$(cat /proc/sys/vm/nr_hugepages)
+trap 'echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages' EXIT INT TERM
+
usage_file=usage_in_bytes
if [[ "$1" == "-cgroup-v2" ]]; then
@@ -56,7 +58,6 @@ function cleanup() {
rmdir "$CGROUP_ROOT"/a/b 2>/dev/null
rmdir "$CGROUP_ROOT"/a 2>/dev/null
rmdir "$CGROUP_ROOT"/test1 2>/dev/null
- echo $nr_hugepgs >/proc/sys/vm/nr_hugepages
set -e
}
@@ -240,4 +241,3 @@ if [[ $do_umount ]]; then
rm -rf $CGROUP_ROOT
fi
-echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages
--
2.52.0
^ permalink raw reply related
* [PATCH v7 05/13] selftests/mm: fix cgroup task placement and drop memory.current checks in hugetlb_reparenting_test.sh
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The test currently moves the calling shell ($$) into the target cgroup
before executing write_to_hugetlbfs. This results in the shell and any
intermediate allocations being charged to the cgroup, introducing noise
and nondeterminism in accounting. It also requires moving the shell back
to the root cgroup after execution.
Spawn a helper process that joins the target cgroup and
exec()'s write_to_hugetlbfs. This ensures that only the workload is
accounted to the cgroup and avoids unintended charging from the shell.
The test currently validates both hugetlb usage and memory.current.
However, memory.current includes internal memcg allocations and
per-CPU batched accounting (MEMCG_CHARGE_BATCH), which are not
synchronized and can vary across systems, leading to
non-deterministic results.
Since hugetlb memory is accounted via hugetlb.<size>.current,
memory.current is not a reliable indicator here. Drop memory.current
checks and rely only on hugetlb controller statistics for stable
and accurate validation.
Fixes: 29750f71a9b4 ("hugetlb_cgroup: add hugetlb_cgroup reservation tests")
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
.../selftests/mm/hugetlb_reparenting_test.sh | 42 ++++++++-----------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
index d724b6e45432..95f517c3bd16 100755
--- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
+++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
@@ -105,22 +105,17 @@ function assert_with_retry() {
}
function assert_state() {
- local expected_a="$1"
- local expected_a_hugetlb="$2"
- local expected_b=""
+ local expected_a_hugetlb="$1"
local expected_b_hugetlb=""
- if [ ! -z ${3:-} ] && [ ! -z ${4:-} ]; then
- expected_b="$3"
- expected_b_hugetlb="$4"
+ if [ ! -z ${2:-} ]; then
+ expected_b_hugetlb="$2"
fi
- assert_with_retry "$CGROUP_ROOT/a/memory.$usage_file" "$expected_a"
assert_with_retry \
"$CGROUP_ROOT/a/hugetlb.${MB_DISPLAY}${UNIT}.$usage_file" "$expected_a_hugetlb"
- if [[ -n "$expected_b" && -n "$expected_b_hugetlb" ]]; then
- assert_with_retry "$CGROUP_ROOT/a/b/memory.$usage_file" "$expected_b"
+ if [[ -n "$expected_b_hugetlb" ]]; then
assert_with_retry \
"$CGROUP_ROOT/a/b/hugetlb.${MB_DISPLAY}${UNIT}.$usage_file" "$expected_b_hugetlb"
fi
@@ -154,18 +149,17 @@ write_hugetlbfs() {
local size="$3"
if [[ $cgroup2 ]]; then
- echo $$ >$CGROUP_ROOT/$cgroup/cgroup.procs
+ cg_file="$CGROUP_ROOT/$cgroup/cgroup.procs"
else
echo 0 >$CGROUP_ROOT/$cgroup/cpuset.mems
echo 0 >$CGROUP_ROOT/$cgroup/cpuset.cpus
- echo $$ >"$CGROUP_ROOT/$cgroup/tasks"
- fi
- ./write_to_hugetlbfs -p "$path" -s "$size" -m 0 -o
- if [[ $cgroup2 ]]; then
- echo $$ >$CGROUP_ROOT/cgroup.procs
- else
- echo $$ >"$CGROUP_ROOT/tasks"
+ cg_file="$CGROUP_ROOT/$cgroup/tasks"
fi
+
+ # Spawn helper to join cgroup before exec to ensure correct cgroup accounting
+ bash -c 'echo $$ > "$1"; exec ./write_to_hugetlbfs -p "$2" -s "$3" -m 0 -o' _ \
+ "$cg_file" "$path" "$size" & pid=$!
+ wait "$pid"
echo
}
@@ -203,21 +197,21 @@ if [[ ! $cgroup2 ]]; then
write_hugetlbfs a "$MNT"/test $size
echo Assert memory charged correctly for parent use.
- assert_state 0 $size 0 0
+ assert_state $size 0
write_hugetlbfs a/b "$MNT"/test2 $size
echo Assert memory charged correctly for child use.
- assert_state 0 $(($size * 2)) 0 $size
+ assert_state $(($size * 2)) $size
rmdir "$CGROUP_ROOT"/a/b
echo Assert memory reparent correctly.
- assert_state 0 $(($size * 2))
+ assert_state $(($size * 2))
rm -rf "$MNT"/*
umount "$MNT"
echo Assert memory uncharged correctly.
- assert_state 0 0
+ assert_state 0
cleanup
fi
@@ -231,16 +225,16 @@ echo write
write_hugetlbfs a/b "$MNT"/test2 $size
echo Assert memory charged correctly for child only use.
-assert_state 0 $(($size)) 0 $size
+assert_state $(($size)) $size
rmdir "$CGROUP_ROOT"/a/b
echo Assert memory reparent correctly.
-assert_state 0 $size
+assert_state $size
rm -rf "$MNT"/*
umount "$MNT"
echo Assert memory uncharged correctly.
-assert_state 0 0
+assert_state 0
cleanup
--
2.52.0
^ permalink raw reply related
* [PATCH v7 04/13] selftests/mm: fix hugetlb pathname construction in hugetlb_reparenting_test.sh
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The hugetlb_reparenting_test.sh script constructs hugetlb cgroup
memory interface file names based on the configured huge page size. The
script formats the size only in MB units, which causes mismatches on
systems using larger huge pages where the kernel exposes normalized
units (e.g. "1GB" instead of "1024MB").
As a result, the test fails to locate the corresponding cgroup files
when 1GB huge pages are configured.
Update the script to detect the huge page size and select the
appropriate unit (MB or GB) so that the constructed paths match the
kernel's hugetlb controller naming.
Also print an explicit "Fail" message when a test failure occurs to
improve result visibility.
Fixes: e487a5d513cb ("selftest/mm: make hugetlb_reparenting_test tolerant to async reparenting")
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
.../selftests/mm/hugetlb_reparenting_test.sh | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
index 11f914831146..d724b6e45432 100755
--- a/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
+++ b/tools/testing/selftests/mm/hugetlb_reparenting_test.sh
@@ -48,6 +48,13 @@ function get_machine_hugepage_size() {
}
MB=$(get_machine_hugepage_size)
+if (( MB >= 1024 )); then
+ UNIT="GB"
+ MB_DISPLAY=$((MB / 1024))
+else
+ UNIT="MB"
+ MB_DISPLAY=$MB
+fi
function cleanup() {
echo cleanup
@@ -88,6 +95,7 @@ function assert_with_retry() {
if [[ $elapsed -ge $timeout ]]; then
echo "actual = $((${actual%% *} / 1024 / 1024)) MB"
echo "expected = $((${expected%% *} / 1024 / 1024)) MB"
+ echo FAIL
cleanup
exit 1
fi
@@ -108,11 +116,13 @@ function assert_state() {
fi
assert_with_retry "$CGROUP_ROOT/a/memory.$usage_file" "$expected_a"
- assert_with_retry "$CGROUP_ROOT/a/hugetlb.${MB}MB.$usage_file" "$expected_a_hugetlb"
+ assert_with_retry \
+ "$CGROUP_ROOT/a/hugetlb.${MB_DISPLAY}${UNIT}.$usage_file" "$expected_a_hugetlb"
if [[ -n "$expected_b" && -n "$expected_b_hugetlb" ]]; then
assert_with_retry "$CGROUP_ROOT/a/b/memory.$usage_file" "$expected_b"
- assert_with_retry "$CGROUP_ROOT/a/b/hugetlb.${MB}MB.$usage_file" "$expected_b_hugetlb"
+ assert_with_retry \
+ "$CGROUP_ROOT/a/b/hugetlb.${MB_DISPLAY}${UNIT}.$usage_file" "$expected_b_hugetlb"
fi
}
--
2.52.0
^ permalink raw reply related
* [PATCH v7 06/13] selftests/mm: size tmpfs according to PMD page size in split_huge_page_test
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The split_file_backed_thp() test mounts a tmpfs with a fixed size of
"4m". This works on systems with smaller PMD page sizes,
but fails on configurations where the PMD huge page size is
larger (e.g. 16MB).
On such systems, the fixed 4MB tmpfs is insufficient to allocate even
a single PMD-sized THP, causing the test to fail.
Fix this by sizing the tmpfs dynamically based on the runtime
pmd_pagesize, allocating space for two PMD-sized pages.
Before patch:
running ./split_huge_page_test /tmp/xfs_dir_YTrI5E
--------------------------------------------------
TAP version 13
1..55
ok 1 Split zero filled huge pages successful
ok 2 Split huge pages to order 0 successful
ok 3 Split huge pages to order 2 successful
ok 4 Split huge pages to order 3 successful
ok 5 Split huge pages to order 4 successful
ok 6 Split huge pages to order 5 successful
ok 7 Split huge pages to order 6 successful
ok 8 Split huge pages to order 7 successful
ok 9 Split PTE-mapped huge pages successful
Please enable pr_debug in split_huge_pages_in_file() for more info.
Failed to write data to testing file: Success (0)
Bail out! Error occurred
Planned tests != run tests (55 != 9)
Totals: pass:9 fail:0 xfail:0 xpass:0 skip:0 error:0
[FAIL]
After patch:
running ./split_huge_page_test /tmp/xfs_dir_bMvj6o
--------------------------------------------------
TAP version 13
1..55
ok 1 Split zero filled huge pages successful
ok 2 Split huge pages to order 0 successful
ok 3 Split huge pages to order 2 successful
ok 4 Split huge pages to order 3 successful
ok 5 Split huge pages to order 4 successful
ok 6 Split huge pages to order 5 successful
ok 7 Split huge pages to order 6 successful
ok 8 Split huge pages to order 7 successful
ok 9 Split PTE-mapped huge pages successful
Please enable pr_debug in split_huge_pages_in_file() for more info.
Please check dmesg for more information
ok 10 File-backed THP split to order 0 test done
Please enable pr_debug in split_huge_pages_in_file() for more info.
Please check dmesg for more information
ok 11 File-backed THP split to order 1 test done
Please enable pr_debug in split_huge_pages_in_file() for more info.
Please check dmesg for more information
ok 12 File-backed THP split to order 2 test done
...
ok 55 Split PMD-mapped pagecache folio to order 7 at
in-folio offset 128 passed
Totals: pass:55 fail:0 xfail:0 xpass:0 skip:0 error:0
[PASS]
ok 1 split_huge_page_test /tmp/xfs_dir_bMvj6o
Fixes: fbe37501b252 ("mm: huge_memory: debugfs for file-backed THP split")
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/split_huge_page_test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index 50c80ceb4988..4066de6e8ae0 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -470,6 +470,8 @@ static void split_file_backed_thp(int order)
char tmpfs_template[] = "/tmp/thp_split_XXXXXX";
const char *tmpfs_loc = mkdtemp(tmpfs_template);
char testfile[INPUT_MAX];
+ unsigned long size = 2 * pmd_pagesize;
+ char opts[64];
ssize_t num_written, num_read;
char *file_buf1, *file_buf2;
uint64_t pgoff_start = 0, pgoff_end = 1024;
@@ -489,7 +491,8 @@ static void split_file_backed_thp(int order)
file_buf1[i] = (char)i;
memset(file_buf2, 0, pmd_pagesize);
- status = mount("tmpfs", tmpfs_loc, "tmpfs", 0, "huge=always,size=4m");
+ snprintf(opts, sizeof(opts), "huge=always,size=%lu", size);
+ status = mount("tmpfs", tmpfs_loc, "tmpfs", 0, opts);
if (status)
ksft_exit_fail_msg("Unable to create a tmpfs for testing\n");
--
2.52.0
^ permalink raw reply related
* [PATCH v7 07/13] selftests/mm: free dynamically allocated PMD-sized buffers in split_huge_page_test
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
Dynamically allocated buffers of PMD size for file-backed
THP operations (file_buf1 and file_buf2) were not freed on
the success path and some failure paths. Since the
function is called repeatedly in a loop for each split order,
this can cause significant memory leaks.
On architectures with large PMD sizes, repeated leaks
could exhaust system memory and trigger the OOM killer
during test execution.
Ensure all allocated buffers are freed to maintain
stable repeated test runs.
Fixes: 035a112e5fd5 ("selftests/mm: make file-backed THP split work by writing PMD size data")
Reviewed-by: Zi Yan <ziy@nvidia.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
.../selftests/mm/split_huge_page_test.c | 22 ++++++++++++++-----
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index 4066de6e8ae0..7a8b64cf4aad 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -473,12 +473,15 @@ static void split_file_backed_thp(int order)
unsigned long size = 2 * pmd_pagesize;
char opts[64];
ssize_t num_written, num_read;
- char *file_buf1, *file_buf2;
+ char *file_buf1 = NULL, *file_buf2 = NULL;
uint64_t pgoff_start = 0, pgoff_end = 1024;
int i;
ksft_print_msg("Please enable pr_debug in split_huge_pages_in_file() for more info.\n");
+ if (!tmpfs_loc)
+ ksft_exit_fail_msg("mkdtemp failed\n");
+
file_buf1 = (char *)malloc(pmd_pagesize);
file_buf2 = (char *)malloc(pmd_pagesize);
@@ -494,8 +497,10 @@ static void split_file_backed_thp(int order)
snprintf(opts, sizeof(opts), "huge=always,size=%lu", size);
status = mount("tmpfs", tmpfs_loc, "tmpfs", 0, opts);
- if (status)
- ksft_exit_fail_msg("Unable to create a tmpfs for testing\n");
+ if (status) {
+ ksft_print_msg("Unable to create a tmpfs for testing\n");
+ goto out;
+ }
status = snprintf(testfile, INPUT_MAX, "%s/thp_file", tmpfs_loc);
if (status >= INPUT_MAX) {
@@ -547,10 +552,13 @@ static void split_file_backed_thp(int order)
status = umount(tmpfs_loc);
if (status) {
- rmdir(tmpfs_loc);
- ksft_exit_fail_msg("Unable to umount %s\n", tmpfs_loc);
+ ksft_print_msg("Unable to umount %s\n", tmpfs_loc);
+ goto out;
}
+ free(file_buf1);
+ free(file_buf2);
+
status = rmdir(tmpfs_loc);
if (status)
ksft_exit_fail_msg("cannot remove tmp dir: %s\n", strerror(errno));
@@ -563,8 +571,10 @@ static void split_file_backed_thp(int order)
close(fd);
cleanup:
umount(tmpfs_loc);
- rmdir(tmpfs_loc);
out:
+ free(file_buf1);
+ free(file_buf2);
+ rmdir(tmpfs_loc);
ksft_exit_fail_msg("Error occurred\n");
}
--
2.52.0
^ permalink raw reply related
* [PATCH v7 08/13] selftest/mm: register existing mapping with userfaultfd in hugetlb-mremap
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
Previously, register_region_with_uffd() created a new anonymous
mapping and overwrote the address supplied by the caller before
registering the range with userfaultfd.
As a result, userfaultfd was applied to an unrelated anonymous mapping
instead of the hugetlb region used by the test.
Remove the extra mmap() and register the caller-provided address range
directly using UFFDIO_REGISTER_MODE_MISSING, so that faults are
generated for the hugetlb mapping used by the test.
This ensures userfaultfd operates on the actual hugetlb test region and
validates the expected fault handling.
Before patch:
running ./hugetlb-mremap
-------------------------
TAP version 13
1..1
Map haddr: Returned address is 0x7eaa40000000
Map daddr: Returned address is 0x7daa40000000
Map vaddr: Returned address is 0x7faa40000000
Address returned by mmap() = 0x7fff9d000000
Mremap: Returned address is 0x7faa40000000
First hex is 0
First hex is 3020100
ok 1 Read same data
Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
[PASS]
ok 1 hugetlb-mremap
After patch:
running ./hugetb-mremap
-------------------------
TAP version 13
1..1
Map haddr: Returned address is 0x7eaa40000000
Map daddr: Returned address is 0x7daa40000000
Map vaddr: Returned address is 0x7faa40000000
Registered memory at address 0x7eaa40000000 with userfaultfd
Mremap: Returned address is 0x7faa40000000
First hex is 0
First hex is 3020100
ok 1 Read same data
Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
[PASS]
ok 1 hugetlb-mremap
Fixes: 12b613206474 ("mm, hugepages: add hugetlb vma mremap() test")
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/hugetlb-mremap.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/tools/testing/selftests/mm/hugetlb-mremap.c b/tools/testing/selftests/mm/hugetlb-mremap.c
index d239905790dd..00b4c2cc95a6 100644
--- a/tools/testing/selftests/mm/hugetlb-mremap.c
+++ b/tools/testing/selftests/mm/hugetlb-mremap.c
@@ -86,25 +86,14 @@ static void register_region_with_uffd(char *addr, size_t len)
if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)
ksft_exit_fail_msg("ioctl-UFFDIO_API: %s\n", strerror(errno));
- /* Create a private anonymous mapping. The memory will be
- * demand-zero paged--that is, not yet allocated. When we
- * actually touch the memory, it will be allocated via
- * the userfaultfd.
- */
-
- addr = mmap(NULL, len, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- if (addr == MAP_FAILED)
- ksft_exit_fail_msg("mmap: %s\n", strerror(errno));
-
- ksft_print_msg("Address returned by mmap() = %p\n", addr);
-
- /* Register the memory range of the mapping we just created for
- * handling by the userfaultfd object. In mode, we request to track
- * missing pages (i.e., pages that have not yet been faulted in).
+ /* Register the passed memory range for handling by the userfaultfd object.
+ * In mode, we request to track missing pages
+ * (i.e., pages that have not yet been faulted in).
*/
if (uffd_register(uffd, addr, len, true, false, false))
ksft_exit_fail_msg("ioctl-UFFDIO_REGISTER: %s\n", strerror(errno));
+
+ ksft_print_msg("Registered memory at address %p with userfaultfd\n", addr);
}
int main(int argc, char *argv[])
--
2.52.0
^ permalink raw reply related
* [PATCH v7 09/13] selftests/mm: ensure destination is hugetlb-backed in hugetlb-mremap
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The hugetlb-mremap selftest reserves the destination address using a
anonymous base-page mapping before calling mremap() with MREMAP_FIXED,
while the source region is hugetlb-backed.
When remapping a hugetlb mapping into a base-page VMA may fail with:
mremap: Device or resource busy
This is observed on powerpc hash MMU systems where slice constraints
and page size incompatibilities prevent the remap.
Ensure the destination region is created using MAP_HUGETLB so that both
source and destination VMAs are hugetlb-backed and compatible.
Update the FLAGS macro to include MAP_HUGETLB | MAP_SHARED
so that both mappings are hugetlb-backed and compatible.
Also use the macro for the mmap() calls to avoid repeating
the flag combination.
This ensures the test reliably exercises hugetlb mremap instead of
failing due to VMA type mismatch.
Fixes: 12b613206474 ("mm, hugepages: add hugetlb vma mremap() test")
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/hugetlb-mremap.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/mm/hugetlb-mremap.c b/tools/testing/selftests/mm/hugetlb-mremap.c
index 00b4c2cc95a6..ed3d92e862d8 100644
--- a/tools/testing/selftests/mm/hugetlb-mremap.c
+++ b/tools/testing/selftests/mm/hugetlb-mremap.c
@@ -32,7 +32,7 @@
#define MB_TO_BYTES(x) (x * 1024 * 1024)
#define PROTECTION (PROT_READ | PROT_WRITE | PROT_EXEC)
-#define FLAGS (MAP_SHARED | MAP_ANONYMOUS)
+#define FLAGS (MAP_HUGETLB | MAP_SHARED)
static void check_bytes(char *addr)
{
@@ -132,23 +132,20 @@ int main(int argc, char *argv[])
/* mmap to a PUD aligned address to hopefully trigger pmd sharing. */
unsigned long suggested_addr = 0x7eaa40000000;
- void *haddr = mmap((void *)suggested_addr, length, PROTECTION,
- MAP_HUGETLB | MAP_SHARED | MAP_POPULATE, fd, 0);
+ void *haddr = mmap((void *)suggested_addr, length, PROTECTION, FLAGS, fd, 0);
ksft_print_msg("Map haddr: Returned address is %p\n", haddr);
if (haddr == MAP_FAILED)
ksft_exit_fail_msg("mmap1: %s\n", strerror(errno));
/* mmap again to a dummy address to hopefully trigger pmd sharing. */
suggested_addr = 0x7daa40000000;
- void *daddr = mmap((void *)suggested_addr, length, PROTECTION,
- MAP_HUGETLB | MAP_SHARED | MAP_POPULATE, fd, 0);
+ void *daddr = mmap((void *)suggested_addr, length, PROTECTION, FLAGS, fd, 0);
ksft_print_msg("Map daddr: Returned address is %p\n", daddr);
if (daddr == MAP_FAILED)
ksft_exit_fail_msg("mmap3: %s\n", strerror(errno));
suggested_addr = 0x7faa40000000;
- void *vaddr =
- mmap((void *)suggested_addr, length, PROTECTION, FLAGS, -1, 0);
+ void *vaddr = mmap((void *)suggested_addr, length, PROTECTION, FLAGS, fd, 0);
ksft_print_msg("Map vaddr: Returned address is %p\n", vaddr);
if (vaddr == MAP_FAILED)
ksft_exit_fail_msg("mmap2: %s\n", strerror(errno));
--
2.52.0
^ permalink raw reply related
* [PATCH v7 10/13] selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
The uffd-wp-mremap test requires the UFFD_FEATURE_PAGEFAULT_FLAG_WP
capability. On systems where userfaultfd write-protect is
not supported, uffd_register() fails and the test reports failures.
Check for the required feature at startup and skip the test when the
UFFD_FEATURE_PAGEFAULT_FLAG_WP capability is not present,
preventing false failures on unsupported configurations.
Before patch:
running ./uffd-wp-mremap
------------------------
[INFO] detected THP size: 256 KiB
[INFO] detected THP size: 512 KiB
[INFO] detected THP size: 1024 KiB
[INFO] detected THP size: 2048 KiB
[INFO] detected hugetlb page size: 2048 KiB
[INFO] detected hugetlb page size: 1048576 KiB
1..24
[RUN] test_one_folio(size=65536, private=false, swapout=false,
hugetlb=false)
not ok 1 uffd_register() failed
[RUN] test_one_folio(size=65536, private=true, swapout=false,
hugetlb=false)
not ok 2 uffd_register() failed
[RUN] test_one_folio(size=65536, private=false, swapout=true,
hugetlb=false)
not ok 3 uffd_register() failed
[RUN] test_one_folio(size=65536, private=true, swapout=true,
hugetlb=false)
not ok 4 uffd_register() failed
[RUN] test_one_folio(size=262144, private=false, swapout=false,
hugetlb=false)
not ok 5 uffd_register() failed
[RUN] test_one_folio(size=524288, private=false, swapout=false,
hugetlb=false)
not ok 6 uffd_register() failed
.
.
.
Bail out! 24 out of 24 tests failed
Totals: pass:0 fail:24 xfail:0 xpass:0 skip:0 error:0
[FAIL]
not ok 1 uffd-wp-mremap # exit=1
After patch:
running ./uffd-wp-mremap
------------------------
1..0 # SKIP uffd-wp feature not supported
[SKIP]
ok 1 uffd-wp-mremap # SKIP
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/uffd-wp-mremap.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/testing/selftests/mm/uffd-wp-mremap.c b/tools/testing/selftests/mm/uffd-wp-mremap.c
index 90ac410c6c6f..c973d6722720 100644
--- a/tools/testing/selftests/mm/uffd-wp-mremap.c
+++ b/tools/testing/selftests/mm/uffd-wp-mremap.c
@@ -19,6 +19,17 @@ static size_t thpsizes[20];
static int nr_hugetlbsizes;
static unsigned long hugetlbsizes[10];
+static void check_uffd_wp_feature_supported(void)
+{
+ uint64_t features = 0;
+
+ if (uffd_get_features(&features))
+ ksft_exit_skip("failed to get available features (%d)\n", errno);
+
+ if (!(features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
+ ksft_exit_skip("uffd-wp feature not supported\n");
+}
+
static int detect_thp_sizes(size_t sizes[], int max)
{
int count = 0;
@@ -338,6 +349,8 @@ int main(int argc, char **argv)
hugepage_save_settings(true, true);
+ check_uffd_wp_feature_supported();
+
pagesize = getpagesize();
nr_thpsizes = detect_thp_sizes(thpsizes, ARRAY_SIZE(thpsizes));
nr_hugetlbsizes = hugetlb_setup(1, hugetlbsizes, ARRAY_SIZE(hugetlbsizes));
--
2.52.0
^ permalink raw reply related
* [PATCH v7 11/13] selftests/mm: skip uffd-stress test when nr_pages_per_cpu is zero
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
uffd-stress currently fails when the computed nr_pages_per_cpu
evaluates to zero:
nr_pages_per_cpu = bytes / page_size / nr_parallel
This can occur on systems with large hugepage sizes (e.g. 1GB) and a
high number of CPUs, where the total allocated memory is sufficient
overall but not enough to provide at least one page per cpu.
In such cases, the failure is due to insufficient test resources
rather than incorrect kernel behaviour. Update the test
to treat this condition as a test skip instead of reporting an error.
Fixes: db0f1c138f18 ("selftests/mm: print some details when uffd-stress gets bad params")
Acked-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/uffd-stress.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/mm/uffd-stress.c b/tools/testing/selftests/mm/uffd-stress.c
index 43cc79590136..39e13e2078a9 100644
--- a/tools/testing/selftests/mm/uffd-stress.c
+++ b/tools/testing/selftests/mm/uffd-stress.c
@@ -489,9 +489,9 @@ int main(int argc, char **argv)
gopts->nr_pages_per_cpu = bytes / gopts->page_size / gopts->nr_parallel;
if (!gopts->nr_pages_per_cpu) {
- _err("pages_per_cpu = 0, cannot test (%lu / %lu / %lu)",
- bytes, gopts->page_size, gopts->nr_parallel);
- usage();
+ ksft_print_msg("pages_per_cpu = 0, cannot test (%zu / %lu / %lu)\n",
+ bytes, gopts->page_size, gopts->nr_parallel);
+ return KSFT_SKIP;
}
bounces = atoi(argv[3]);
--
2.52.0
^ permalink raw reply related
* [PATCH v7 12/13] selftests/mm: move hwpoison setup into run_test() and silence modprobe output for memory-failure category
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
run_vmtests.sh contains special handling to ensure the hwpoison_inject
module is available for the memory-failure tests. This logic was
implemented outside of run_test(), making the setup category-specific
but managed globally.
Move the hwpoison_inject handling into run_test() and restrict it
to the memory-failure category so that:
1. the module is checked and loaded only when memory-failure tests run,
2. the test is skipped if the module or the debugfs interface
(/sys/kernel/debug/hwpoison/) is not available.
3. the module is unloaded after the test if it was loaded by the script.
This localizes category-specific setup and makes the test flow
consistent with other per-category preparations.
While updating this logic, fix the module availability check.
The script previously used:
modprobe -R hwpoison_inject
The -R option prints the resolved module name to stdout, causing every
run to print:
hwpoison_inject
in the test output, even when no action is required, introducing
unnecessary noise.
Replace this with:
modprobe -n hwpoison_inject
which verifies that the module is loadable without producing output,
keeping the selftest logs clean and consistent.
Also, ensure that skipped tests do not override a previously recorded
failure. A skipped test currently sets exitcode to ksft_skip even if a
prior test has failed, which can mask failures in the final exit status.
Update the logic to only set exitcode to ksft_skip when no failure has
been recorded.
Fixes: ff4ef2fbd101 ("selftests/mm: add memory failure anonymous page test")
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/run_vmtests.sh | 62 +++++++++++++++--------
1 file changed, 41 insertions(+), 21 deletions(-)
diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
index 043aa3ed2596..8c296dedf047 100755
--- a/tools/testing/selftests/mm/run_vmtests.sh
+++ b/tools/testing/selftests/mm/run_vmtests.sh
@@ -180,6 +180,9 @@ pretty_name() {
# Usage: run_test [test binary] [arbitrary test arguments...]
run_test() {
if test_selected ${CATEGORY}; then
+ local skip=0
+ local LOADED_HWPOISON_INJECT_MOD=0
+
# On memory constrainted systems some tests can fail to allocate hugepages.
# perform some cleanup before the test for a higher success rate.
if [ ${CATEGORY} == "thp" -o ${CATEGORY} == "hugetlb" ]; then
@@ -194,13 +197,45 @@ run_test() {
fi
fi
+ # Ensure hwpoison_inject is available for memory-failure tests
+ if [ "${CATEGORY}" = "memory-failure" ]; then
+ # Try to load hwpoison_inject if not present.
+ HWPOISON_DIR=/sys/kernel/debug/hwpoison/
+ if [ ! -d "$HWPOISON_DIR" ]; then
+ if ! modprobe -n hwpoison_inject > /dev/null 2>&1; then
+ echo "Module hwpoison_inject not found, skipping..." \
+ | tap_prefix
+ skip=1
+ else
+ modprobe hwpoison_inject > /dev/null 2>&1
+ LOADED_HWPOISON_INJECT_MOD=1
+ if [ ! -d "$HWPOISON_DIR" ]; then
+ echo "hwpoison debugfs interface not present" \
+ | tap_prefix
+ skip=1
+ fi
+ fi
+ fi
+
+ fi
+
local test=$(pretty_name "$*")
local title="running $*"
local sep=$(echo -n "$title" | tr "[:graph:][:space:]" -)
printf "%s\n%s\n%s\n" "$sep" "$title" "$sep" | tap_prefix
- ("$@" 2>&1) | tap_prefix
- local ret=${PIPESTATUS[0]}
+ if [ $skip -eq 1 ]; then
+ local ret=$ksft_skip
+ else
+ ("$@" 2>&1) | tap_prefix
+ local ret=${PIPESTATUS[0]}
+ fi
+
+ # Unload hwpoison_inject if we loaded it
+ if [ "${LOADED_HWPOISON_INJECT_MOD}" = "1" ]; then
+ modprobe -r hwpoison_inject > /dev/null 2>&1
+ fi
+
count_total=$(( count_total + 1 ))
if [ $ret -eq 0 ]; then
count_pass=$(( count_pass + 1 ))
@@ -210,7 +245,9 @@ run_test() {
count_skip=$(( count_skip + 1 ))
echo "[SKIP]" | tap_prefix
echo "ok ${count_total} ${test} # SKIP" | tap_output
- exitcode=$ksft_skip
+ if [ $exitcode -eq 0 ]; then
+ exitcode=$ksft_skip
+ fi
else
count_fail=$(( count_fail + 1 ))
echo "[FAIL]" | tap_prefix
@@ -422,24 +459,7 @@ CATEGORY="page_frag" run_test ./test_page_frag.sh nonaligned
CATEGORY="rmap" run_test ./rmap
-# Try to load hwpoison_inject if not present.
-HWPOISON_DIR=/sys/kernel/debug/hwpoison/
-if [ ! -d "$HWPOISON_DIR" ]; then
- if ! modprobe -q -R hwpoison_inject; then
- echo "Module hwpoison_inject not found, skipping..."
- else
- modprobe hwpoison_inject > /dev/null 2>&1
- LOADED_MOD=1
- fi
-fi
-
-if [ -d "$HWPOISON_DIR" ]; then
- CATEGORY="memory-failure" run_test ./memory-failure
-fi
-
-if [ -n "${LOADED_MOD}" ]; then
- modprobe -r hwpoison_inject > /dev/null 2>&1
-fi
+CATEGORY="memory-failure" run_test ./memory-failure
echo "SUMMARY: PASS=${count_pass} SKIP=${count_skip} FAIL=${count_fail}" | tap_prefix
echo "1..${count_total}" | tap_output
--
2.52.0
^ permalink raw reply related
* [PATCH v7 13/13] selftests/mm: clarify alternate unmapping in compaction_test
From: Sayali Patil @ 2026-05-21 6:47 UTC (permalink / raw)
To: Andrew Morton, Shuah Khan, linux-mm, linux-kernel,
linux-kselftest, Ritesh Harjani
Cc: David Hildenbrand, Zi Yan, Michal Hocko, Oscar Salvador,
Lorenzo Stoakes, Dev Jain, Liam.Howlett, linuxppc-dev, Miaohe Lin,
Venkat Rao Bagalkote, Sayali Patil
In-Reply-To: <cover.1779296493.git.sayalip@linux.ibm.com>
Add a comment explaining that every other entry in the list is
unmapped to intentionally create fragmentation with
locked pages before invoking check_compaction().
Fixes: bd67d5c15cc1 ("Test compaction of mlocked memory")
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
---
tools/testing/selftests/mm/compaction_test.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
index de0633f9a7e5..5b582588e015 100644
--- a/tools/testing/selftests/mm/compaction_test.c
+++ b/tools/testing/selftests/mm/compaction_test.c
@@ -181,6 +181,9 @@ int main(int argc, char **argv)
mem_fragmentable_MB -= MAP_SIZE_MB;
}
+ /* Unmap every other entry in the list to create fragmentation with
+ * locked pages before invoking check_compaction().
+ */
for (entry = list; entry != NULL; entry = entry->next) {
munmap(entry->map, MAP_SIZE);
if (!entry->next)
--
2.52.0
^ permalink raw reply related
* Re: [PATCH V5 1/2] powerpc tools perf: Initialize error code in auxtrace_record_init function
From: Athira Rajeev @ 2026-05-21 7:31 UTC (permalink / raw)
To: Namhyung Kim, Arnaldo Carvalho de Melo, Ian Rogers, Adrian Hunter
Cc: acme, jolsa, adrian.hunter, mpetlan, tmricht, maddy, irogers,
linux-perf-users, linuxppc-dev, hbathini, Tejas.Manhas1,
Tanushree.Shah, shivani
In-Reply-To: <afwtl1zodrSUpK7n@z2>
> On 7 May 2026, at 11:43 AM, Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Mon, May 04, 2026 at 08:43:20PM +0530, Athira Rajeev wrote:
>> perf trace record fails some cases in powerpc
>>
>> # ./perf test "perf trace record and replay"
>> 128: perf trace record and replay : FAILED!
>>
>> # ./perf trace record sleep 1
>> # echo $?
>> 32
>>
>> This is happening because of non-zero err value from
>> auxtrace_record__init() function.
>>
>> static int record__auxtrace_init(struct record *rec)
>> {
>> int err;
>>
>> if ((rec->opts.auxtrace_snapshot_opts || rec->opts.auxtrace_sample_opts)
>> && record__threads_enabled(rec)) {
>> pr_err("AUX area tracing options are not available in parallel streaming mode.\n");
>> return -EINVAL;
>> }
>>
>> if (!rec->itr) {
>> rec->itr = auxtrace_record__init(rec->evlist, &err);
>> if (err)
>> return err;
>> }
>>
>> Here "int err" is not initialised. The code expects "err" to be set
>> from auxtrace_record__init() function.
>>
>> Update auxtrace_record__init() in arch/powerpc/util/auxtrace.c to clear
>> err value in the beginning.
>>
>> - Clear err value in beginning of function. Any fail later will
>> set appropriate return code to err.
>> - Even if we haven't found any event for auxtrace, perf record
>> should continue for other events. NULL return
>> will indicate that there is no auxtrace record initialized.
>> - Not having "err" set here will affect monitoring of other events
>> also because perf record will fail seeing random value in err.
>>
>> Set err to -EINVAL before invoking auxtrace_record__init() in
>> builtin-record.c
>>
>> With the fix,
>>
>> # ./perf trace record sleep 1
>> [ perf record: Woken up 2 times to write data ]
>> [ perf record: Captured and wrote 0.033 MB perf.data (228 samples) ]
>>
>> Fixes: 1dbfaf94cf66 ("perf powerpc: Add basic CONFIG_AUXTRACE support for VPA pmu on powerpc")
>> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
>
> For both patches,
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> Thanks,
> Namhyung
>
Hi,
Can we please have this pulled in, if the patches looks fine ?
Thanks
Athira
>> ---
>> Changelog:
>> v4:
>> Added Reviewed-by from Adrian
>>
>> v1 -> v2
>> Addressed review comment from Adrian:
>> - Set err to -EINVAL before invoking auxtrace_record__init() in
>> builtin-record.c
>> - Added kernel-doc to auxtrace_record__init() in tools/perf/util/auxtrace.c
>> Addressed review comment from Namhyung:
>> - Added fixes tag
>>
>> tools/perf/arch/powerpc/util/auxtrace.c | 6 ++++++
>> tools/perf/builtin-record.c | 1 +
>> 2 files changed, 7 insertions(+)
>>
>> diff --git a/tools/perf/arch/powerpc/util/auxtrace.c b/tools/perf/arch/powerpc/util/auxtrace.c
>> index e39deff6c857..4600a1661b4f 100644
>> --- a/tools/perf/arch/powerpc/util/auxtrace.c
>> +++ b/tools/perf/arch/powerpc/util/auxtrace.c
>> @@ -71,6 +71,12 @@ struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
>> struct evsel *pos;
>> int found = 0;
>>
>> + /*
>> + * Set err value to zero here. Any fail later
>> + * will set appropriate return code to err.
>> + */
>> + *err = 0;
>> +
>> evlist__for_each_entry(evlist, pos) {
>> if (strstarts(pos->name, "vpa_dtl")) {
>> found = 1;
>> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
>> index 4a5eba498c02..708825747af5 100644
>> --- a/tools/perf/builtin-record.c
>> +++ b/tools/perf/builtin-record.c
>> @@ -865,6 +865,7 @@ static int record__auxtrace_init(struct record *rec)
>> }
>>
>> if (!rec->itr) {
>> + err = -EINVAL;
>> rec->itr = auxtrace_record__init(rec->evlist, &err);
>> if (err)
>> return err;
>> --
>> 2.47.3
^ permalink raw reply
* Re: [PATCH V3] tools/perf/tests: Update test_adding_kernel.sh to handle proper debuginfo check
From: Athira Rajeev @ 2026-05-21 8:31 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: jolsa, adrian.hunter, mpetlan, tmricht, maddy, irogers,
linux-perf-users, linuxppc-dev, hbathini, Tejas.Manhas1,
Tanushree.Shah, Shivani.Nittor, Venkat
In-Reply-To: <AEEE2C46-8D1E-442E-B5A9-7B53E681E69B@linux.ibm.com>
> On 29 Apr 2026, at 7:01 PM, Venkat <venkat88@linux.ibm.com> wrote:
>
>
>
>> On 24 Apr 2026, at 10:54 PM, Athira Rajeev <atrajeev@linux.ibm.com> wrote:
>>
>> Perf test perftool-testsuite_probe fails as below:
>>
>> Regexp not found: "\s*probe:inode_permission(?:_\d+)?\s+\(on inode_permission(?:[:\+][0-9A-Fa-f]+)?@.+\)"
>> -- [ FAIL ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf probe -l (output regexp parsing)
>> -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes
>> Regexp not found: "probe:vfs_mknod"
>> Regexp not found: "probe:vfs_create"
>> Regexp not found: "probe:vfs_rmdir"
>> Regexp not found: "probe:vfs_link"
>> Regexp not found: "probe:vfs_write"
>> -- [ FAIL ] -- perf_probe :: test_adding_kernel :: wildcard adding support (command exitcode + output regexp parsing)
>> Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64"
>> Regexp not found: "in this function|at this address"
>> -- [ FAIL ] -- perf_probe :: test_adding_kernel :: non-existing variable (output regexp parsing)
>> ## [ FAIL ] ## perf_probe :: test_adding_kernel SUMMARY :: 3 failures found
>>
>> Further analysing, the failed testcase is for "test_adding_kernel".
>> If the kernel debuginfo is missing, perf probe fails as below:
>>
>> perf probe -nf --max-probes=512 -a 'vfs_* $params'
>> Failed to find the path for the kernel: No such file or directory
>> Error: Failed to add events.
>>
>> skip_if_no_debuginfo has check to handle whether debuginfo is present
>> and the testcase checks for debuginfo since this :
>> commit 90d32e92011e ("tools/perf: Handle perftool-testsuite_probe
>> testcases fail when kernel debuginfo is not present")
>>
>> Recently a change got added in "tests/shell/lib/probe_vfs_getname.sh"
>> via this another fix:
>> commit 92b664dcefab ("perf test probe_vfs_getname: Skip if no suitable
>> line detected")
>> Since this commit, first add_probe_vfs_getname is used to prevent false
>> failures. And based on return code of add_probe_vfs_getname, skip_if_no_debuginfo
>> is used to skip testcase if debuginfo is present. And this modified other
>> testcases to call add_probe_vfs_getname first and invoke
>> skip_if_no_debuginfo based on return value.
>>
>> The tests in test_adding_kernel.sh which depends on presence of
>> debuginfo are:
>> 1. probe add for inode_permission
>> 2. probe max-probes option using 'vfs_* $params'
>> 3. non-existing variable probing
>>
>> For these tests, probe check for specific line is not required.
>> So call skip_if_no_debuginfo with argument to say if line check is
>> needed. This is to convey to skip_if_no_debuginfo() function
>> that test only needs to check for debuginfo, and not specifically
>> line number. Update skip_if_no_debuginfo to use simple "perf probe"
>> check if test only needs to check for debuginfo. And for other
>> tests which rely on line number, use add_probe_vfs_getname()
>> Update other places which uses skip_if_no_debuginfo to use argument
>> as zero.
>>
>> With the change, verified that only three which required debuginfo only
>> is skipped and others ran successfully. Also tested with debuginfo
>> to make sure tests are not skipped.
>>
>> Reported-by: Tejas Manhas <Tejas.Manhas1@ibm.com>
>> Reviewed-by: Ian Rogers <irogers@google.com>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
>> ---
>
> Tested this patch, by applying on top of mainline, and it fixes the reported issue.
>
> Without this patch:
>
> # ./perf test -v perftool-testsuite_probe
> --- start ---
> test child forked, pid 15772
> Probing start_text
> -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: adding blacklisted function start_text
> -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: listing blacklisted probe (should NOT be listed)
> ## [ PASS ] ## perf_probe :: test_adding_blacklisted SUMMARY
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission ::
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: -a
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: --add
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf list
> Regexp not found: "\s*probe:inode_permission(?:_\d+)?\s+\(on inode_permission(?:[:\+][0-9A-Fa-f]+)?@.+\)"
> -- [ FAIL ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf probe -l (output regexp parsing)
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: using added probe
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: deleting added probe
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing removed probe (should NOT be listed)
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: dry run :: adding probe
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: first probe adding
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (without force)
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (with force)
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: using doubled probe
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes
> Regexp not found: "probe:vfs_mknod"
> Regexp not found: "probe:vfs_create"
> Regexp not found: "probe:vfs_rmdir"
> Regexp not found: "probe:vfs_link"
> Regexp not found: "probe:vfs_write"
> -- [ FAIL ] -- perf_probe :: test_adding_kernel :: wildcard adding support (command exitcode + output regexp parsing)
> Regexp not found: "Failed to find"
> Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64"
> Regexp not found: "in this function|at this address"
> Line did not match any pattern: "The /lib/modules/7.1.0-rc1+/build/vmlinux file has no debug information."
> Line did not match any pattern: "Rebuild with CONFIG_DEBUG_INFO=y, or install an appropriate debuginfo package."
> -- [ FAIL ] -- perf_probe :: test_adding_kernel :: non-existing variable (output regexp parsing)
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: add
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: record
> -- [ PASS ] -- perf_probe :: test_adding_kernel :: function argument probing :: script
> ## [ FAIL ] ## perf_probe :: test_adding_kernel SUMMARY :: 3 failures found
> -- [ SKIP ] -- perf_probe :: test_basic :: help message :: testcase skipped
> -- [ PASS ] -- perf_probe :: test_basic :: usage message
> -- [ PASS ] -- perf_probe :: test_basic :: quiet switch
> ## [ PASS ] ## perf_probe :: test_basic SUMMARY
> -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -a
> -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -d
> -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -L
> -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -V
> -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -F
> -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -l
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -d xxx
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -L foo
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -V foo
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -l
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -F
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -L foo
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -V foo
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -l
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -F
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -V bar
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -l
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -F
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -l
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -F
> -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -l -F
> ## [ PASS ] ## perf_probe :: test_invalid_options SUMMARY
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:10
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:0-10
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:2+10
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func@source.c
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func@source.c:1
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1+1
> -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1-10
> -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:foo
> -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1-foo
> -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1+foo
> -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func;lazy\*pattern
> ## [ PASS ] ## perf_probe :: test_line_semantics SUMMARY
> ---- end(-1) ----
> 137: perftool-testsuite_probe : FAILED!
>
> With This patch:
>
> # ./perf test -v perftool-testsuite_probe
> 137: perftool-testsuite_probe : Ok
>
> Please add below tag.
>
> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
>
> Regards,
> Venkat.
Hi,
Can we please have this pulled in, if the patches looks fine ?
Thanks
Athira
>
>> Changelog:
>> v2 -> v3:
>> - Update other callsites to use "skip_if_no_debuginfo 0"
>> - Use "perf probe -vn --add inode_permission $params"
>>
>> v1 -> v2:
>> - First version used "perf probe -v -L getname_flags" for debuginfo
>> check. This will not catch fail string "Debuginfo-analysis is not
>> supported" which is used in cases when perf is built without dwarf.
>> So use "perf probe -vn add inode_permission" to capture cases when
>> tools built with NO_LIBDWARF=1. This will capture debuginfo missing as
>> well as tool built without dwarf case.
>>
>> .../tests/shell/base_probe/test_adding_kernel.sh | 15 ++++++++++++++-
>> tools/perf/tests/shell/lib/probe_vfs_getname.sh | 13 ++++++++++++-
>> tools/perf/tests/shell/probe_vfs_getname.sh | 7 ++++++-
>> .../shell/record+script_probe_vfs_getname.sh | 7 ++++++-
>> tools/perf/tests/shell/trace+probe_vfs_getname.sh | 7 ++++++-
>> 5 files changed, 44 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
>> index 555a825d55f2..f3db125c8669 100755
>> --- a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
>> +++ b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
>> @@ -23,10 +23,23 @@ TEST_RESULT=0
>> . "$DIR_PATH/../lib/probe_vfs_getname.sh"
>>
>> TEST_PROBE=${TEST_PROBE:-"inode_permission"}
>> +PROBE_NO_LINE_CHECK=1
>>
>> # set NO_DEBUGINFO to skip testcase if debuginfo is not present
>> # skip_if_no_debuginfo returns 2 if debuginfo is not present
>> -skip_if_no_debuginfo
>> +#
>> +# The perf probe checks which depends on presence of debuginfo and
>> +# used in this testcase are:
>> +# 1. probe add for inode_permission
>> +# 2. probe max-probes option using 'vfs_* $params'
>> +# 3. non-existing variable probing
>> +#
>> +# For these tests, probe check for specific line is not
>> +# required ( add_probe_vfs_getname does that ). So call
>> +# skip_if_no_debuginfo with argument as 1. This is to convey
>> +# that test only needs to check for debuginfo, and not specifically
>> +# line number
>> +skip_if_no_debuginfo $PROBE_NO_LINE_CHECK
>> if [ $? -eq 2 ]; then
>> NO_DEBUGINFO=1
>> fi
>> diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
>> index 88cd0e26d5f6..2c5252a38ea1 100644
>> --- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
>> +++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
>> @@ -39,7 +39,18 @@ add_probe_vfs_getname() {
>> }
>>
>> skip_if_no_debuginfo() {
>> - add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2
>> + no_line_check=$1
>> + debug_str="^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)"
>> +
>> + # search for debug_str using simple perf probe if the
>> + # test only needs to check for debuginfo, and not specifically
>> + # line number.
>> + if [ $no_line_check -eq 1 ]; then
>> + perf probe -vn --add 'inode_permission $params' 2>&1 | grep -E -q "$debug_str" && return 2
>> + else
>> + add_probe_vfs_getname -v 2>&1 | grep -E -q "$debug_str" && return 2
>> + fi
>> +
>> return 1
>> }
>>
>> diff --git a/tools/perf/tests/shell/probe_vfs_getname.sh b/tools/perf/tests/shell/probe_vfs_getname.sh
>> index 5fe5682c28ce..b0878f571449 100755
>> --- a/tools/perf/tests/shell/probe_vfs_getname.sh
>> +++ b/tools/perf/tests/shell/probe_vfs_getname.sh
>> @@ -16,8 +16,13 @@ skip_if_no_perf_probe || exit 2
>> add_probe_vfs_getname
>> err=$?
>>
>> +# Invoke skip_if_no_debuginfo with argument as 0,
>> +# since the test needs suitable line number for getname
>> +# along with debuginfo check.
>> +# Argument "1" is used when to convey that test only needs to
>> +# check for debuginfo, and not specifically line number.
>> if [ $err -eq 1 ] ; then
>> - skip_if_no_debuginfo
>> + skip_if_no_debuginfo 0
>> err=$?
>> fi
>>
>> diff --git a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
>> index 002f7037f182..48063fc2b221 100755
>> --- a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
>> +++ b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
>> @@ -38,8 +38,13 @@ perf_script_filenames() {
>> add_probe_vfs_getname
>> err=$?
>>
>> +# Invoke skip_if_no_debuginfo with argument as 0,
>> +# since the test needs suitable line number for getname
>> +# along with debuginfo check.
>> +# Argument "1" is used when to convey that test only needs to
>> +# check for debuginfo, and not specifically line number.
>> if [ $err -eq 1 ] ; then
>> - skip_if_no_debuginfo
>> + skip_if_no_debuginfo 0
>> err=$?
>> fi
>>
>> diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
>> index 7a0b1145d0cd..6833fba12086 100755
>> --- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
>> +++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
>> @@ -28,8 +28,13 @@ trace_open_vfs_getname() {
>> add_probe_vfs_getname
>> err=$?
>>
>> +# Invoke skip_if_no_debuginfo with argument as 0,
>> +# since the test needs suitable line number for getname
>> +# along with debuginfo check.
>> +# Argument "1" is used when to convey that test only needs to
>> +# check for debuginfo, and not specifically line number.
>> if [ $err -eq 1 ] ; then
>> - skip_if_no_debuginfo
>> + skip_if_no_debuginfo 0
>> err=$?
>> fi
>>
>> --
>> 2.47.3
^ permalink raw reply
* Re: [PATCH] tools/perf/sched: Update process names of processes in zombie state for both -s and -S options
From: Athira Rajeev @ 2026-05-21 8:32 UTC (permalink / raw)
To: Namhyung Kim, Ian Rogers, Arnaldo Carvalho de Melo
Cc: jolsa, adrian.hunter, mpetlan, tmricht, maddy, linux-perf-users,
linuxppc-dev, hbathini, Tejas.Manhas1, Tanushree.Shah,
Shivani.Nittor
In-Reply-To: <ae76k1BvfgcYI18K@google.com>
> On 27 Apr 2026, at 11:26 AM, Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Sun, Apr 26, 2026 at 03:09:30PM +0530, Athira Rajeev wrote:
>> In redhat perftool testsuite, observed fail for this test:
>> -- [ FAIL ] -- perf_sched :: test_timehist :: --with-summary (output regexp parsing)
>>
>> This led to analysis of "perf sched timehist" summary options.
>>
>> # perf sched record -a -o ./perf.data -- sleep 0.1
>> This will record using perf sched record
>>
>> perf sched timeliest has two options "-s" and "-S"
>> # perf sched -i ./perf.data timehist -S
>> -S : Captures summary also at the end
>>
>> # perf sched -i ./perf.data timehist -s
>> -s : Captures only summary
>>
>> The test saves -s result which has only summary and compares with
>> summary which comes at the end from -S . Since there is a difference
>> in these two, test fails.
>>
>> Checking the behaviour change in -S and -s results, difference is:
>>
>> rcu_sched[16] 2 4 0.013 0.001 0.003 0.006 33.23 0
>> migration/11[73] 2 1 0.006 0.006 0.006 0.006 0.00 0
>> migration/3[33] 2 1 0.006 0.006 0.006 0.006 0.00 0
>> - :216753[216753] -1 1 0.041 0.041 0.041 0.041 0.00 0
>> + sleep[216753] -1 1 0.041 0.041 0.041 0.041 0.00 0
>> migration/8[58] 2 1 0.005 0.005 0.005 0.005 0.00 0
>> NetworkManager[811] 1 2 0.089 0.028 0.044 0.060 36.06 0
>> migration/13[83] 2 1 0.005 0.005 0.005 0.005 0.00 0
>>
>> Here 216753 is pid for sleep which is a zombie process. This is
>> happening in latest kernel due to an update in "-S" result.
>> In -S, the process name appears in the results "sleep[216753]",
>> where as in the -s, only pid is present in the summary result
>> ":216753[216753]".
>>
>> After commit 39f473f6d0b2 ("perf sched timehist: decode process names
>> of processes in zombie state")
>> for -S option, if process name is using pid, it uses different way to
>> set it. So that we get the process name and not just Pid.
>>
>> This change went in only for timehist_print_sample() function.
>> Add this improvement in generic place so that even -s option (which
>> captures summary) also will have meaningful information.
>>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> Thanks,
> Namhyung
Hi,
Can we please have this pulled in, if the patch looks fine ?
Thanks
Athira
>
>> ---
>> tools/perf/builtin-sched.c | 14 +++++++++-----
>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
>> index 555247568e7a..ee1b89a6af50 100644
>> --- a/tools/perf/builtin-sched.c
>> +++ b/tools/perf/builtin-sched.c
>> @@ -2197,11 +2197,6 @@ static void timehist_print_sample(struct perf_sched *sched,
>> printf(" ");
>> }
>>
>> - if (!thread__comm_set(thread)) {
>> - const char *prev_comm = evsel__strval(evsel, sample, "prev_comm");
>> - thread__set_comm(thread, prev_comm, sample->time);
>> - }
>> -
>> printf(" %-*s ", comm_width, timehist_get_commstr(thread));
>>
>> if (sched->show_prio)
>> @@ -2890,6 +2885,15 @@ static int timehist_sched_change_event(const struct perf_tool *tool,
>> itr->last_thread = NULL;
>> }
>>
>> + /*
>> + * If the process name is not set for the thread, use "prev_comm"
>> + * to set it. Otherwise the sched summary will have just pid information
>> + */
>> + if (!thread__comm_set(thread)) {
>> + const char *prev_comm = evsel__strval(evsel, sample, "prev_comm");
>> + thread__set_comm(thread, prev_comm, sample->time);
>> + }
>> +
>> if (!sched->summary_only)
>> timehist_print_sample(sched, evsel, sample, &al, thread, t, state);
>> }
>> --
>> 2.47.3
^ permalink raw reply
* [PATCH 01/23] mfd: tps6586x: fix OF node refcount
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski, stable
In-Reply-To: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com>
Platform devices created with platform_device_alloc() call
platform_device_release() when the last reference to the device's
kobject is dropped. This function calls of_node_put() unconditionally.
This works fine for devices created with platform_device_register_full()
but users of the split approach (platform_device_alloc() +
platform_device_add()) must bump the reference of the of_node they
assign manually. Add the missing call to of_node_get().
Cc: stable@vger.kernel.org
Fixes: 62f6b0879304 ("tps6586x: Add device tree support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/mfd/tps6586x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 8d5fe2b60bfa550d0aad30acd0820fac354028ac..f5f805446603315ba76ce1fc501c908f1cec0d16 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -397,7 +397,7 @@ static int tps6586x_add_subdevs(struct tps6586x *tps6586x,
pdev->dev.parent = tps6586x->dev;
pdev->dev.platform_data = subdev->platform_data;
- pdev->dev.of_node = subdev->of_node;
+ pdev->dev.of_node = of_node_get(subdev->of_node);
ret = platform_device_add(pdev);
if (ret) {
--
2.47.3
^ permalink raw reply related
* [PATCH 00/23] driver core: count references of the platform device's fwnode, not OF node
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski, stable
I'd like to first apologize for the long, treewide series and an
extensive Cc list but I think it's important to show the big picture and
the end result of this rework.
Platform device core provides helper interfaces for dealing with
dynamically created platform devices. Most users should use
platform_device_register_full() which encapsulates most of the
operations but some modules will want to use the split approach of
calling platform_device_alloc() + platform_device_add() separately for
various reasons.
With many platform devices now using dynamic software nodes as their
primary firmware nodes and with the platform device interface being
extended to also better cover the use-cases of secondary software nodes,
I believe it makes sense to switch to counting the references of all
kinds of firmware nodes.
To that end, I identified all users of platform_device_alloc() that also
assign dev.of_node or dev.fwnode manually. I noticed five cases where
the references are not increased as they should (patches 1-5 fix these
users) and provided three new functions in platform_device.h that now
become the preferred interfaces for assigning firmware nodes to dynamic
platform devices (in line with platform_device_add_data(),
platform_device_add_resources(), etc.). The bulk of the patches in this
series are small driver conversions to port all users to going through
the new functions that now encapsulate the refcount logic. With that
done, the final patch seamlessly switches to counting the references of
all firmware node types.
This effort is prerequisite of removing platform_device_release_full()
and unifying the release path for dynamic platform devices using
unmanaged software nodes.
Merging strategy: First tree patches should go directly into individual
maintainers' trees and land in v7.1 and stable as bug fixes. The
remaining patches touch lots of drivers but the changes are minimal and
unlikely to cause any conflicts. I believe they should be queued in the
driver core tree for v7.2 (possibly on an immutable branch for others to
merge into their trees). If the subsystem maintainers object, the
alternative is to queue the three new helpers for platform devices via
the driver core tree. After v7.2-rc1, I'd resend individual driver
patches to appropriate maintainers and once they're upstream, we can
apply the final platform device change. However this would take three
cycles to complete so my preference is the former solution.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Bartosz Golaszewski (23):
mfd: tps6586x: fix OF node refcount
net: mv643xx: fix OF node refcount
slimbus: qcom-ngd-ctrl: fix OF node refcount
pmdomain: imx: fix OF node refcount
powerpc/powermac: fix OF node refcount
driver core: platform: provide platform_device_set_of_node()
driver core: platform: provide platform_device_set_fwnode()
driver core: platform: provide platform_device_set_of_node_from_dev()
of: platform: use platform_device_set_of_node()
powerpc/powermac: use platform_device_set_of_node()
i2c: pxa-pci: use platform_device_set_of_node()
iommu/fsl: use platform_device_set_of_node()
net: bcmgenet: use platform_device_set_of_node()
pmdomain: imx: use platform_device_set_of_node()
mfd: tps6586: use platform_device_set_of_node()
slimbus: qcom-ngd-ctrl: use platform_device_set_of_node()
net: mv643xx: use platform_device_set_of_node()
drm/xe/i2c: use platform_device_set_fwnode()
platform/surface: gpe: use platform_device_set_fwnode()
usb: chipidea: use platform_device_set_of_node_from_dev()
usb: musb: use platform_device_set_of_node_from_dev()
reset: rzg2l: use platform_device_set_of_node_from_dev()
driver core: platform: count references to all kinds of firmware nodes
arch/powerpc/platforms/powermac/low_i2c.c | 2 +-
drivers/base/platform.c | 56 ++++++++++++++++++++++++++--
drivers/gpu/drm/xe/xe_i2c.c | 2 +-
drivers/i2c/busses/i2c-pxa-pci.c | 3 +-
drivers/iommu/fsl_pamu.c | 7 ++--
drivers/mfd/tps6586x.c | 2 +-
drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 +++--
drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
drivers/of/platform.c | 2 +-
drivers/platform/surface/surface_gpe.c | 2 +-
drivers/pmdomain/imx/gpc.c | 3 +-
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 2 +-
drivers/slimbus/qcom-ngd-ctrl.c | 2 +-
drivers/usb/chipidea/core.c | 2 +-
drivers/usb/musb/jz4740.c | 2 +-
include/linux/platform_device.h | 8 ++++
16 files changed, 84 insertions(+), 23 deletions(-)
---
base-commit: 687da68900cd1a46549f7d9430c7d40346cb86a0
change-id: 20260520-pdev-fwnode-ref-d867836971eb
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply
* [PATCH 02/23] net: mv643xx: fix OF node refcount
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski, stable
In-Reply-To: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com>
Platform devices created with platform_device_alloc() call
platform_device_release() when the last reference to the device's
kobject is dropped. This function calls of_node_put() unconditionally.
This works fine for devices created with platform_device_register_full()
but users of the split approach (platform_device_alloc() +
platform_device_add()) must bump the reference of the of_node they
assign manually. Add the missing call to of_node_get().
Cc: stable@vger.kernel.org
Fixes: 76723bca2802 ("net: mv643xx_eth: add DT parsing support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index f9055b3d6fb102ebc695dce9c6c8321889a78dfa..1881583be5ce2e972fceb14c2b8348280c49ad1d 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2780,7 +2780,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
goto put_err;
}
ppdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
- ppdev->dev.of_node = pnp;
+ ppdev->dev.of_node = of_node_get(pnp);
ret = platform_device_add_resources(ppdev, &res, 1);
if (ret)
--
2.47.3
^ permalink raw reply related
* [PATCH 03/23] slimbus: qcom-ngd-ctrl: fix OF node refcount
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski, stable
In-Reply-To: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com>
Platform devices created with platform_device_alloc() call
platform_device_release() when the last reference to the device's
kobject is dropped. This function calls of_node_put() unconditionally.
This works fine for devices created with platform_device_register_full()
but users of the split approach (platform_device_alloc() +
platform_device_add()) must bump the reference of the of_node they
assign manually. Add the missing call to of_node_get().
Cc: stable@vger.kernel.org
Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/slimbus/qcom-ngd-ctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 1ed6be6e85d2cfc0a2b65a5ae24f666de922c89d..428266949fdd07ac13c5553bded891225c6e1a16 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1542,7 +1542,7 @@ static int of_qcom_slim_ngd_register(struct device *parent,
kfree(ngd);
return ret;
}
- ngd->pdev->dev.of_node = node;
+ ngd->pdev->dev.of_node = of_node_get(node);
ctrl->ngd = ngd;
ret = platform_device_add(ngd->pdev);
--
2.47.3
^ permalink raw reply related
* [PATCH 04/23] pmdomain: imx: fix OF node refcount
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski, stable
In-Reply-To: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com>
for_each_child_of_node_scoped() decrements the reference count of the
nod after each iteration. Assigning it without incrementing the refcount
to a dynamically allocated platform device will result in a double put
in platform_device_release(). Add the missing call to of_node_get().
Cc: stable@vger.kernel.org
Fixes: 3e4d109ee8fc ("pmdomain: imx: gpc: Simplify with scoped for each OF child loop")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/pmdomain/imx/gpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c
index de695f1944ab31de3d37ce8000d0c577579d64f9..42e50c9b4fb9ffb96a20a462d4eb5168942a893c 100644
--- a/drivers/pmdomain/imx/gpc.c
+++ b/drivers/pmdomain/imx/gpc.c
@@ -487,7 +487,7 @@ static int imx_gpc_probe(struct platform_device *pdev)
domain->ipg_rate_mhz = ipg_rate_mhz;
pd_pdev->dev.parent = &pdev->dev;
- pd_pdev->dev.of_node = np;
+ pd_pdev->dev.of_node = of_node_get(np);
pd_pdev->dev.fwnode = of_fwnode_handle(np);
ret = platform_device_add(pd_pdev);
--
2.47.3
^ permalink raw reply related
* [PATCH 05/23] powerpc/powermac: fix OF node refcount
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski, stable
In-Reply-To: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com>
Platform devices created with platform_device_alloc() call
platform_device_release() when the last reference to the device's
kobject is dropped. This function calls of_node_put() unconditionally.
This works fine for devices created with platform_device_register_full()
but users of the split approach (platform_device_alloc() +
platform_device_add()) must bump the reference of the of_node they
assign manually. Add the missing call to of_node_get().
Cc: stable@vger.kernel.org
Fixes: 81e5d8646ff6 ("i2c/powermac: Register i2c devices from device-tree")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
arch/powerpc/platforms/powermac/low_i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index da72a30ab8657e6dc7e6f3437af612155783d8f9..973f58771d9636605ed5d3e91b45008543b584d3 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1471,7 +1471,7 @@ static int __init pmac_i2c_create_platform_devices(void)
if (bus->platform_dev == NULL)
return -ENOMEM;
bus->platform_dev->dev.platform_data = bus;
- bus->platform_dev->dev.of_node = bus->busnode;
+ bus->platform_dev->dev.of_node = of_node_get(bus->busnode);
platform_device_add(bus->platform_dev);
}
--
2.47.3
^ permalink raw reply related
* [PATCH 06/23] driver core: platform: provide platform_device_set_of_node()
From: Bartosz Golaszewski @ 2026-05-21 8:36 UTC (permalink / raw)
To: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
Florian Fainelli, Broadcom internal kernel review list,
Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
Philipp Zabel, Maximilian Luz, Hans de Goede, Ilpo Järvinen,
Krzysztof Kozlowski, Benjamin Herrenschmidt
Cc: brgl, linux-kernel, netdev, linux-arm-msm, linux-sound,
driver-core, devicetree, linuxppc-dev, linux-i2c, iommu, linux-pm,
imx, linux-arm-kernel, intel-xe, dri-devel, linux-usb, linux-mips,
platform-driver-x86, Bartosz Golaszewski
In-Reply-To: <20260521-pdev-fwnode-ref-v1-0-88c324a1b8d2@oss.qualcomm.com>
Encapsulate the reference counting logic for OF nodes assigned to
platform devices created with platform_device_alloc() in a helper
function. Make the kerneldoc state that this is the proper interface for
assigning OF nodes to dynamically allocated platform devices. This will
allow us to switch to counting the references of the device's firmware
nodes, not only the OF nodes.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/base/platform.c | 18 ++++++++++++++++++
include/linux/platform_device.h | 3 +++
2 files changed, 21 insertions(+)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4824d9a2edbe9ff86cc9893cd74688e9cbb6483e..ec53383fa17ac29ea3b15b61f97ae65ae8ca22ac 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -693,6 +693,24 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,
}
EXPORT_SYMBOL_GPL(platform_device_add_data);
+/**
+ * platform_device_set_of_node - assign an OF node to device
+ * @pdev: platform device to add the node for
+ * @np: new device node
+ *
+ * Assign an OF node to this platform device. Internally keep track of the
+ * reference count. Devices created with platform_device_alloc() must use this
+ * function instead of assigning the node manually.
+ */
+void platform_device_set_of_node(struct platform_device *pdev,
+ struct device_node *np)
+{
+ of_node_put(pdev->dev.of_node);
+ pdev->dev.of_node = of_node_get(np);
+ pdev->dev.fwnode = of_fwnode_handle(np);
+}
+EXPORT_SYMBOL_GPL(platform_device_set_of_node);
+
/**
* platform_device_add - add a platform device to device hierarchy
* @pdev: platform device we're adding
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 975400a472e30e2f98cc8f13bc36a63129bd4fcf..21f7d8a7f4b5c9a47d56d80a69802b3f84457ef7 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -19,6 +19,7 @@ struct irq_affinity;
struct mfd_cell;
struct property_entry;
struct platform_device_id;
+struct device_node;
struct platform_device {
const char *name;
@@ -262,6 +263,8 @@ extern int platform_device_add_resources(struct platform_device *pdev,
unsigned int num);
extern int platform_device_add_data(struct platform_device *pdev,
const void *data, size_t size);
+void platform_device_set_of_node(struct platform_device *pdev,
+ struct device_node *np);
extern int platform_device_add(struct platform_device *pdev);
extern void platform_device_del(struct platform_device *pdev);
extern void platform_device_put(struct platform_device *pdev);
--
2.47.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox