mm: Fix '.data.once' orphan section warning
Subsystems (2)
PATCH 1/1 mm: Fix '.data.once' orphan section warning
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().
---
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(-)
include/linux/mmdebug.h +1 -1
@@ -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
Signature · 1 line
2.38.1
Quoted 19 lines · Nathan Chancellor
Portions of upstream commit
a4055888629b("mm/memcg: warning on !memcg after readahead page charged") were backported as commitcfe575954ddd("mm: addVM_WARN_ON_ONCE_PAGE()macro"). Unfortunately, the backport did not account for the lack of commit33def8498fdd("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 withCONFIG_DEBUG_VM=y:powerpc64le-linux-gnu-ld: warning: orphan section
".data.once"' frommm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section".data.once"' frommm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section".data.once"' frommm/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 commit59f89518f510("once: fix section mismatch on clang builds"), do that same thing as that change and remove the quotes from the argument to__section().
Quoted 2 lines
Fixes cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")Signed-off-by Nathan Chancellor <[email protected]>
Yes indeed: thanks Nathan, sorry about that.
Quoted 4 lines
---
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.
Quoted 21 lines
include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/mmdebug.h +1
-1@@ -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:
4d2a309b5c28a2edc0900542d22fec3a5a22243bSignature · 1 line
2.38.1
Quoted 21 lines · Hugh Dickins
Quoted 19 lines · Nathan Chancellor
Portions of upstream commit
a4055888629b("mm/memcg: warning on !memcg after readahead page charged") were backported as commitcfe575954ddd("mm: addVM_WARN_ON_ONCE_PAGE()macro"). Unfortunately, the backport did not account for the lack of commit33def8498fdd("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 withCONFIG_DEBUG_VM=y:powerpc64le-linux-gnu-ld: warning: orphan section
".data.once"' frommm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section".data.once"' frommm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section".data.once"' frommm/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 commit59f89518f510("once: fix section mismatch on clang builds"), do that same thing as that change and remove the quotes from the argument to__section().
Quoted 6 lines
Quoted 2 lines
Fixes cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")Signed-off-by Nathan Chancellor <[email protected]>Yes indeed: thanks Nathan, sorry about that.
Acked-by Hugh Dickins <[email protected]>
No worries, it is a really subtle problem that I would not expect someone doing normal backports to catch. Thanks for taking a look!
Quoted 10 lines
Quoted 4 lines
---
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).
Quoted 5 lines
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
Quoted 21 lines
Quoted 21 lines
include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/mmdebug.h +1
-1@@ -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:
4d2a309b5c28a2edc0900542d22fec3a5a22243bSignature · 1 line
2.38.1
Quoted 19 lines · Nathan Chancellor
Portions of upstream commit
a4055888629b("mm/memcg: warning on !memcg after readahead page charged") were backported as commitcfe575954ddd("mm: addVM_WARN_ON_ONCE_PAGE()macro"). Unfortunately, the backport did not account for the lack of commit33def8498fdd("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 withCONFIG_DEBUG_VM=y:powerpc64le-linux-gnu-ld: warning: orphan section
".data.once"' frommm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section".data.once"' frommm/huge_memory.o' being placed in section `".data.once"'
powerpc64le-linux-gnu-ld: warning: orphan section".data.once"' frommm/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 commit59f89518f510("once: fix section mismatch on clang builds"), do that same thing as that change and remove the quotes from the argument to__section().
Quoted 6 lines
Fixes cfe575954ddd ("mm: add VM_WARN_ON_ONCE_PAGE() macro")Signed-off-by Nathan Chancellor <[email protected]>---
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
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Nathan Chancellor
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
Greg Kroah-Hartman
maintainerQuoted 6 lines · Hugh Dickins
Quoted 5 lines · Greg Kroah-Hartman
Quoted 3 lines · Nathan Chancellor
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.
Quoted 6 lines
Quoted 1 line
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
Quoted 9 lines · Greg Kroah-Hartman
Quoted 8 lines · Hugh Dickins
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Nathan Chancellor
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.
Quoted 7 lines
Quoted 4 lines
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
Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.9-stable tree
In reply to Nathan ChancellorThis 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 <[email protected]> know about it.
From [email protected] Sat Dec 3 14:33:17 2022
From: Nathan Chancellor <[email protected]>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>
Cc: Hugh Dickins <[email protected]>, [email protected], [email protected], Nathan Chancellor <[email protected]>
Message-ID: <[email protected]>
From: Nathan Chancellor <[email protected]>
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().
--- include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mmdebug.h +1 -1
@@ -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 [email protected] are
queue-4.9/mm-fix-.data.once-orphan-section-warning.patch
Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.14-stable tree
In reply to Nathan ChancellorThis 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 <[email protected]> know about it.
From [email protected] Sat Dec 3 14:33:17 2022
From: Nathan Chancellor <[email protected]>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>
Cc: Hugh Dickins <[email protected]>, [email protected], [email protected], Nathan Chancellor <[email protected]>
Message-ID: <[email protected]>
From: Nathan Chancellor <[email protected]>
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().
--- include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mmdebug.h +1 -1
@@ -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 [email protected] are
queue-4.14/mm-fix-.data.once-orphan-section-warning.patch
Patch "mm: Fix '.data.once' orphan section warning" has been added to the 4.19-stable tree
In reply to Nathan ChancellorThis 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 <[email protected]> know about it.
From [email protected] Sat Dec 3 14:33:17 2022
From: Nathan Chancellor <[email protected]>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>
Cc: Hugh Dickins <[email protected]>, [email protected], [email protected], Nathan Chancellor <[email protected]>
Message-ID: <[email protected]>
From: Nathan Chancellor <[email protected]>
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().
--- include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mmdebug.h +1 -1
@@ -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 [email protected] 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
Patch "mm: Fix '.data.once' orphan section warning" has been added to the 5.4-stable tree
In reply to Nathan ChancellorThis 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 <[email protected]> know about it.
From [email protected] Sat Dec 3 14:33:17 2022
From: Nathan Chancellor <[email protected]>
Date: Mon, 28 Nov 2022 15:53:46 -0700
Subject: mm: Fix '.data.once' orphan section warning
To: Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>
Cc: Hugh Dickins <[email protected]>, [email protected], [email protected], Nathan Chancellor <[email protected]>
Message-ID: <[email protected]>
From: Nathan Chancellor <[email protected]>
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().
--- include/linux/mmdebug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mmdebug.h +1 -1
@@ -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 [email protected] 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