From: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
To: "Nysal Jan K.A." <nysal@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Segher Boessenkool <segher@kernel.crashing.org>,
linuxppc-dev@lists.ozlabs.org,
Kevin Brodsky <kevin.brodsky@arm.com>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] selftests/mm: Fix build break when compiling pkey_util.c
Date: Mon, 28 Apr 2025 22:17:40 +0530 [thread overview]
Message-ID: <18c375a5-9d0c-49ca-995c-efaec95aa3a7@linux.ibm.com> (raw)
In-Reply-To: <20250428131937.641989-1-nysal@linux.ibm.com>
On 28/04/25 6:49 pm, Nysal Jan K.A. wrote:
> From: Madhavan Srinivasan <maddy@linux.ibm.com>
>
> Commit 50910acd6f615 ("selftests/mm: use sys_pkey helpers consistently")
> added a pkey_util.c to refactor some of the protection_keys functions accessible
> by other tests. But this broken the build in powerpc in two ways,
>
> pkey-powerpc.h: In function ‘arch_is_powervm’:
> pkey-powerpc.h:73:21: error: storage size of ‘buf’ isn’t known
> 73 | struct stat buf;
> | ^~~
> pkey-powerpc.h:75:14: error: implicit declaration of function ‘stat’; did you mean ‘strcat’? [-Wimplicit-function-declaration]
> 75 | if ((stat("/sys/firmware/devicetree/base/ibm,partition-name", &buf) == 0) &&
> | ^~~~
> | strcat
>
> Since pkey_util.c includes pkeys-helper.h, which in turn includes pkeys-powerpc.h,
> stat.h including is missing for "struct stat". This is fixed by adding "sys/stat.h"
> in pkeys-powerpc.h
>
> Secondly,
>
> pkey-powerpc.h:55:18: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘u64’ {aka ‘long unsigned int’} [-Wformat=]
> 55 | dprintf4("%s() changing %016llx to %016llx\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 56 | __func__, __read_pkey_reg(), pkey_reg);
> | ~~~~~~~~~~~~~~~~~
> | |
> | u64 {aka long unsigned int}
> pkey-helpers.h:63:32: note: in definition of macro ‘dprintf_level’
> 63 | sigsafe_printf(args); \
> | ^~~~
>
> These format specifier related warning are removed by adding
> "__SANE_USERSPACE_TYPES__" to pkeys_utils.c.
>
> Fixes: 50910acd6f615 ("selftests/mm: use sys_pkey helpers consistently")
> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> Signed-off-by: Nysal Jan K.A. <nysal@linux.ibm.com>
> ---
> tools/testing/selftests/mm/pkey-powerpc.h | 2 ++
> tools/testing/selftests/mm/pkey_util.c | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/pkey-powerpc.h b/tools/testing/selftests/mm/pkey-powerpc.h
> index 1bad310d282a..d8ec906b8120 100644
> --- a/tools/testing/selftests/mm/pkey-powerpc.h
> +++ b/tools/testing/selftests/mm/pkey-powerpc.h
> @@ -3,6 +3,8 @@
> #ifndef _PKEYS_POWERPC_H
> #define _PKEYS_POWERPC_H
>
> +#include <sys/stat.h>
> +
> #ifndef SYS_pkey_alloc
> # define SYS_pkey_alloc 384
> # define SYS_pkey_free 385
> diff --git a/tools/testing/selftests/mm/pkey_util.c b/tools/testing/selftests/mm/pkey_util.c
> index ca4ad0d44ab2..255b332f7a08 100644
> --- a/tools/testing/selftests/mm/pkey_util.c
> +++ b/tools/testing/selftests/mm/pkey_util.c
> @@ -1,4 +1,5 @@
> // SPDX-License-Identifier: GPL-2.0-only
> +#define __SANE_USERSPACE_TYPES__
> #include <sys/syscall.h>
> #include <unistd.h>
>
Tested this patch by applying on top of mainline kernel v6.15-rc4, and
it fixes the build issue. Hence,
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Without this Patch:
pkey-powerpc.h: In function ‘arch_is_powervm’:
pkey-powerpc.h:73:21: error: storage size of ‘buf’ isn’t known
73 | struct stat buf;
| ^~~
pkey-powerpc.h:75:14: warning: implicit declaration of function ‘stat’;
did you mean ‘strcat’? [-Wimplicit-function-declaration]
75 | if
((stat("/sys/firmware/devicetree/base/ibm,partition-name", &buf) == 0) &&
| ^~~~
| strcat
With this patch:
make -j 33
/bin/sh ./check_config.sh gcc
CC cow
CC compaction_test
CC gup_longterm
CC gup_test
CC hmm-tests
CC hugetlb-madvise
CC hugetlb-read-hwpoison
CC hugetlb-soft-offline
CC hugepage-mmap
CC hugepage-mremap
CC hugepage-shm
CC hugepage-vmemmap
CC khugepaged
CC madv_populate
CC map_fixed_noreplace
CC map_hugetlb
CC map_populate
CC migration
CC mkdirty
CC mlock-random-test
CC mlock2-tests
CC mrelease_test
CC mremap_dontunmap
CC mremap_test
CC mseal_test
CC on-fault-limit
CC pagemap_ioctl
CC thuge-gen
CC transhuge-stress
CC uffd-stress
CC uffd-unit-tests
CC uffd-wp-mremap
CC split_huge_page_test
CC ksm_tests
CC ksm_functional_tests
CC hugetlb_fault_after_madv
CC hugetlb_madv_vs_map
CC mdwe_test
CC hugetlb_dio
CC droppable
CC guard-regions
CC soft-dirty
CC protection_keys
CC va_high_addr_switch
CC virtual_address_range
CC write_to_hugetlbfs
CC [M] page_frag_test.o
MODPOST Module.symvers
CC [M] page_frag_test.mod.o
CC [M] .module-common.o
LD [M] page_frag_test.ko
Regards,
Venkat.
prev parent reply other threads:[~2025-04-28 16:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 13:19 Nysal Jan K.A.
2025-04-28 13:19 ` [PATCH 2/2] selftests/mm: Fix a build failure on powerpc Nysal Jan K.A.
2025-04-28 16:49 ` Venkat Rao Bagalkote
2025-04-28 17:13 ` Donet Tom
2025-04-28 16:47 ` Venkat Rao Bagalkote [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18c375a5-9d0c-49ca-995c-efaec95aa3a7@linux.ibm.com \
--to=venkat88@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=kevin.brodsky@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=nysal@linux.ibm.com \
--cc=segher@kernel.crashing.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox