Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey()
@ 2024-11-08 11:05 Catalin Marinas
  2024-11-08 13:12 ` Kevin Brodsky
  2024-11-12 16:10 ` Catalin Marinas
  0 siblings, 2 replies; 3+ messages in thread
From: Catalin Marinas @ 2024-11-08 11:05 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kselftest; +Cc: Shuah Khan, Joey Gouly, Kevin Brodsky

Since commit 49f59573e9e0 ("selftests/mm: Enable pkey_sighandler_tests
on arm64"), pkey_sighandler_tests.c (which includes pkey-arm64.h via
pkey-helpers.h) ends up compiled for arm64. Since it doesn't use
aarch64_write_signal_pkey(), the compiler warns:

In file included from pkey-helpers.h:106,
                 from pkey_sighandler_tests.c:31:
pkey-arm64.h:130:13: warning: ‘aarch64_write_signal_pkey’ defined but not used [-Wunused-function]
  130 | static void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~

Make the aarch64_write_signal_pkey() a 'static inline void' function to
avoid the compiler warning.

Fixes: f5b5ea51f78f ("selftests: mm: make protection_keys test work on arm64")
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---

I'll add this on top of the arm64 for-next/pkey-signal branch together with
Kevin's other patches.

 tools/testing/selftests/mm/pkey-arm64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/pkey-arm64.h b/tools/testing/selftests/mm/pkey-arm64.h
index d57fbeace38f..d9d2100eafc0 100644
--- a/tools/testing/selftests/mm/pkey-arm64.h
+++ b/tools/testing/selftests/mm/pkey-arm64.h
@@ -127,7 +127,7 @@ static inline u64 get_pkey_bits(u64 reg, int pkey)
 	return 0;
 }
 
-static void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
+static inline void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
 {
 	struct _aarch64_ctx *ctx = GET_UC_RESV_HEAD(uctxt);
 	struct poe_context *poe_ctx =

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey()
  2024-11-08 11:05 [PATCH] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey() Catalin Marinas
@ 2024-11-08 13:12 ` Kevin Brodsky
  2024-11-12 16:10 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Brodsky @ 2024-11-08 13:12 UTC (permalink / raw)
  To: Catalin Marinas, linux-arm-kernel, linux-kselftest; +Cc: Shuah Khan, Joey Gouly

On 08/11/2024 12:05, Catalin Marinas wrote:
> Since commit 49f59573e9e0 ("selftests/mm: Enable pkey_sighandler_tests
> on arm64"), pkey_sighandler_tests.c (which includes pkey-arm64.h via
> pkey-helpers.h) ends up compiled for arm64. Since it doesn't use
> aarch64_write_signal_pkey(), the compiler warns:
>
> In file included from pkey-helpers.h:106,
>                  from pkey_sighandler_tests.c:31:
> pkey-arm64.h:130:13: warning: ‘aarch64_write_signal_pkey’ defined but not used [-Wunused-function]
>   130 | static void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~
>
> Make the aarch64_write_signal_pkey() a 'static inline void' function to
> avoid the compiler warning.
>
> Fixes: f5b5ea51f78f ("selftests: mm: make protection_keys test work on arm64")
> Cc: Shuah Khan <skhan@linuxfoundation.org>
> Cc: Joey Gouly <joey.gouly@arm.com>
> Cc: Kevin Brodsky <kevin.brodsky@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

I've got this diff locally, didn't realise it was my patches that
revealed the issue otherwise I'd have posted it earlier. Either way:

Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>

- Kevin

> ---
>
> I'll add this on top of the arm64 for-next/pkey-signal branch together with
> Kevin's other patches.
>
>  tools/testing/selftests/mm/pkey-arm64.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/pkey-arm64.h b/tools/testing/selftests/mm/pkey-arm64.h
> index d57fbeace38f..d9d2100eafc0 100644
> --- a/tools/testing/selftests/mm/pkey-arm64.h
> +++ b/tools/testing/selftests/mm/pkey-arm64.h
> @@ -127,7 +127,7 @@ static inline u64 get_pkey_bits(u64 reg, int pkey)
>  	return 0;
>  }
>  
> -static void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
> +static inline void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
>  {
>  	struct _aarch64_ctx *ctx = GET_UC_RESV_HEAD(uctxt);
>  	struct poe_context *poe_ctx =


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey()
  2024-11-08 11:05 [PATCH] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey() Catalin Marinas
  2024-11-08 13:12 ` Kevin Brodsky
@ 2024-11-12 16:10 ` Catalin Marinas
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2024-11-12 16:10 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kselftest, Catalin Marinas
  Cc: Will Deacon, Shuah Khan, Joey Gouly, Kevin Brodsky

On Fri, 08 Nov 2024 11:05:49 +0000, Catalin Marinas wrote:
> Since commit 49f59573e9e0 ("selftests/mm: Enable pkey_sighandler_tests
> on arm64"), pkey_sighandler_tests.c (which includes pkey-arm64.h via
> pkey-helpers.h) ends up compiled for arm64. Since it doesn't use
> aarch64_write_signal_pkey(), the compiler warns:
> 
> In file included from pkey-helpers.h:106,
>                  from pkey_sighandler_tests.c:31:
> pkey-arm64.h:130:13: warning: ‘aarch64_write_signal_pkey’ defined but not used [-Wunused-function]
>   130 | static void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~
> 
> [...]

Applied to arm64 (for-next/pkey-signal), thanks!

[1/1] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey()
      https://git.kernel.org/arm64/c/929bbc16abfb

-- 
Catalin


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-12 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08 11:05 [PATCH] selftests/mm: Fix unused function warning for aarch64_write_signal_pkey() Catalin Marinas
2024-11-08 13:12 ` Kevin Brodsky
2024-11-12 16:10 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox