Some kernel change break the test build, just fix it.
Wei Yang (3):
memblock tests: fix undefined reference to `early_pfn_to_nid'
memblock tests: fix undefined reference to `panic'
memblock tests: fix undefined reference to `BIT'
include/linux/gfp_types.h | 2 ++
tools/include/linux/kernel.h | 1 +
tools/include/linux/mm.h | 5 +++++
tools/include/linux/panic.h | 19 +++++++++++++++++++
4 files changed, 27 insertions(+)
create mode 100644 tools/include/linux/panic.h
--
2.34.1
commit 6a9531c3a880 ("memblock: fix crash when reserved memory is not
added to memory") introduce the usage of early_pfn_to_nid, which is not
defined in memblock tests.
The original definition of early_pfn_to_nid is defined in mm.h, so let
add this in the corresponding mm.h.
Signed-off-by: Wei Yang <[email protected]>
CC: Yajun Deng <[email protected]>
CC: Mike Rapoport <[email protected]>
---
tools/include/linux/mm.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h
index f3c82ab5b14c..7d73da098047 100644
--- a/tools/include/linux/mm.h
+++ b/tools/include/linux/mm.h
@@ -37,4 +37,9 @@ static inline void totalram_pages_add(long count)
{
}
+static inline int early_pfn_to_nid(unsigned long pfn)
+{
+ return 0;
+}
+
#endif
--
2.34.1
commit 772dd0342727 ("mm: enumerate all gfp flags") define gfp flags
with the help of BIT, while gfp_types.h doesn't include header file for
the definition. This through an error on building memblock tests.
Let's include linux/bits.h to fix it.
Signed-off-by: Wei Yang <[email protected]>
CC: Suren Baghdasaryan <[email protected]>
CC: Michal Hocko <[email protected]>
---
include/linux/gfp_types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h
index 868c8fb1bbc1..13becafe41df 100644
--- a/include/linux/gfp_types.h
+++ b/include/linux/gfp_types.h
@@ -2,6 +2,8 @@
#ifndef __LINUX_GFP_TYPES_H
#define __LINUX_GFP_TYPES_H
+#include <linux/bits.h>
+
/* The typedef is in types.h but we want the documentation here */
#if 0
/**
--
2.34.1
commit e96c6b8f212a ("memblock: report failures when memblock_can_resize
is not set") introduced the usage of panic, which is not defined in
memblock test.
Let's define it directly in panic.h to fix it.
Signed-off-by: Wei Yang <[email protected]>
CC: Song Shuai <[email protected]>
CC: Mike Rapoport <[email protected]>
---
tools/include/linux/kernel.h | 1 +
tools/include/linux/panic.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
create mode 100644 tools/include/linux/panic.h
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 4b0673bf52c2..07cfad817d53 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -8,6 +8,7 @@
#include <linux/build_bug.h>
#include <linux/compiler.h>
#include <linux/math.h>
+#include <linux/panic.h>
#include <endian.h>
#include <byteswap.h>
diff --git a/tools/include/linux/panic.h b/tools/include/linux/panic.h
new file mode 100644
index 000000000000..9c8f17a41ce8
--- /dev/null
+++ b/tools/include/linux/panic.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _TOOLS_LINUX_PANIC_H
+#define _TOOLS_LINUX_PANIC_H
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static inline void panic(const char *fmt, ...)
+{
+ va_list argp;
+
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ exit(-1);
+}
+
+#endif
--
2.34.1
On Tue, Apr 02, 2024 at 01:26:58PM +0000, Wei Yang wrote:
> Some kernel change break the test build, just fix it.
>
> Wei Yang (3):
> memblock tests: fix undefined reference to `early_pfn_to_nid'
> memblock tests: fix undefined reference to `panic'
> memblock tests: fix undefined reference to `BIT'
>
> include/linux/gfp_types.h | 2 ++
> tools/include/linux/kernel.h | 1 +
> tools/include/linux/mm.h | 5 +++++
> tools/include/linux/panic.h | 19 +++++++++++++++++++
> 4 files changed, 27 insertions(+)
> create mode 100644 tools/include/linux/panic.h
Andrew,
I can take these via memblock tree, what is your preference?
--
Sincerely yours,
Mike.
On Tue, 2 Apr 2024 22:09:47 +0300 Mike Rapoport <[email protected]> wrote:
> On Tue, Apr 02, 2024 at 01:26:58PM +0000, Wei Yang wrote:
> > Some kernel change break the test build, just fix it.
> >
> > Wei Yang (3):
> > memblock tests: fix undefined reference to `early_pfn_to_nid'
> > memblock tests: fix undefined reference to `panic'
> > memblock tests: fix undefined reference to `BIT'
> >
> > include/linux/gfp_types.h | 2 ++
> > tools/include/linux/kernel.h | 1 +
> > tools/include/linux/mm.h | 5 +++++
> > tools/include/linux/panic.h | 19 +++++++++++++++++++
> > 4 files changed, 27 insertions(+)
> > create mode 100644 tools/include/linux/panic.h
>
> Andrew,
>
> I can take these via memblock tree, what is your preference?
I'm seeing no conflicts at this time, so go for it.
On Tue, 02 Apr 2024 13:26:58 +0000, Wei Yang wrote:
> Some kernel change break the test build, just fix it.
>
> Wei Yang (3):
> memblock tests: fix undefined reference to `early_pfn_to_nid'
> memblock tests: fix undefined reference to `panic'
> memblock tests: fix undefined reference to `BIT'
>
> [...]
Applied to fixes branch of memblock.git tree, thanks!
[1/3] memblock tests: fix undefined reference to `early_pfn_to_nid'
commit: 7d8ed162e6a92268d4b2b84d364a931216102c8e
[2/3] memblock tests: fix undefined reference to `panic'
commit: e0f5a8e74be88f2476e58b25d3b49a9521bdc4ec
[3/3] memblock tests: fix undefined reference to `BIT'
commit: 592447f6cb3c20d606d6c5d8e6af68e99707b786
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
branch: fixes
--
Sincerely yours,
Mike.