* + kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch added to -mm tree
@ 2016-08-25 21:13 akpm
0 siblings, 0 replies; 5+ messages in thread
From: akpm @ 2016-08-25 21:13 UTC (permalink / raw
To: bauerman, benh, bhe, bsingharora, dyoung, ebiederm, hpa, mingo,
mpe, paulus, sam, stewart, tglx, vgoyal, zohar, mm-commits
The patch titled
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
has been added to the -mm tree. Its filename is
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load
implementation to find free memory for the purgatory stack.
Link: http://lkml.kernel.org/r/1471652242-14436-4-git-send-email-bauerman@linux.vnet.ibm.com
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kexec.h | 1 +
kernel/kexec_file.c | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff -puN include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer include/linux/kexec.h
--- a/include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/include/linux/kexec.h
@@ -176,6 +176,7 @@ struct kexec_buf {
int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
int (*func)(u64, u64, void *));
extern int kexec_add_buffer(struct kexec_buf *kbuf);
+int kexec_locate_mem_hole(struct kexec_buf *kbuf);
#endif /* CONFIG_KEXEC_FILE */
struct kimage {
diff -puN kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer kernel/kexec_file.c
--- a/kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/kernel/kexec_file.c
@@ -450,6 +450,23 @@ int __weak arch_kexec_walk_mem(struct ke
}
/**
+ * kexec_locate_mem_hole - find free memory for the purgatory or the next kernel
+ * @kbuf: Parameters for the memory search.
+ *
+ * On success, kbuf->mem will have the start address of the memory region found.
+ *
+ * Return: 0 on success, negative errno on error.
+ */
+int kexec_locate_mem_hole(struct kexec_buf *kbuf)
+{
+ int ret;
+
+ ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
+
+ return ret == 1 ? 0 : -EADDRNOTAVAIL;
+}
+
+/**
* kexec_add_buffer - place a buffer in a kexec segment
* @kbuf: Buffer contents and memory parameters.
*
@@ -489,11 +506,9 @@ int kexec_add_buffer(struct kexec_buf *k
kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE);
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
- if (ret != 1) {
- /* A suitable memory range could not be found for buffer */
- return -EADDRNOTAVAIL;
- }
+ ret = kexec_locate_mem_hole(kbuf);
+ if (ret)
+ return ret;
/* Found a suitable memory range */
ksegment = &kbuf->image->segment[kbuf->image->nr_segments];
_
Patches currently in -mm which might be from bauerman@linux.vnet.ibm.com are
kexec_file-allow-arch-specific-memory-walking-for-kexec_add_buffer.patch
kexec_file-change-kexec_add_buffer-to-take-kexec_buf-as-argument.patch
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
powerpc-factor-out-relocation-code-from-module_64c-to-elf_util_64c.patch
powerpc-generalize-elf64_apply_relocate_add.patch
powerpc-adapt-elf64_apply_relocate_add-for-kexec_file_load.patch
powerpc-add-functions-to-read-elf-files-of-any-endianness.patch
powerpc-implement-kexec_file_load.patch
powerpc-add-code-to-work-with-device-trees-in-kexec_file_load.patch
powerpc-add-support-for-loading-elf-kernels-with-kexec_file_load.patch
powerpc-add-purgatory-for-kexec_file_load-implementation.patch
powerpc-enable-config_kexec_file-in-powerpc-server-defconfigs.patch
kexec_file-add-buffer-hand-over-support-for-the-next-kernel.patch
powerpc-kexec_file-add-buffer-hand-over-support-for-the-next-kernel.patch
kexec_file-allow-skipping-checksum-calculation-for-some-segments.patch
kexec_file-add-mechanism-to-update-kexec-segments.patch
ima-demonstration-code-for-kexec-buffer-passing.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* + kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch added to -mm tree
@ 2016-09-16 23:34 akpm
0 siblings, 0 replies; 5+ messages in thread
From: akpm @ 2016-09-16 23:34 UTC (permalink / raw
To: bauerman, benh, bhe, bsingharora, dyoung, ebiederm, hpa, mingo,
mpe, paulus, sam, stewart, tglx, vgoyal, zohar, mm-commits
The patch titled
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
has been added to the -mm tree. Its filename is
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load
implementation to find free memory for the purgatory stack.
Link: http://lkml.kernel.org/r/1472579041-26033-4-git-send-email-bauerman@linux.vnet.ibm.com
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kexec.h | 1 +
kernel/kexec_file.c | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff -puN include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer include/linux/kexec.h
--- a/include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/include/linux/kexec.h
@@ -176,6 +176,7 @@ struct kexec_buf {
int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
int (*func)(u64, u64, void *));
extern int kexec_add_buffer(struct kexec_buf *kbuf);
+int kexec_locate_mem_hole(struct kexec_buf *kbuf);
#endif /* CONFIG_KEXEC_FILE */
struct kimage {
diff -puN kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer kernel/kexec_file.c
--- a/kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/kernel/kexec_file.c
@@ -450,6 +450,23 @@ int __weak arch_kexec_walk_mem(struct ke
}
/**
+ * kexec_locate_mem_hole - find free memory for the purgatory or the next kernel
+ * @kbuf: Parameters for the memory search.
+ *
+ * On success, kbuf->mem will have the start address of the memory region found.
+ *
+ * Return: 0 on success, negative errno on error.
+ */
+int kexec_locate_mem_hole(struct kexec_buf *kbuf)
+{
+ int ret;
+
+ ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
+
+ return ret == 1 ? 0 : -EADDRNOTAVAIL;
+}
+
+/**
* kexec_add_buffer - place a buffer in a kexec segment
* @kbuf: Buffer contents and memory parameters.
*
@@ -489,11 +506,9 @@ int kexec_add_buffer(struct kexec_buf *k
kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE);
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
- if (ret != 1) {
- /* A suitable memory range could not be found for buffer */
- return -EADDRNOTAVAIL;
- }
+ ret = kexec_locate_mem_hole(kbuf);
+ if (ret)
+ return ret;
/* Found a suitable memory range */
ksegment = &kbuf->image->segment[kbuf->image->nr_segments];
_
Patches currently in -mm which might be from bauerman@linux.vnet.ibm.com are
kexec_file-allow-arch-specific-memory-walking-for-kexec_add_buffer.patch
kexec_file-change-kexec_add_buffer-to-take-kexec_buf-as-argument.patch
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
powerpc-change-places-using-config_kexec-to-use-config_kexec_core-instead.patch
powerpc-factor-out-relocation-code-from-module_64c-to-elf_util_64c.patch
powerpc-generalize-elf64_apply_relocate_add.patch
powerpc-adapt-elf64_apply_relocate_add-for-kexec_file_load.patch
powerpc-add-functions-to-read-elf-files-of-any-endianness.patch
powerpc-implement-kexec_file_load.patch
powerpc-add-code-to-work-with-device-trees-in-kexec_file_load.patch
powerpc-add-support-for-loading-elf-kernels-with-kexec_file_load.patch
powerpc-add-support-for-loading-elf-kernels-with-kexec_file_load-fix.patch
powerpc-add-purgatory-for-kexec_file_load-implementation.patch
powerpc-add-purgatory-for-kexec_file_load-implementation-fix.patch
powerpc-enable-config_kexec_file-in-powerpc-server-defconfigs.patch
kexec_file-include-the-purgatory-segment-in-the-kexec-image-checksum.patch
kexec_file-add-buffer-hand-over-support-for-the-next-kernel.patch
powerpc-kexec_file-add-buffer-hand-over-support-for-the-next-kernel.patch
kexec_file-add-mechanism-to-update-kexec-segments.patch
ima-on-soft-reboot-save-the-measurement-list.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* + kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch added to -mm tree
@ 2016-10-24 19:42 akpm
0 siblings, 0 replies; 5+ messages in thread
From: akpm @ 2016-10-24 19:42 UTC (permalink / raw
To: bauerman, andreas.steffen, bsingharora, dyoung, ebiederm, mpe,
sklar, zohar, mm-commits
The patch titled
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
has been added to the -mm tree. Its filename is
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load
implementation to find free memory for the purgatory stack.
Link: http://lkml.kernel.org/r/1477017617-8540-4-git-send-email-bauerman@linux.vnet.ibm.com
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andreas Steffen <andreas.steffen@strongswan.org>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Josh Sklar <sklar@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kexec.h | 1 +
kernel/kexec_file.c | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff -puN include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer include/linux/kexec.h
--- a/include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/include/linux/kexec.h
@@ -176,6 +176,7 @@ struct kexec_buf {
int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
int (*func)(u64, u64, void *));
extern int kexec_add_buffer(struct kexec_buf *kbuf);
+int kexec_locate_mem_hole(struct kexec_buf *kbuf);
#endif /* CONFIG_KEXEC_FILE */
struct kimage {
diff -puN kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer kernel/kexec_file.c
--- a/kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/kernel/kexec_file.c
@@ -450,6 +450,23 @@ int __weak arch_kexec_walk_mem(struct ke
}
/**
+ * kexec_locate_mem_hole - find free memory for the purgatory or the next kernel
+ * @kbuf: Parameters for the memory search.
+ *
+ * On success, kbuf->mem will have the start address of the memory region found.
+ *
+ * Return: 0 on success, negative errno on error.
+ */
+int kexec_locate_mem_hole(struct kexec_buf *kbuf)
+{
+ int ret;
+
+ ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
+
+ return ret == 1 ? 0 : -EADDRNOTAVAIL;
+}
+
+/**
* kexec_add_buffer - place a buffer in a kexec segment
* @kbuf: Buffer contents and memory parameters.
*
@@ -489,11 +506,9 @@ int kexec_add_buffer(struct kexec_buf *k
kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE);
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
- if (ret != 1) {
- /* A suitable memory range could not be found for buffer */
- return -EADDRNOTAVAIL;
- }
+ ret = kexec_locate_mem_hole(kbuf);
+ if (ret)
+ return ret;
/* Found a suitable memory range */
ksegment = &kbuf->image->segment[kbuf->image->nr_segments];
_
Patches currently in -mm which might be from bauerman@linux.vnet.ibm.com are
kexec_file-allow-arch-specific-memory-walking-for-kexec_add_buffer.patch
kexec_file-change-kexec_add_buffer-to-take-kexec_buf-as-argument.patch
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
powerpc-change-places-using-config_kexec-to-use-config_kexec_core-instead.patch
powerpc-factor-out-relocation-code-in-module_64c.patch
powerpc-implement-kexec_file_load.patch
powerpc-add-functions-to-read-elf-files-of-any-endianness.patch
powerpc-add-support-for-loading-elf-kernels-with-kexec_file_load.patch
powerpc-add-purgatory-for-kexec_file_load-implementation.patch
powerpc-enable-config_kexec_file-in-powerpc-server-defconfigs.patch
powerpc-ima-get-the-kexec-buffer-passed-by-the-previous-kernel.patch
powerpc-ima-send-the-kexec-buffer-to-the-next-kernel.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* + kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch added to -mm tree
@ 2016-11-16 0:54 akpm
0 siblings, 0 replies; 5+ messages in thread
From: akpm @ 2016-11-16 0:54 UTC (permalink / raw
To: bauerman, benh, bhe, bsingharora, dyoung, ebiederm, hpa, mingo,
mpe, paulus, sfr, sklar, stewart, tglx, vgoyal, zohar, mm-commits
The patch titled
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
has been added to the -mm tree. Its filename is
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load
implementation to find free memory for the purgatory stack.
Link: http://lkml.kernel.org/r/1478748449-3894-4-git-send-email-bauerman@linux.vnet.ibm.com
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: Josh Sklar <sklar@linux.vnet.ibm.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kexec.h | 1 +
kernel/kexec_file.c | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff -puN include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer include/linux/kexec.h
--- a/include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/include/linux/kexec.h
@@ -176,6 +176,7 @@ struct kexec_buf {
int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
int (*func)(u64, u64, void *));
extern int kexec_add_buffer(struct kexec_buf *kbuf);
+int kexec_locate_mem_hole(struct kexec_buf *kbuf);
#endif /* CONFIG_KEXEC_FILE */
struct kimage {
diff -puN kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer kernel/kexec_file.c
--- a/kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/kernel/kexec_file.c
@@ -450,6 +450,23 @@ int __weak arch_kexec_walk_mem(struct ke
}
/**
+ * kexec_locate_mem_hole - find free memory for the purgatory or the next kernel
+ * @kbuf: Parameters for the memory search.
+ *
+ * On success, kbuf->mem will have the start address of the memory region found.
+ *
+ * Return: 0 on success, negative errno on error.
+ */
+int kexec_locate_mem_hole(struct kexec_buf *kbuf)
+{
+ int ret;
+
+ ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
+
+ return ret == 1 ? 0 : -EADDRNOTAVAIL;
+}
+
+/**
* kexec_add_buffer - place a buffer in a kexec segment
* @kbuf: Buffer contents and memory parameters.
*
@@ -489,11 +506,9 @@ int kexec_add_buffer(struct kexec_buf *k
kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE);
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
- if (ret != 1) {
- /* A suitable memory range could not be found for buffer */
- return -EADDRNOTAVAIL;
- }
+ ret = kexec_locate_mem_hole(kbuf);
+ if (ret)
+ return ret;
/* Found a suitable memory range */
ksegment = &kbuf->image->segment[kbuf->image->nr_segments];
_
Patches currently in -mm which might be from bauerman@linux.vnet.ibm.com are
kexec_file-allow-arch-specific-memory-walking-for-kexec_add_buffer.patch
kexec_file-change-kexec_add_buffer-to-take-kexec_buf-as-argument.patch
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
kexec_file-add-support-for-purgatory-built-as-pie.patch
powerpc-change-places-using-config_kexec-to-use-config_kexec_core-instead.patch
powerpc-implement-kexec_file_load.patch
powerpc-add-functions-to-read-elf-files-of-any-endianness.patch
powerpc-add-support-for-loading-elf-kernels-with-kexec_file_load.patch
powerpc-add-purgatory-for-kexec_file_load-implementation.patch
powerpc-enable-config_kexec_file-in-powerpc-server-defconfigs.patch
powerpc-ima-get-the-kexec-buffer-passed-by-the-previous-kernel.patch
powerpc-ima-send-the-kexec-buffer-to-the-next-kernel.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
* + kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch added to -mm tree
@ 2016-11-29 19:06 akpm
0 siblings, 0 replies; 5+ messages in thread
From: akpm @ 2016-11-29 19:06 UTC (permalink / raw
To: bauerman, benh, bhe, bsingharora, dyoung, ebiederm, hpa, mingo,
mpe, paulus, sfr, sklar, stewart, tglx, vgoyal, zohar, mm-commits
The patch titled
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
has been added to the -mm tree. Its filename is
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Subject: kexec_file: factor out kexec_locate_mem_hole from kexec_add_buffer
kexec_locate_mem_hole will be used by the PowerPC kexec_file_load
implementation to find free memory for the purgatory stack.
Link: http://lkml.kernel.org/r/1480423554-6411-4-git-send-email-mpe@ellerman.id.au
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Dave Young <dyoung@redhat.com>
Cc: Josh Sklar <sklar@linux.vnet.ibm.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/kexec.h | 1 +
kernel/kexec_file.c | 25 ++++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff -puN include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer include/linux/kexec.h
--- a/include/linux/kexec.h~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/include/linux/kexec.h
@@ -176,6 +176,7 @@ struct kexec_buf {
int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
int (*func)(u64, u64, void *));
extern int kexec_add_buffer(struct kexec_buf *kbuf);
+int kexec_locate_mem_hole(struct kexec_buf *kbuf);
#endif /* CONFIG_KEXEC_FILE */
struct kimage {
diff -puN kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer kernel/kexec_file.c
--- a/kernel/kexec_file.c~kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer
+++ a/kernel/kexec_file.c
@@ -450,6 +450,23 @@ int __weak arch_kexec_walk_mem(struct ke
}
/**
+ * kexec_locate_mem_hole - find free memory for the purgatory or the next kernel
+ * @kbuf: Parameters for the memory search.
+ *
+ * On success, kbuf->mem will have the start address of the memory region found.
+ *
+ * Return: 0 on success, negative errno on error.
+ */
+int kexec_locate_mem_hole(struct kexec_buf *kbuf)
+{
+ int ret;
+
+ ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
+
+ return ret == 1 ? 0 : -EADDRNOTAVAIL;
+}
+
+/**
* kexec_add_buffer - place a buffer in a kexec segment
* @kbuf: Buffer contents and memory parameters.
*
@@ -489,11 +506,9 @@ int kexec_add_buffer(struct kexec_buf *k
kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE);
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_walk_mem(kbuf, locate_mem_hole_callback);
- if (ret != 1) {
- /* A suitable memory range could not be found for buffer */
- return -EADDRNOTAVAIL;
- }
+ ret = kexec_locate_mem_hole(kbuf);
+ if (ret)
+ return ret;
/* Found a suitable memory range */
ksegment = &kbuf->image->segment[kbuf->image->nr_segments];
_
Patches currently in -mm which might be from bauerman@linux.vnet.ibm.com are
kexec_file-allow-arch-specific-memory-walking-for-kexec_add_buffer.patch
kexec_file-change-kexec_add_buffer-to-take-kexec_buf-as-argument.patch
kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch
powerpc-change-places-using-config_kexec-to-use-config_kexec_core-instead.patch
powerpc-add-support-code-for-kexec_file_load.patch
powerpc-add-purgatory-for-kexec_file_load-implementation.patch
powerpc-kexec-enable-kexec_file_load-syscall.patch
powerpc-enable-config_kexec_file-in-powerpc-server-defconfigs.patch
powerpc-ima-get-the-kexec-buffer-passed-by-the-previous-kernel.patch
powerpc-ima-send-the-kexec-buffer-to-the-next-kernel.patch
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-29 19:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-16 23:34 + kexec_file-factor-out-kexec_locate_mem_hole-from-kexec_add_buffer.patch added to -mm tree akpm
-- strict thread matches above, loose matches on Subject: below --
2016-11-29 19:06 akpm
2016-11-16 0:54 akpm
2016-10-24 19:42 akpm
2016-08-25 21:13 akpm
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.