All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
@ 2022-11-28 22:53 Nathan Chancellor
  2022-11-30  6:28 ` Hugh Dickins
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-11-28 22:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin
  Cc: Hugh Dickins, llvm, stable, Nathan Chancellor

Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
after readahead page charged") were backported as commit cfe575954ddd
("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
did not account for the lack of commit 33def8498fdd ("treewide: Convert
macro and uses of __section(foo) to __section("foo")") in kernels prior
to 5.10, resulting in the following orphan section warnings on PowerPC
clang builds with CONFIG_DEBUG_VM=y:

  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'

This is a difference between how clang and gcc handle macro
stringification, which was resolved for the kernel by not stringifying
the argument to the __section() macro. Since that change was deemed not
suitable for the stable kernels by commit 59f89518f510 ("once: fix
section mismatch on clang builds"), do that same thing as that change
and remove the quotes from the argument to __section().

Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---

As far as I can tell, this should be applied to 5.4 and earlier. It
should apply cleanly but let me know if not.

 include/linux/mmdebug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 5d0767cb424a..4ed52879ce55 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm);
 		}							\
 	} while (0)
 #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
-	static bool __section(".data.once") __warned;			\
+	static bool __section(.data.once) __warned;			\
 	int __ret_warn_once = !!(cond);					\
 									\
 	if (unlikely(__ret_warn_once && !__warned)) {			\

base-commit: 4d2a309b5c28a2edc0900542d22fec3a5a22243b
-- 
2.38.1


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

* Re: [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
  2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
@ 2022-11-30  6:28 ` Hugh Dickins
  2022-11-30 16:20   ` Nathan Chancellor
  2022-12-03 13:34 ` Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Hugh Dickins @ 2022-11-30  6:28 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Greg Kroah-Hartman, Sasha Levin, Hugh Dickins, llvm, stable

On Mon, 28 Nov 2022, Nathan Chancellor wrote:

> Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
> after readahead page charged") were backported as commit cfe575954ddd
> ("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
> did not account for the lack of commit 33def8498fdd ("treewide: Convert
> macro and uses of __section(foo) to __section("foo")") in kernels prior
> to 5.10, resulting in the following orphan section warnings on PowerPC
> clang builds with CONFIG_DEBUG_VM=y:
> 
>   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
>   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
>   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
> 
> This is a difference between how clang and gcc handle macro
> stringification, which was resolved for the kernel by not stringifying
> the argument to the __section() macro. Since that change was deemed not
> suitable for the stable kernels by commit 59f89518f510 ("once: fix
> section mismatch on clang builds"), do that same thing as that change
> and remove the quotes from the argument to __section().
> 
> Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Yes indeed: thanks Nathan, sorry about that.

Acked-by: Hugh Dickins <hughd@google.com>

> ---
> 
> As far as I can tell, this should be applied to 5.4 and earlier. It
> should apply cleanly but let me know if not.

I think it should be good for 4.19 also, but I don't know what happens
or would happen in 4.14 and 4.9 trees, since those have no other example
of .data.once or ".data.once" (and I've lost what little I ever knew of
that linker script stuff).

Since we're not hearing complaints about those (or are you?), perhaps
those trees are not clang-ready in other ways, and for gcc it all works
out by itself: I'd be inclined to just leave them as is myself, if there
are no reports of breakage; but you may know better, and prefer to remove
the ' __section(".data.once")' from the 4.14 and 4.9 versions.

> 
>  include/linux/mmdebug.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
> index 5d0767cb424a..4ed52879ce55 100644
> --- a/include/linux/mmdebug.h
> +++ b/include/linux/mmdebug.h
> @@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm);
>  		}							\
>  	} while (0)
>  #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
> -	static bool __section(".data.once") __warned;			\
> +	static bool __section(.data.once) __warned;			\
>  	int __ret_warn_once = !!(cond);					\
>  									\
>  	if (unlikely(__ret_warn_once && !__warned)) {			\
> 
> base-commit: 4d2a309b5c28a2edc0900542d22fec3a5a22243b
> -- 
> 2.38.1

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

* Re: [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
  2022-11-30  6:28 ` Hugh Dickins
@ 2022-11-30 16:20   ` Nathan Chancellor
  0 siblings, 0 replies; 11+ messages in thread
From: Nathan Chancellor @ 2022-11-30 16:20 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Greg Kroah-Hartman, Sasha Levin, llvm, stable

On Tue, Nov 29, 2022 at 10:28:33PM -0800, Hugh Dickins wrote:
> On Mon, 28 Nov 2022, Nathan Chancellor wrote:
> 
> > Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
> > after readahead page charged") were backported as commit cfe575954ddd
> > ("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
> > did not account for the lack of commit 33def8498fdd ("treewide: Convert
> > macro and uses of __section(foo) to __section("foo")") in kernels prior
> > to 5.10, resulting in the following orphan section warnings on PowerPC
> > clang builds with CONFIG_DEBUG_VM=y:
> > 
> >   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
> >   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
> >   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
> > 
> > This is a difference between how clang and gcc handle macro
> > stringification, which was resolved for the kernel by not stringifying
> > the argument to the __section() macro. Since that change was deemed not
> > suitable for the stable kernels by commit 59f89518f510 ("once: fix
> > section mismatch on clang builds"), do that same thing as that change
> > and remove the quotes from the argument to __section().
> > 
> > Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> 
> Yes indeed: thanks Nathan, sorry about that.
> 
> Acked-by: Hugh Dickins <hughd@google.com>

No worries, it is a really subtle problem that I would not expect
someone doing normal backports to catch. Thanks for taking a look!

> > ---
> > 
> > As far as I can tell, this should be applied to 5.4 and earlier. It
> > should apply cleanly but let me know if not.
> 
> I think it should be good for 4.19 also, but I don't know what happens
> or would happen in 4.14 and 4.9 trees, since those have no other example
> of .data.once or ".data.once" (and I've lost what little I ever knew of
> that linker script stuff).
> 
> Since we're not hearing complaints about those (or are you?), perhaps
> those trees are not clang-ready in other ways, and for gcc it all works
> out by itself: I'd be inclined to just leave them as is myself, if there
> are no reports of breakage; but you may know better, and prefer to remove
> the ' __section(".data.once")' from the 4.14 and 4.9 versions.

Those trees have very rudimentary clang support, they are far from
warning and issue clean in all configurations (even mainline has known
issues for some architectures, including powerpc). Since this
specifically requires CONFIG_DEBUG_VM to see, I am perfectly fine with
just applying it to 4.19 and 5.4.

Cheers,
Nathan

> > 
> >  include/linux/mmdebug.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
> > index 5d0767cb424a..4ed52879ce55 100644
> > --- a/include/linux/mmdebug.h
> > +++ b/include/linux/mmdebug.h
> > @@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm);
> >  		}							\
> >  	} while (0)
> >  #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
> > -	static bool __section(".data.once") __warned;			\
> > +	static bool __section(.data.once) __warned;			\
> >  	int __ret_warn_once = !!(cond);					\
> >  									\
> >  	if (unlikely(__ret_warn_once && !__warned)) {			\
> > 
> > base-commit: 4d2a309b5c28a2edc0900542d22fec3a5a22243b
> > -- 
> > 2.38.1

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

* Re: [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
  2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
  2022-11-30  6:28 ` Hugh Dickins
@ 2022-12-03 13:34 ` Greg Kroah-Hartman
  2022-12-03 17:41   ` Hugh Dickins
  2022-12-03 13:54 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.9-stable tree gregkh
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2022-12-03 13:34 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: Sasha Levin, Hugh Dickins, llvm, stable

On Mon, Nov 28, 2022 at 03:53:46PM -0700, Nathan Chancellor wrote:
> Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
> after readahead page charged") were backported as commit cfe575954ddd
> ("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
> did not account for the lack of commit 33def8498fdd ("treewide: Convert
> macro and uses of __section(foo) to __section("foo")") in kernels prior
> to 5.10, resulting in the following orphan section warnings on PowerPC
> clang builds with CONFIG_DEBUG_VM=y:
> 
>   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
>   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
>   powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
> 
> This is a difference between how clang and gcc handle macro
> stringification, which was resolved for the kernel by not stringifying
> the argument to the __section() macro. Since that change was deemed not
> suitable for the stable kernels by commit 59f89518f510 ("once: fix
> section mismatch on clang builds"), do that same thing as that change
> and remove the quotes from the argument to __section().
> 
> Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> 
> As far as I can tell, this should be applied to 5.4 and earlier. It
> should apply cleanly but let me know if not.

Queued up everywhere, thanks.

greg k-h

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

* Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.9-stable tree
  2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
  2022-11-30  6:28 ` Hugh Dickins
  2022-12-03 13:34 ` Greg Kroah-Hartman
@ 2022-12-03 13:54 ` gregkh
  2022-12-03 13:54 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.14-stable tree gregkh
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: gregkh @ 2022-12-03 13:54 UTC (permalink / raw)
  To: gregkh, hughd, llvm, nathan, sashal; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    mm: Fix '.data.once' orphan section warning

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-fix-.data.once-orphan-section-warning.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From nathan@kernel.org  Sat Dec  3 14:33:17 2022
From: Nathan Chancellor <nathan@kernel.org>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
Cc: Hugh Dickins <hughd@google.com>, llvm@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>
Message-ID: <20221128225345.9383-1-nathan@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
after readahead page charged") were backported as commit cfe575954ddd
("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
did not account for the lack of commit 33def8498fdd ("treewide: Convert
macro and uses of __section(foo) to __section("foo")") in kernels prior
to 5.10, resulting in the following orphan section warnings on PowerPC
clang builds with CONFIG_DEBUG_VM=y:

  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'

This is a difference between how clang and gcc handle macro
stringification, which was resolved for the kernel by not stringifying
the argument to the __section() macro. Since that change was deemed not
suitable for the stable kernels by commit 59f89518f510 ("once: fix
section mismatch on clang builds"), do that same thing as that change
and remove the quotes from the argument to __section().

Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/mmdebug.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -37,7 +37,7 @@ void dump_mm(const struct mm_struct *mm)
 		}							\
 	} while (0)
 #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
-	static bool __section(".data.once") __warned;			\
+	static bool __section(.data.once) __warned;			\
 	int __ret_warn_once = !!(cond);					\
 									\
 	if (unlikely(__ret_warn_once && !__warned)) {			\


Patches currently in stable-queue which might be from nathan@kernel.org are

queue-4.9/mm-fix-.data.once-orphan-section-warning.patch

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

* Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.14-stable tree
  2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
                   ` (2 preceding siblings ...)
  2022-12-03 13:54 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.9-stable tree gregkh
@ 2022-12-03 13:54 ` gregkh
  2022-12-03 13:55 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.19-stable tree gregkh
  2022-12-03 13:55 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 5.4-stable tree gregkh
  5 siblings, 0 replies; 11+ messages in thread
From: gregkh @ 2022-12-03 13:54 UTC (permalink / raw)
  To: gregkh, hughd, llvm, nathan, sashal; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    mm: Fix '.data.once' orphan section warning

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-fix-.data.once-orphan-section-warning.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From nathan@kernel.org  Sat Dec  3 14:33:17 2022
From: Nathan Chancellor <nathan@kernel.org>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
Cc: Hugh Dickins <hughd@google.com>, llvm@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>
Message-ID: <20221128225345.9383-1-nathan@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
after readahead page charged") were backported as commit cfe575954ddd
("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
did not account for the lack of commit 33def8498fdd ("treewide: Convert
macro and uses of __section(foo) to __section("foo")") in kernels prior
to 5.10, resulting in the following orphan section warnings on PowerPC
clang builds with CONFIG_DEBUG_VM=y:

  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'

This is a difference between how clang and gcc handle macro
stringification, which was resolved for the kernel by not stringifying
the argument to the __section() macro. Since that change was deemed not
suitable for the stable kernels by commit 59f89518f510 ("once: fix
section mismatch on clang builds"), do that same thing as that change
and remove the quotes from the argument to __section().

Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/mmdebug.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm)
 		}							\
 	} while (0)
 #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
-	static bool __section(".data.once") __warned;			\
+	static bool __section(.data.once) __warned;			\
 	int __ret_warn_once = !!(cond);					\
 									\
 	if (unlikely(__ret_warn_once && !__warned)) {			\


Patches currently in stable-queue which might be from nathan@kernel.org are

queue-4.14/mm-fix-.data.once-orphan-section-warning.patch

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

* Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.19-stable tree
  2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
                   ` (3 preceding siblings ...)
  2022-12-03 13:54 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.14-stable tree gregkh
@ 2022-12-03 13:55 ` gregkh
  2022-12-03 13:55 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 5.4-stable tree gregkh
  5 siblings, 0 replies; 11+ messages in thread
From: gregkh @ 2022-12-03 13:55 UTC (permalink / raw)
  To: gregkh, hughd, llvm, nathan, sashal; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    mm: Fix '.data.once' orphan section warning

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-fix-.data.once-orphan-section-warning.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From nathan@kernel.org  Sat Dec  3 14:33:17 2022
From: Nathan Chancellor <nathan@kernel.org>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
Cc: Hugh Dickins <hughd@google.com>, llvm@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>
Message-ID: <20221128225345.9383-1-nathan@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
after readahead page charged") were backported as commit cfe575954ddd
("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
did not account for the lack of commit 33def8498fdd ("treewide: Convert
macro and uses of __section(foo) to __section("foo")") in kernels prior
to 5.10, resulting in the following orphan section warnings on PowerPC
clang builds with CONFIG_DEBUG_VM=y:

  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'

This is a difference between how clang and gcc handle macro
stringification, which was resolved for the kernel by not stringifying
the argument to the __section() macro. Since that change was deemed not
suitable for the stable kernels by commit 59f89518f510 ("once: fix
section mismatch on clang builds"), do that same thing as that change
and remove the quotes from the argument to __section().

Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/mmdebug.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm)
 		}							\
 	} while (0)
 #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
-	static bool __section(".data.once") __warned;			\
+	static bool __section(.data.once) __warned;			\
 	int __ret_warn_once = !!(cond);					\
 									\
 	if (unlikely(__ret_warn_once && !__warned)) {			\


Patches currently in stable-queue which might be from nathan@kernel.org are

queue-4.19/risc-v-vdso-do-not-add-missing-symbols-to-version-se.patch
queue-4.19/mm-fix-.data.once-orphan-section-warning.patch

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

* Patch "mm: Fix '.data.once' orphan section warning" has been added to the 5.4-stable tree
  2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
                   ` (4 preceding siblings ...)
  2022-12-03 13:55 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.19-stable tree gregkh
@ 2022-12-03 13:55 ` gregkh
  5 siblings, 0 replies; 11+ messages in thread
From: gregkh @ 2022-12-03 13:55 UTC (permalink / raw)
  To: gregkh, hughd, llvm, nathan, sashal; +Cc: stable-commits


This is a note to let you know that I've just added the patch titled

    mm: Fix '.data.once' orphan section warning

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-fix-.data.once-orphan-section-warning.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From nathan@kernel.org  Sat Dec  3 14:33:17 2022
From: Nathan Chancellor <nathan@kernel.org>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
Cc: Hugh Dickins <hughd@google.com>, llvm@lists.linux.dev, stable@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>
Message-ID: <20221128225345.9383-1-nathan@kernel.org>

From: Nathan Chancellor <nathan@kernel.org>

Portions of upstream commit a4055888629b ("mm/memcg: warning on !memcg
after readahead page charged") were backported as commit cfe575954ddd
("mm: add VM_WARN_ON_ONCE_PAGE() macro"). Unfortunately, the backport
did not account for the lack of commit 33def8498fdd ("treewide: Convert
macro and uses of __section(foo) to __section("foo")") in kernels prior
to 5.10, resulting in the following orphan section warnings on PowerPC
clang builds with CONFIG_DEBUG_VM=y:

  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'
  powerpc64le-linux-gnu-ld: warning: orphan section `".data.once"' from `mm/huge_memory.o' being placed in section `".data.once"'

This is a difference between how clang and gcc handle macro
stringification, which was resolved for the kernel by not stringifying
the argument to the __section() macro. Since that change was deemed not
suitable for the stable kernels by commit 59f89518f510 ("once: fix
section mismatch on clang builds"), do that same thing as that change
and remove the quotes from the argument to __section().

Fixes: cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/mmdebug.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -38,7 +38,7 @@ void dump_mm(const struct mm_struct *mm)
 		}							\
 	} while (0)
 #define VM_WARN_ON_ONCE_PAGE(cond, page)	({			\
-	static bool __section(".data.once") __warned;			\
+	static bool __section(.data.once) __warned;			\
 	int __ret_warn_once = !!(cond);					\
 									\
 	if (unlikely(__ret_warn_once && !__warned)) {			\


Patches currently in stable-queue which might be from nathan@kernel.org are

queue-5.4/gcov-clang-fix-the-buffer-overflow-issue.patch
queue-5.4/risc-v-vdso-do-not-add-missing-symbols-to-version-se.patch
queue-5.4/mm-fix-.data.once-orphan-section-warning.patch

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

* Re: [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
  2022-12-03 13:34 ` Greg Kroah-Hartman
@ 2022-12-03 17:41   ` Hugh Dickins
  2022-12-04 15:38     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 11+ messages in thread
From: Hugh Dickins @ 2022-12-03 17:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Nathan Chancellor, Sasha Levin, Hugh Dickins, llvm, stable

On Sat, 3 Dec 2022, Greg Kroah-Hartman wrote:
> On Mon, Nov 28, 2022 at 03:53:46PM -0700, Nathan Chancellor wrote:
> > 
> > As far as I can tell, this should be applied to 5.4 and earlier. It
> > should apply cleanly but let me know if not.
> 
> Queued up everywhere, thanks.

Thanks for queueing them up, Greg, but please read through the thread:
I have doubts on the 4.14 and 4.9 ones, which would want a different patch
if we're going to make any change; but thought we could just leave those
trees without the patch, and Nathan agreed.

Thanks,
Hugh

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

* Re: [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
  2022-12-03 17:41   ` Hugh Dickins
@ 2022-12-04 15:38     ` Greg Kroah-Hartman
  2022-12-04 15:55       ` Hugh Dickins
  0 siblings, 1 reply; 11+ messages in thread
From: Greg Kroah-Hartman @ 2022-12-04 15:38 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Nathan Chancellor, Sasha Levin, llvm, stable

On Sat, Dec 03, 2022 at 09:41:34AM -0800, Hugh Dickins wrote:
> On Sat, 3 Dec 2022, Greg Kroah-Hartman wrote:
> > On Mon, Nov 28, 2022 at 03:53:46PM -0700, Nathan Chancellor wrote:
> > > 
> > > As far as I can tell, this should be applied to 5.4 and earlier. It
> > > should apply cleanly but let me know if not.
> > 
> > Queued up everywhere, thanks.
> 
> Thanks for queueing them up, Greg, but please read through the thread:
> I have doubts on the 4.14 and 4.9 ones, which would want a different patch
> if we're going to make any change; but thought we could just leave those
> trees without the patch, and Nathan agreed.

Oops, sorry, now dropped from 4.14 and 4.9 and I left the 4.19 one as
that one was ok to keep, right?

thanks,

greg k-h

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

* Re: [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning
  2022-12-04 15:38     ` Greg Kroah-Hartman
@ 2022-12-04 15:55       ` Hugh Dickins
  0 siblings, 0 replies; 11+ messages in thread
From: Hugh Dickins @ 2022-12-04 15:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Hugh Dickins, Nathan Chancellor, Sasha Levin, llvm, stable

On Sun, 4 Dec 2022, Greg Kroah-Hartman wrote:
> On Sat, Dec 03, 2022 at 09:41:34AM -0800, Hugh Dickins wrote:
> > On Sat, 3 Dec 2022, Greg Kroah-Hartman wrote:
> > > On Mon, Nov 28, 2022 at 03:53:46PM -0700, Nathan Chancellor wrote:
> > > > 
> > > > As far as I can tell, this should be applied to 5.4 and earlier. It
> > > > should apply cleanly but let me know if not.
> > > 
> > > Queued up everywhere, thanks.
> > 
> > Thanks for queueing them up, Greg, but please read through the thread:
> > I have doubts on the 4.14 and 4.9 ones, which would want a different patch
> > if we're going to make any change; but thought we could just leave those
> > trees without the patch, and Nathan agreed.
> 
> Oops, sorry, now dropped from 4.14 and 4.9 and I left the 4.19 one as
> that one was ok to keep, right?

That's right, the 5.4 and the 4.19 ones are straightforward.
It was just the 4.14 and 4.9 ones which were questionable (because
of other related infrastructure missing), so better dropped.

Thanks,
Hugh

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

end of thread, other threads:[~2022-12-04 15:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 22:53 [PATCH 5.4 and earlier only] mm: Fix '.data.once' orphan section warning Nathan Chancellor
2022-11-30  6:28 ` Hugh Dickins
2022-11-30 16:20   ` Nathan Chancellor
2022-12-03 13:34 ` Greg Kroah-Hartman
2022-12-03 17:41   ` Hugh Dickins
2022-12-04 15:38     ` Greg Kroah-Hartman
2022-12-04 15:55       ` Hugh Dickins
2022-12-03 13:54 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.9-stable tree gregkh
2022-12-03 13:54 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.14-stable tree gregkh
2022-12-03 13:55 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.19-stable tree gregkh
2022-12-03 13:55 ` Patch "mm: Fix '.data.once' orphan section warning" has been added to the 5.4-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.