Skip to contentSkip to conversation

memblock tests: fix build error

PATCH Applied Wei Yang 3 participants 7 messages Apr 2, 2024 – Apr 4, 2024

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

cover memblock tests: fix build error

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
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/3 memblock tests: fix undefined reference to `early_pfn_to_nid'

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.

CC Yajun Deng <[email protected]>
CC Mike Rapoport <[email protected]>
---
 tools/include/linux/mm.h | 5 +++++
 1 file changed, 5 insertions(+)
tools/include/linux/mm.h +5 -0
index f3c82ab5b14c..7d73da098047 100644
@@ -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
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/3 memblock tests: fix undefined reference to `panic'

In reply to Wei Yang

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.

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
tools/include/linux/kernel.h +1 -0
index 4b0673bf52c2..07cfad817d53 100644
@@ -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>
 
tools/include/linux/panic.h new file +19 -0
new file mode 100644
index 000000000000..9c8f17a41ce8
@@ -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
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/3 memblock tests: fix undefined reference to `BIT'

In reply to Wei Yang

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.

CC Suren Baghdasaryan <[email protected]>
CC Michal Hocko <[email protected]>
---
 include/linux/gfp_types.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/gfp_types.h +2 -0
index 868c8fb1bbc1..13becafe41df 100644
@@ -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
 /**
Signature · 1 line
2.34.1
reviewer
#4 lore raw
In reply to Wei Yang
Quoted 7 lines · Wei Yang

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'

Quoted 6 lines
 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?

Signature · 2 lines
Sincerely yours,
Mike.
maintainer
#5 lore raw
Quoted 15 lines · On Tue, 2 Apr 2024 22:09:47 +0300 Mike Rapoport <[email protected]> wrote:
Quoted 7 lines · Wei Yang

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'

Quoted 6 lines
 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
Quoted 3 lines

Andrew,

I can take these via memblock tree, what is your preference?

I'm seeing no conflicts at this time, so go for it.

reviewer Applied
#6 lore raw
In reply to Wei Yang
Quoted 8 lines · Wei Yang

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.