memblock tests: fix build error
Subsystems (2)
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
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.
--- tools/include/linux/mm.h | 5 +++++ 1 file changed, 5 insertions(+)
tools/include/linux/mm.h +5 -0
@@ -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
PATCH 2/3 memblock tests: fix undefined reference to `panic'
In reply to Wei Yangcommit 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.
--- 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
@@ -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
@@ -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
PATCH 3/3 memblock tests: fix undefined reference to `BIT'
In reply to Wei Yangcommit 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.
--- include/linux/gfp_types.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/gfp_types.h +2 -0
@@ -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
Mike Rapoport
reviewerQuoted 7 lines · Wei Yang
Some kernel change break the test build, just fix it.
Wei Yang (3):
memblock tests: fix undefined reference toearly_pfn_to_nid' memblock tests: fix undefined reference topanic' 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.
Andrew Morton
maintainerQuoted 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 toearly_pfn_to_nid' memblock tests: fix undefined reference topanic' 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.
Quoted 8 lines · Wei Yang
Some kernel change break the test build, just fix it.
Wei Yang (3):
memblock tests: fix undefined reference toearly_pfn_to_nid' memblock tests: fix undefined reference topanic' 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: 592447f6cb3c20d606d6c5d8e6af68e99707b786tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
branch: fixes
--
Sincerely yours,
Mike.