* [PATCH] kexec: replace crash_mem_range with range
@ 2022-06-15 5:04 ` Li Chen
0 siblings, 0 replies; 8+ messages in thread
From: Li Chen @ 2022-06-15 5:04 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Eric Biederman, kexec
From: Li Chen <lchen@ambarella.com>
We already have struct range, so just use it.
Signed-off-by: Li Chen <lchen@ambarella.com>
---
arch/powerpc/kexec/file_load_64.c | 2 +-
arch/powerpc/kexec/ranges.c | 8 ++++----
include/linux/kexec.h | 7 ++-----
kernel/kexec_file.c | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index b4981b651d9a..583b7fc478f2 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -34,7 +34,7 @@ struct umem_info {
/* usable memory ranges to look up */
unsigned int nr_ranges;
- const struct crash_mem_range *ranges;
+ const struct range *ranges;
};
const struct kexec_file_ops * const kexec_file_loaders[] = {
diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
index 563e9989a5bf..5fc53a5fcfdf 100644
--- a/arch/powerpc/kexec/ranges.c
+++ b/arch/powerpc/kexec/ranges.c
@@ -33,7 +33,7 @@
static inline unsigned int get_max_nr_ranges(size_t size)
{
return ((size - sizeof(struct crash_mem)) /
- sizeof(struct crash_mem_range));
+ sizeof(struct range));
}
/**
@@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
return 0;
size = (sizeof(struct crash_mem) +
- (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
+ (mem_rngs->max_nr_ranges * sizeof(struct range)));
/*
* Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
@@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
*/
static void __merge_memory_ranges(struct crash_mem *mem_rngs)
{
- struct crash_mem_range *ranges;
+ struct range *ranges;
int i, idx;
if (!mem_rngs)
@@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
/* cmp_func_t callback to sort ranges with sort() */
static int rngcmp(const void *_x, const void *_y)
{
- const struct crash_mem_range *x = _x, *y = _y;
+ const struct range *x = _x, *y = _y;
if (x->start > y->start)
return 1;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 58d1b58a971e..d7ab4ad4c619 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -17,6 +17,7 @@
#include <linux/crash_core.h>
#include <asm/io.h>
+#include <linux/range.h>
#include <uapi/linux/kexec.h>
@@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
/* Alignment required for elf header segment */
#define ELF_CORE_HEADER_ALIGN 4096
-struct crash_mem_range {
- u64 start, end;
-};
-
struct crash_mem {
unsigned int max_nr_ranges;
unsigned int nr_ranges;
- struct crash_mem_range ranges[];
+ struct range ranges[];
};
extern int crash_exclude_mem_range(struct crash_mem *mem,
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 8347fc158d2b..f2758af86b93 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
{
int i, j;
unsigned long long start, end, p_start, p_end;
- struct crash_mem_range temp_range = {0, 0};
+ struct range temp_range = {0, 0};
for (i = 0; i < mem->nr_ranges; i++) {
start = mem->ranges[i].start;
--
2.36.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] kexec: replace crash_mem_range with range
@ 2022-06-15 5:04 ` Li Chen
0 siblings, 0 replies; 8+ messages in thread
From: Li Chen @ 2022-06-15 5:04 UTC (permalink / raw)
To: linuxppc-dev, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Eric Biederman, kexec
From: Li Chen <lchen@ambarella.com>
We already have struct range, so just use it.
Signed-off-by: Li Chen <lchen@ambarella.com>
---
arch/powerpc/kexec/file_load_64.c | 2 +-
arch/powerpc/kexec/ranges.c | 8 ++++----
include/linux/kexec.h | 7 ++-----
kernel/kexec_file.c | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index b4981b651d9a..583b7fc478f2 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -34,7 +34,7 @@ struct umem_info {
/* usable memory ranges to look up */
unsigned int nr_ranges;
- const struct crash_mem_range *ranges;
+ const struct range *ranges;
};
const struct kexec_file_ops * const kexec_file_loaders[] = {
diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
index 563e9989a5bf..5fc53a5fcfdf 100644
--- a/arch/powerpc/kexec/ranges.c
+++ b/arch/powerpc/kexec/ranges.c
@@ -33,7 +33,7 @@
static inline unsigned int get_max_nr_ranges(size_t size)
{
return ((size - sizeof(struct crash_mem)) /
- sizeof(struct crash_mem_range));
+ sizeof(struct range));
}
/**
@@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
return 0;
size = (sizeof(struct crash_mem) +
- (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
+ (mem_rngs->max_nr_ranges * sizeof(struct range)));
/*
* Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
@@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
*/
static void __merge_memory_ranges(struct crash_mem *mem_rngs)
{
- struct crash_mem_range *ranges;
+ struct range *ranges;
int i, idx;
if (!mem_rngs)
@@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
/* cmp_func_t callback to sort ranges with sort() */
static int rngcmp(const void *_x, const void *_y)
{
- const struct crash_mem_range *x = _x, *y = _y;
+ const struct range *x = _x, *y = _y;
if (x->start > y->start)
return 1;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 58d1b58a971e..d7ab4ad4c619 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -17,6 +17,7 @@
#include <linux/crash_core.h>
#include <asm/io.h>
+#include <linux/range.h>
#include <uapi/linux/kexec.h>
@@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
/* Alignment required for elf header segment */
#define ELF_CORE_HEADER_ALIGN 4096
-struct crash_mem_range {
- u64 start, end;
-};
-
struct crash_mem {
unsigned int max_nr_ranges;
unsigned int nr_ranges;
- struct crash_mem_range ranges[];
+ struct range ranges[];
};
extern int crash_exclude_mem_range(struct crash_mem *mem,
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 8347fc158d2b..f2758af86b93 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
{
int i, j;
unsigned long long start, end, p_start, p_end;
- struct crash_mem_range temp_range = {0, 0};
+ struct range temp_range = {0, 0};
for (i = 0; i < mem->nr_ranges; i++) {
start = mem->ranges[i].start;
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] kexec: replace crash_mem_range with range
2022-06-15 5:04 ` Li Chen
@ 2022-06-16 2:03 ` Baoquan He
-1 siblings, 0 replies; 8+ messages in thread
From: Baoquan He @ 2022-06-16 2:03 UTC (permalink / raw)
To: Li Chen; +Cc: kexec, Paul Mackerras, Eric Biederman, linuxppc-dev
On 06/14/22 at 10:04pm, Li Chen wrote:
> From: Li Chen <lchen@ambarella.com>
>
> We already have struct range, so just use it.
Looks good, have you tested it?
>
> Signed-off-by: Li Chen <lchen@ambarella.com>
> ---
> arch/powerpc/kexec/file_load_64.c | 2 +-
> arch/powerpc/kexec/ranges.c | 8 ++++----
> include/linux/kexec.h | 7 ++-----
> kernel/kexec_file.c | 2 +-
> 4 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index b4981b651d9a..583b7fc478f2 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -34,7 +34,7 @@ struct umem_info {
>
> /* usable memory ranges to look up */
> unsigned int nr_ranges;
> - const struct crash_mem_range *ranges;
> + const struct range *ranges;
> };
>
> const struct kexec_file_ops * const kexec_file_loaders[] = {
> diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
> index 563e9989a5bf..5fc53a5fcfdf 100644
> --- a/arch/powerpc/kexec/ranges.c
> +++ b/arch/powerpc/kexec/ranges.c
> @@ -33,7 +33,7 @@
> static inline unsigned int get_max_nr_ranges(size_t size)
> {
> return ((size - sizeof(struct crash_mem)) /
> - sizeof(struct crash_mem_range));
> + sizeof(struct range));
> }
>
> /**
> @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
> return 0;
>
> size = (sizeof(struct crash_mem) +
> - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
> + (mem_rngs->max_nr_ranges * sizeof(struct range)));
>
> /*
> * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
> @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
> */
> static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> {
> - struct crash_mem_range *ranges;
> + struct range *ranges;
> int i, idx;
>
> if (!mem_rngs)
> @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> /* cmp_func_t callback to sort ranges with sort() */
> static int rngcmp(const void *_x, const void *_y)
> {
> - const struct crash_mem_range *x = _x, *y = _y;
> + const struct range *x = _x, *y = _y;
>
> if (x->start > y->start)
> return 1;
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 58d1b58a971e..d7ab4ad4c619 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -17,6 +17,7 @@
>
> #include <linux/crash_core.h>
> #include <asm/io.h>
> +#include <linux/range.h>
>
> #include <uapi/linux/kexec.h>
>
> @@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
> /* Alignment required for elf header segment */
> #define ELF_CORE_HEADER_ALIGN 4096
>
> -struct crash_mem_range {
> - u64 start, end;
> -};
> -
> struct crash_mem {
> unsigned int max_nr_ranges;
> unsigned int nr_ranges;
> - struct crash_mem_range ranges[];
> + struct range ranges[];
> };
>
> extern int crash_exclude_mem_range(struct crash_mem *mem,
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 8347fc158d2b..f2758af86b93 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> {
> int i, j;
> unsigned long long start, end, p_start, p_end;
> - struct crash_mem_range temp_range = {0, 0};
> + struct range temp_range = {0, 0};
>
> for (i = 0; i < mem->nr_ranges; i++) {
> start = mem->ranges[i].start;
> --
> 2.36.1
>
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kexec: replace crash_mem_range with range
@ 2022-06-16 2:03 ` Baoquan He
0 siblings, 0 replies; 8+ messages in thread
From: Baoquan He @ 2022-06-16 2:03 UTC (permalink / raw)
To: Li Chen
Cc: linuxppc-dev, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Eric Biederman, kexec
On 06/14/22 at 10:04pm, Li Chen wrote:
> From: Li Chen <lchen@ambarella.com>
>
> We already have struct range, so just use it.
Looks good, have you tested it?
>
> Signed-off-by: Li Chen <lchen@ambarella.com>
> ---
> arch/powerpc/kexec/file_load_64.c | 2 +-
> arch/powerpc/kexec/ranges.c | 8 ++++----
> include/linux/kexec.h | 7 ++-----
> kernel/kexec_file.c | 2 +-
> 4 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> index b4981b651d9a..583b7fc478f2 100644
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -34,7 +34,7 @@ struct umem_info {
>
> /* usable memory ranges to look up */
> unsigned int nr_ranges;
> - const struct crash_mem_range *ranges;
> + const struct range *ranges;
> };
>
> const struct kexec_file_ops * const kexec_file_loaders[] = {
> diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
> index 563e9989a5bf..5fc53a5fcfdf 100644
> --- a/arch/powerpc/kexec/ranges.c
> +++ b/arch/powerpc/kexec/ranges.c
> @@ -33,7 +33,7 @@
> static inline unsigned int get_max_nr_ranges(size_t size)
> {
> return ((size - sizeof(struct crash_mem)) /
> - sizeof(struct crash_mem_range));
> + sizeof(struct range));
> }
>
> /**
> @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
> return 0;
>
> size = (sizeof(struct crash_mem) +
> - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
> + (mem_rngs->max_nr_ranges * sizeof(struct range)));
>
> /*
> * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
> @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
> */
> static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> {
> - struct crash_mem_range *ranges;
> + struct range *ranges;
> int i, idx;
>
> if (!mem_rngs)
> @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> /* cmp_func_t callback to sort ranges with sort() */
> static int rngcmp(const void *_x, const void *_y)
> {
> - const struct crash_mem_range *x = _x, *y = _y;
> + const struct range *x = _x, *y = _y;
>
> if (x->start > y->start)
> return 1;
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 58d1b58a971e..d7ab4ad4c619 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -17,6 +17,7 @@
>
> #include <linux/crash_core.h>
> #include <asm/io.h>
> +#include <linux/range.h>
>
> #include <uapi/linux/kexec.h>
>
> @@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
> /* Alignment required for elf header segment */
> #define ELF_CORE_HEADER_ALIGN 4096
>
> -struct crash_mem_range {
> - u64 start, end;
> -};
> -
> struct crash_mem {
> unsigned int max_nr_ranges;
> unsigned int nr_ranges;
> - struct crash_mem_range ranges[];
> + struct range ranges[];
> };
>
> extern int crash_exclude_mem_range(struct crash_mem *mem,
> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> index 8347fc158d2b..f2758af86b93 100644
> --- a/kernel/kexec_file.c
> +++ b/kernel/kexec_file.c
> @@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> {
> int i, j;
> unsigned long long start, end, p_start, p_end;
> - struct crash_mem_range temp_range = {0, 0};
> + struct range temp_range = {0, 0};
>
> for (i = 0; i < mem->nr_ranges; i++) {
> start = mem->ranges[i].start;
> --
> 2.36.1
>
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kexec: replace crash_mem_range with range
2022-06-16 2:03 ` Baoquan He
@ 2022-06-16 2:37 ` Li Chen
-1 siblings, 0 replies; 8+ messages in thread
From: Li Chen @ 2022-06-16 2:37 UTC (permalink / raw)
To: Baoquan He
Cc: linuxppc-dev, Michael Ellerman, Benjamin Herrenschmidt,
Paul Mackerras, Eric Biederman, kexec
Hi Baoquan,
---- On Wed, 15 Jun 2022 19:03:53 -0700 Baoquan He <bhe@redhat.com> wrote ----
> On 06/14/22 at 10:04pm, Li Chen wrote:
> > From: Li Chen <lchen@ambarella.com>
> >
> > We already have struct range, so just use it.
>
> Looks good, have you tested it?
No, I don't have ppc machine, just pass compile on x86.
Regards,
Li
>
> >
> > Signed-off-by: Li Chen <lchen@ambarella.com>
> > ---
> > arch/powerpc/kexec/file_load_64.c | 2 +-
> > arch/powerpc/kexec/ranges.c | 8 ++++----
> > include/linux/kexec.h | 7 ++-----
> > kernel/kexec_file.c | 2 +-
> > 4 files changed, 8 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> > index b4981b651d9a..583b7fc478f2 100644
> > --- a/arch/powerpc/kexec/file_load_64.c
> > +++ b/arch/powerpc/kexec/file_load_64.c
> > @@ -34,7 +34,7 @@ struct umem_info {
> >
> > /* usable memory ranges to look up */
> > unsigned int nr_ranges;
> > - const struct crash_mem_range *ranges;
> > + const struct range *ranges;
> > };
> >
> > const struct kexec_file_ops * const kexec_file_loaders[] = {
> > diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
> > index 563e9989a5bf..5fc53a5fcfdf 100644
> > --- a/arch/powerpc/kexec/ranges.c
> > +++ b/arch/powerpc/kexec/ranges.c
> > @@ -33,7 +33,7 @@
> > static inline unsigned int get_max_nr_ranges(size_t size)
> > {
> > return ((size - sizeof(struct crash_mem)) /
> > - sizeof(struct crash_mem_range));
> > + sizeof(struct range));
> > }
> >
> > /**
> > @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
> > return 0;
> >
> > size = (sizeof(struct crash_mem) +
> > - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
> > + (mem_rngs->max_nr_ranges * sizeof(struct range)));
> >
> > /*
> > * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
> > @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
> > */
> > static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > {
> > - struct crash_mem_range *ranges;
> > + struct range *ranges;
> > int i, idx;
> >
> > if (!mem_rngs)
> > @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > /* cmp_func_t callback to sort ranges with sort() */
> > static int rngcmp(const void *_x, const void *_y)
> > {
> > - const struct crash_mem_range *x = _x, *y = _y;
> > + const struct range *x = _x, *y = _y;
> >
> > if (x->start > y->start)
> > return 1;
> > diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> > index 58d1b58a971e..d7ab4ad4c619 100644
> > --- a/include/linux/kexec.h
> > +++ b/include/linux/kexec.h
> > @@ -17,6 +17,7 @@
> >
> > #include <linux/crash_core.h>
> > #include <asm/io.h>
> > +#include <linux/range.h>
> >
> > #include <uapi/linux/kexec.h>
> >
> > @@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
> > /* Alignment required for elf header segment */
> > #define ELF_CORE_HEADER_ALIGN 4096
> >
> > -struct crash_mem_range {
> > - u64 start, end;
> > -};
> > -
> > struct crash_mem {
> > unsigned int max_nr_ranges;
> > unsigned int nr_ranges;
> > - struct crash_mem_range ranges[];
> > + struct range ranges[];
> > };
> >
> > extern int crash_exclude_mem_range(struct crash_mem *mem,
> > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> > index 8347fc158d2b..f2758af86b93 100644
> > --- a/kernel/kexec_file.c
> > +++ b/kernel/kexec_file.c
> > @@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> > {
> > int i, j;
> > unsigned long long start, end, p_start, p_end;
> > - struct crash_mem_range temp_range = {0, 0};
> > + struct range temp_range = {0, 0};
> >
> > for (i = 0; i < mem->nr_ranges; i++) {
> > start = mem->ranges[i].start;
> > --
> > 2.36.1
> >
> >
> >
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
> >
>
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kexec: replace crash_mem_range with range
@ 2022-06-16 2:37 ` Li Chen
0 siblings, 0 replies; 8+ messages in thread
From: Li Chen @ 2022-06-16 2:37 UTC (permalink / raw)
To: Baoquan He; +Cc: kexec, Paul Mackerras, Eric Biederman, linuxppc-dev
Hi Baoquan,
---- On Wed, 15 Jun 2022 19:03:53 -0700 Baoquan He <bhe@redhat.com> wrote ----
> On 06/14/22 at 10:04pm, Li Chen wrote:
> > From: Li Chen <lchen@ambarella.com>
> >
> > We already have struct range, so just use it.
>
> Looks good, have you tested it?
No, I don't have ppc machine, just pass compile on x86.
Regards,
Li
>
> >
> > Signed-off-by: Li Chen <lchen@ambarella.com>
> > ---
> > arch/powerpc/kexec/file_load_64.c | 2 +-
> > arch/powerpc/kexec/ranges.c | 8 ++++----
> > include/linux/kexec.h | 7 ++-----
> > kernel/kexec_file.c | 2 +-
> > 4 files changed, 8 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> > index b4981b651d9a..583b7fc478f2 100644
> > --- a/arch/powerpc/kexec/file_load_64.c
> > +++ b/arch/powerpc/kexec/file_load_64.c
> > @@ -34,7 +34,7 @@ struct umem_info {
> >
> > /* usable memory ranges to look up */
> > unsigned int nr_ranges;
> > - const struct crash_mem_range *ranges;
> > + const struct range *ranges;
> > };
> >
> > const struct kexec_file_ops * const kexec_file_loaders[] = {
> > diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
> > index 563e9989a5bf..5fc53a5fcfdf 100644
> > --- a/arch/powerpc/kexec/ranges.c
> > +++ b/arch/powerpc/kexec/ranges.c
> > @@ -33,7 +33,7 @@
> > static inline unsigned int get_max_nr_ranges(size_t size)
> > {
> > return ((size - sizeof(struct crash_mem)) /
> > - sizeof(struct crash_mem_range));
> > + sizeof(struct range));
> > }
> >
> > /**
> > @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
> > return 0;
> >
> > size = (sizeof(struct crash_mem) +
> > - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
> > + (mem_rngs->max_nr_ranges * sizeof(struct range)));
> >
> > /*
> > * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
> > @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
> > */
> > static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > {
> > - struct crash_mem_range *ranges;
> > + struct range *ranges;
> > int i, idx;
> >
> > if (!mem_rngs)
> > @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > /* cmp_func_t callback to sort ranges with sort() */
> > static int rngcmp(const void *_x, const void *_y)
> > {
> > - const struct crash_mem_range *x = _x, *y = _y;
> > + const struct range *x = _x, *y = _y;
> >
> > if (x->start > y->start)
> > return 1;
> > diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> > index 58d1b58a971e..d7ab4ad4c619 100644
> > --- a/include/linux/kexec.h
> > +++ b/include/linux/kexec.h
> > @@ -17,6 +17,7 @@
> >
> > #include <linux/crash_core.h>
> > #include <asm/io.h>
> > +#include <linux/range.h>
> >
> > #include <uapi/linux/kexec.h>
> >
> > @@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
> > /* Alignment required for elf header segment */
> > #define ELF_CORE_HEADER_ALIGN 4096
> >
> > -struct crash_mem_range {
> > - u64 start, end;
> > -};
> > -
> > struct crash_mem {
> > unsigned int max_nr_ranges;
> > unsigned int nr_ranges;
> > - struct crash_mem_range ranges[];
> > + struct range ranges[];
> > };
> >
> > extern int crash_exclude_mem_range(struct crash_mem *mem,
> > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> > index 8347fc158d2b..f2758af86b93 100644
> > --- a/kernel/kexec_file.c
> > +++ b/kernel/kexec_file.c
> > @@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> > {
> > int i, j;
> > unsigned long long start, end, p_start, p_end;
> > - struct crash_mem_range temp_range = {0, 0};
> > + struct range temp_range = {0, 0};
> >
> > for (i = 0; i < mem->nr_ranges; i++) {
> > start = mem->ranges[i].start;
> > --
> > 2.36.1
> >
> >
> >
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
> >
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kexec: replace crash_mem_range with range
2022-06-16 2:37 ` Li Chen
@ 2022-06-24 2:16 ` Baoquan He
-1 siblings, 0 replies; 8+ messages in thread
From: Baoquan He @ 2022-06-24 2:16 UTC (permalink / raw)
To: Li Chen, linuxppc-dev
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Eric Biederman, kexec
Hi,
On 06/15/22 at 07:37pm, Li Chen wrote:
> Hi Baoquan,
>
> ---- On Wed, 15 Jun 2022 19:03:53 -0700 Baoquan He <bhe@redhat.com> wrote ----
> > On 06/14/22 at 10:04pm, Li Chen wrote:
> > > From: Li Chen <lchen@ambarella.com>
> > >
> > > We already have struct range, so just use it.
> >
> > Looks good, have you tested it?
>
> No, I don't have ppc machine, just pass compile on x86.
Can someone from ppc side help test this patch? If no, I will try to
find a ppc machine to run the test. Thanks in advance.
Thanks
Baoquan
>
>
> >
> > >
> > > Signed-off-by: Li Chen <lchen@ambarella.com>
> > > ---
> > > arch/powerpc/kexec/file_load_64.c | 2 +-
> > > arch/powerpc/kexec/ranges.c | 8 ++++----
> > > include/linux/kexec.h | 7 ++-----
> > > kernel/kexec_file.c | 2 +-
> > > 4 files changed, 8 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> > > index b4981b651d9a..583b7fc478f2 100644
> > > --- a/arch/powerpc/kexec/file_load_64.c
> > > +++ b/arch/powerpc/kexec/file_load_64.c
> > > @@ -34,7 +34,7 @@ struct umem_info {
> > >
> > > /* usable memory ranges to look up */
> > > unsigned int nr_ranges;
> > > - const struct crash_mem_range *ranges;
> > > + const struct range *ranges;
> > > };
> > >
> > > const struct kexec_file_ops * const kexec_file_loaders[] = {
> > > diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
> > > index 563e9989a5bf..5fc53a5fcfdf 100644
> > > --- a/arch/powerpc/kexec/ranges.c
> > > +++ b/arch/powerpc/kexec/ranges.c
> > > @@ -33,7 +33,7 @@
> > > static inline unsigned int get_max_nr_ranges(size_t size)
> > > {
> > > return ((size - sizeof(struct crash_mem)) /
> > > - sizeof(struct crash_mem_range));
> > > + sizeof(struct range));
> > > }
> > >
> > > /**
> > > @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
> > > return 0;
> > >
> > > size = (sizeof(struct crash_mem) +
> > > - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
> > > + (mem_rngs->max_nr_ranges * sizeof(struct range)));
> > >
> > > /*
> > > * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
> > > @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
> > > */
> > > static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > > {
> > > - struct crash_mem_range *ranges;
> > > + struct range *ranges;
> > > int i, idx;
> > >
> > > if (!mem_rngs)
> > > @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > > /* cmp_func_t callback to sort ranges with sort() */
> > > static int rngcmp(const void *_x, const void *_y)
> > > {
> > > - const struct crash_mem_range *x = _x, *y = _y;
> > > + const struct range *x = _x, *y = _y;
> > >
> > > if (x->start > y->start)
> > > return 1;
> > > diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> > > index 58d1b58a971e..d7ab4ad4c619 100644
> > > --- a/include/linux/kexec.h
> > > +++ b/include/linux/kexec.h
> > > @@ -17,6 +17,7 @@
> > >
> > > #include <linux/crash_core.h>
> > > #include <asm/io.h>
> > > +#include <linux/range.h>
> > >
> > > #include <uapi/linux/kexec.h>
> > >
> > > @@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
> > > /* Alignment required for elf header segment */
> > > #define ELF_CORE_HEADER_ALIGN 4096
> > >
> > > -struct crash_mem_range {
> > > - u64 start, end;
> > > -};
> > > -
> > > struct crash_mem {
> > > unsigned int max_nr_ranges;
> > > unsigned int nr_ranges;
> > > - struct crash_mem_range ranges[];
> > > + struct range ranges[];
> > > };
> > >
> > > extern int crash_exclude_mem_range(struct crash_mem *mem,
> > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> > > index 8347fc158d2b..f2758af86b93 100644
> > > --- a/kernel/kexec_file.c
> > > +++ b/kernel/kexec_file.c
> > > @@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> > > {
> > > int i, j;
> > > unsigned long long start, end, p_start, p_end;
> > > - struct crash_mem_range temp_range = {0, 0};
> > > + struct range temp_range = {0, 0};
> > >
> > > for (i = 0; i < mem->nr_ranges; i++) {
> > > start = mem->ranges[i].start;
> > > --
> > > 2.36.1
> > >
> > >
> > >
> > > _______________________________________________
> > > kexec mailing list
> > > kexec@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/kexec
> > >
> >
> >
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] kexec: replace crash_mem_range with range
@ 2022-06-24 2:16 ` Baoquan He
0 siblings, 0 replies; 8+ messages in thread
From: Baoquan He @ 2022-06-24 2:16 UTC (permalink / raw)
To: Li Chen, linuxppc-dev; +Cc: Paul Mackerras, Eric Biederman, kexec
Hi,
On 06/15/22 at 07:37pm, Li Chen wrote:
> Hi Baoquan,
>
> ---- On Wed, 15 Jun 2022 19:03:53 -0700 Baoquan He <bhe@redhat.com> wrote ----
> > On 06/14/22 at 10:04pm, Li Chen wrote:
> > > From: Li Chen <lchen@ambarella.com>
> > >
> > > We already have struct range, so just use it.
> >
> > Looks good, have you tested it?
>
> No, I don't have ppc machine, just pass compile on x86.
Can someone from ppc side help test this patch? If no, I will try to
find a ppc machine to run the test. Thanks in advance.
Thanks
Baoquan
>
>
> >
> > >
> > > Signed-off-by: Li Chen <lchen@ambarella.com>
> > > ---
> > > arch/powerpc/kexec/file_load_64.c | 2 +-
> > > arch/powerpc/kexec/ranges.c | 8 ++++----
> > > include/linux/kexec.h | 7 ++-----
> > > kernel/kexec_file.c | 2 +-
> > > 4 files changed, 8 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> > > index b4981b651d9a..583b7fc478f2 100644
> > > --- a/arch/powerpc/kexec/file_load_64.c
> > > +++ b/arch/powerpc/kexec/file_load_64.c
> > > @@ -34,7 +34,7 @@ struct umem_info {
> > >
> > > /* usable memory ranges to look up */
> > > unsigned int nr_ranges;
> > > - const struct crash_mem_range *ranges;
> > > + const struct range *ranges;
> > > };
> > >
> > > const struct kexec_file_ops * const kexec_file_loaders[] = {
> > > diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c
> > > index 563e9989a5bf..5fc53a5fcfdf 100644
> > > --- a/arch/powerpc/kexec/ranges.c
> > > +++ b/arch/powerpc/kexec/ranges.c
> > > @@ -33,7 +33,7 @@
> > > static inline unsigned int get_max_nr_ranges(size_t size)
> > > {
> > > return ((size - sizeof(struct crash_mem)) /
> > > - sizeof(struct crash_mem_range));
> > > + sizeof(struct range));
> > > }
> > >
> > > /**
> > > @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs)
> > > return 0;
> > >
> > > size = (sizeof(struct crash_mem) +
> > > - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range)));
> > > + (mem_rngs->max_nr_ranges * sizeof(struct range)));
> > >
> > > /*
> > > * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ.
> > > @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size)
> > > */
> > > static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > > {
> > > - struct crash_mem_range *ranges;
> > > + struct range *ranges;
> > > int i, idx;
> > >
> > > if (!mem_rngs)
> > > @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs)
> > > /* cmp_func_t callback to sort ranges with sort() */
> > > static int rngcmp(const void *_x, const void *_y)
> > > {
> > > - const struct crash_mem_range *x = _x, *y = _y;
> > > + const struct range *x = _x, *y = _y;
> > >
> > > if (x->start > y->start)
> > > return 1;
> > > diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> > > index 58d1b58a971e..d7ab4ad4c619 100644
> > > --- a/include/linux/kexec.h
> > > +++ b/include/linux/kexec.h
> > > @@ -17,6 +17,7 @@
> > >
> > > #include <linux/crash_core.h>
> > > #include <asm/io.h>
> > > +#include <linux/range.h>
> > >
> > > #include <uapi/linux/kexec.h>
> > >
> > > @@ -214,14 +215,10 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf);
> > > /* Alignment required for elf header segment */
> > > #define ELF_CORE_HEADER_ALIGN 4096
> > >
> > > -struct crash_mem_range {
> > > - u64 start, end;
> > > -};
> > > -
> > > struct crash_mem {
> > > unsigned int max_nr_ranges;
> > > unsigned int nr_ranges;
> > > - struct crash_mem_range ranges[];
> > > + struct range ranges[];
> > > };
> > >
> > > extern int crash_exclude_mem_range(struct crash_mem *mem,
> > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
> > > index 8347fc158d2b..f2758af86b93 100644
> > > --- a/kernel/kexec_file.c
> > > +++ b/kernel/kexec_file.c
> > > @@ -1183,7 +1183,7 @@ int crash_exclude_mem_range(struct crash_mem *mem,
> > > {
> > > int i, j;
> > > unsigned long long start, end, p_start, p_end;
> > > - struct crash_mem_range temp_range = {0, 0};
> > > + struct range temp_range = {0, 0};
> > >
> > > for (i = 0; i < mem->nr_ranges; i++) {
> > > start = mem->ranges[i].start;
> > > --
> > > 2.36.1
> > >
> > >
> > >
> > > _______________________________________________
> > > kexec mailing list
> > > kexec@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/kexec
> > >
> >
> >
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-06-24 2:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 5:04 [PATCH] kexec: replace crash_mem_range with range Li Chen
2022-06-15 5:04 ` Li Chen
2022-06-16 2:03 ` Baoquan He
2022-06-16 2:03 ` Baoquan He
2022-06-16 2:37 ` Li Chen
2022-06-16 2:37 ` Li Chen
2022-06-24 2:16 ` Baoquan He
2022-06-24 2:16 ` Baoquan He
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.