[PATCH 0/1] arm64/hibernate: sparse warnings fix

STALE2031d

5 messages, 3 authors, 2021-02-02 · open the first message on its own page

[PATCH 0/1] arm64/hibernate: sparse warnings fix

From: Pavel Tatashin <pasha.tatashin@soleen.com>
Date: 2021-02-01 15:06:03

This is against for-next/kexec, fix for sparse warning that was reported by
kernel test robot [1].

[1] https://lore.kernel.org/linux-arm-kernel/202101292143.C6TcKvvX-lkp@intel.com

Pavel Tatashin (1):
  arm64: hibernate: add __force attribute to gfp_t casting

 arch/arm64/kernel/hibernate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH 1/1] arm64: hibernate: add __force attribute to gfp_t casting

From: Pavel Tatashin <pasha.tatashin@soleen.com>
Date: 2021-02-01 15:07:00

Two new warnings are reported by sparse:

"sparse warnings: (new ones prefixed by >>)"
quoted
arch/arm64/kernel/hibernate.c:181:39: sparse: sparse: cast to
   restricted gfp_t
quoted
arch/arm64/kernel/hibernate.c:202:44: sparse: sparse: cast from
   restricted gfp_t

gfp_t has __bitwise type attribute and requires __force added to casting
in order to avoid these warnings.

Fixes: 50f53fb72181 ("arm64: trans_pgd: make trans_pgd_map_page generic")
Reported-by: kernel test robot <redacted>
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
---
 arch/arm64/kernel/hibernate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index 9df32ba0d574..b1cef371df2b 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -178,7 +178,7 @@ EXPORT_SYMBOL(arch_hibernation_header_restore);
 
 static void *hibernate_page_alloc(void *arg)
 {
-	return (void *)get_safe_page((gfp_t)(unsigned long)arg);
+	return (void *)get_safe_page((__force gfp_t)(unsigned long)arg);
 }
 
 /*
@@ -198,7 +198,7 @@ static int create_safe_exec_page(void *src_start, size_t length,
 {
 	struct trans_pgd_info trans_info = {
 		.trans_alloc_page	= hibernate_page_alloc,
-		.trans_alloc_arg	= (void *)GFP_ATOMIC,
+		.trans_alloc_arg	= (__force void *)GFP_ATOMIC,
 	};
 
 	void *page = (void *)get_safe_page(GFP_ATOMIC);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 0/1] arm64/hibernate: sparse warnings fix

From: Will Deacon <will@kernel.org>
Date: 2021-02-01 17:14:31

On Mon, 1 Feb 2021 10:03:05 -0500, Pavel Tatashin wrote:
This is against for-next/kexec, fix for sparse warning that was reported by
kernel test robot [1].

[1] https://lore.kernel.org/linux-arm-kernel/202101292143.C6TcKvvX-lkp@intel.com

Pavel Tatashin (1):
  arm64: hibernate: add __force attribute to gfp_t casting

[...]
Applied to arm64 (for-next/kexec), thanks!

[1/1] arm64: hibernate: add __force attribute to gfp_t casting
      https://git.kernel.org/arm64/c/d1bbc35fcab2

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 1/1] arm64: hibernate: add __force attribute to gfp_t casting

From: Christoph Hellwig <hch@infradead.org>
Date: 2021-02-02 08:43:42

On Mon, Feb 01, 2021 at 10:03:06AM -0500, Pavel Tatashin wrote:
Two new warnings are reported by sparse:

"sparse warnings: (new ones prefixed by >>)"
quoted
quoted
arch/arm64/kernel/hibernate.c:181:39: sparse: sparse: cast to
   restricted gfp_t
quoted
quoted
arch/arm64/kernel/hibernate.c:202:44: sparse: sparse: cast from
   restricted gfp_t

gfp_t has __bitwise type attribute and requires __force added to casting
in order to avoid these warnings.

Fixes: 50f53fb72181 ("arm64: trans_pgd: make trans_pgd_map_page generic")
Reported-by: kernel test robot <redacted>
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
What about just passing the gfp_t value by reference which would be much
cleaner?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH 1/1] arm64: hibernate: add __force attribute to gfp_t casting

From: Pavel Tatashin <pasha.tatashin@soleen.com>
Date: 2021-02-02 15:11:00

On Tue, Feb 2, 2021 at 3:42 AM Christoph Hellwig [off-list ref] wrote:
On Mon, Feb 01, 2021 at 10:03:06AM -0500, Pavel Tatashin wrote:
quoted
Two new warnings are reported by sparse:

"sparse warnings: (new ones prefixed by >>)"
quoted
quoted
arch/arm64/kernel/hibernate.c:181:39: sparse: sparse: cast to
   restricted gfp_t
quoted
quoted
arch/arm64/kernel/hibernate.c:202:44: sparse: sparse: cast from
   restricted gfp_t

gfp_t has __bitwise type attribute and requires __force added to casting
in order to avoid these warnings.

Fixes: 50f53fb72181 ("arm64: trans_pgd: make trans_pgd_map_page generic")
Reported-by: kernel test robot <redacted>
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
What about just passing the gfp_t value by reference which would be much
cleaner?

Hi Christoph,

Thank you for your suggestions. Passing by reference is OK. I am not
sure it would be much cleaner because for GFP_ATOMIC we would need to
declare another variable on stack before trans_info.

Pasha

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help