Re: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
On 17/08/16 04:49, Thiago Jung Bauermann wrote: > Am Dienstag, 16 August 2016, 16:15:55 schrieb Balbir Singh: >> On 16/08/16 00:49, Thiago Jung Bauermann wrote: >>> Am Montag, 15 August 2016, 17:30:49 schrieb Balbir Singh: >>>> On Thu, Aug 11, 2016 at 08:08:07PM -0300, Thiago Jung Bauermann wrote: >>>>> Adapt all callers to the new function prototype. >>>> >>>> Could you please expand on this? >>> >>> Is the following better? >>> >>> Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. >> >> Yes and the reason for doing so? Consolidation/clarity of implementation? > > Indeed. What about this commit message? > > Subject: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take > kexec_buf as argument. > > This is done to simplify the kexec_add_buffer argument list. > Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. > > In addition, change the type of kexec_buf.buffer from char * to void *. > There is no particular reason for it to be a char *, and the change > allows us to get rid of 3 existing casts to char * in the code. > > Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com> > Acked-by: Dave Young <dyo...@redhat.com> > Acked-by: Balbir Singh <bsinghar...@gmail.com> > Looks good Balbir ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
Am Dienstag, 16 August 2016, 16:15:55 schrieb Balbir Singh: > On 16/08/16 00:49, Thiago Jung Bauermann wrote: > > Am Montag, 15 August 2016, 17:30:49 schrieb Balbir Singh: > >> On Thu, Aug 11, 2016 at 08:08:07PM -0300, Thiago Jung Bauermann wrote: > >>> Adapt all callers to the new function prototype. > >> > >> Could you please expand on this? > > > > Is the following better? > > > > Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. > > Yes and the reason for doing so? Consolidation/clarity of implementation? Indeed. What about this commit message? Subject: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument. This is done to simplify the kexec_add_buffer argument list. Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. In addition, change the type of kexec_buf.buffer from char * to void *. There is no particular reason for it to be a char *, and the change allows us to get rid of 3 existing casts to char * in the code. Signed-off-by: Thiago Jung Bauermann <bauer...@linux.vnet.ibm.com> Acked-by: Dave Young <dyo...@redhat.com> Acked-by: Balbir Singh <bsinghar...@gmail.com> -- []'s Thiago Jung Bauermann IBM Linux Technology Center ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
On 16/08/16 00:49, Thiago Jung Bauermann wrote: > Am Montag, 15 August 2016, 17:30:49 schrieb Balbir Singh: >> On Thu, Aug 11, 2016 at 08:08:07PM -0300, Thiago Jung Bauermann wrote: >>> Adapt all callers to the new function prototype. >> >> Could you please expand on this? > > Is the following better? > > Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. Yes and the reason for doing so? Consolidation/clarity of implementation? > >> Looks good otherwise >> >> Acked-by: Balbir Singh> > Thank you for reviewing this series! > ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
Am Montag, 15 August 2016, 17:30:49 schrieb Balbir Singh: > On Thu, Aug 11, 2016 at 08:08:07PM -0300, Thiago Jung Bauermann wrote: > > Adapt all callers to the new function prototype. > > Could you please expand on this? Is the following better? Adapt all callers to set up a kexec_buf to pass to kexec_add_buffer. > Looks good otherwise > > Acked-by: Balbir SinghThank you for reviewing this series! -- []'s Thiago Jung Bauermann IBM Linux Technology Center ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
On Thu, Aug 11, 2016 at 08:08:07PM -0300, Thiago Jung Bauermann wrote: > Adapt all callers to the new function prototype. > Could you please expand on this? > In addition, change the type of kexec_buf.buffer from char * to void *. > There is no particular reason for it to be a char *, and the change > allows us to get rid of 3 existing casts to char * in the code. > > Signed-off-by: Thiago Jung Bauermann> Acked-by: Dave Young > --- Looks good otherwise Acked-by: Balbir Singh ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v5 02/13] kexec_file: Change kexec_add_buffer to take kexec_buf as argument.
Adapt all callers to the new function prototype. In addition, change the type of kexec_buf.buffer from char * to void *. There is no particular reason for it to be a char *, and the change allows us to get rid of 3 existing casts to char * in the code. Signed-off-by: Thiago Jung BauermannAcked-by: Dave Young --- arch/x86/kernel/crash.c | 37 arch/x86/kernel/kexec-bzimage64.c | 48 +++-- include/linux/kexec.h | 8 +--- kernel/kexec_file.c | 88 ++- 4 files changed, 87 insertions(+), 94 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 9616cf76940c..38a1cdf6aa05 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -615,9 +615,9 @@ static int determine_backup_region(u64 start, u64 end, void *arg) int crash_load_segments(struct kimage *image) { - unsigned long src_start, src_sz, elf_sz; - void *elf_addr; int ret; + struct kexec_buf kbuf = { .image = image, .buf_min = 0, + .buf_max = ULONG_MAX, .top_down = false }; /* * Determine and load a segment for backup area. First 640K RAM @@ -631,43 +631,44 @@ int crash_load_segments(struct kimage *image) if (ret < 0) return ret; - src_start = image->arch.backup_src_start; - src_sz = image->arch.backup_src_sz; - /* Add backup segment. */ - if (src_sz) { + if (image->arch.backup_src_sz) { + kbuf.buffer = _zero_bytes; + kbuf.bufsz = sizeof(crash_zero_bytes); + kbuf.memsz = image->arch.backup_src_sz; + kbuf.buf_align = PAGE_SIZE; /* * Ideally there is no source for backup segment. This is * copied in purgatory after crash. Just add a zero filled * segment for now to make sure checksum logic works fine. */ - ret = kexec_add_buffer(image, (char *)_zero_bytes, - sizeof(crash_zero_bytes), src_sz, - PAGE_SIZE, 0, -1, 0, - >arch.backup_load_addr); + ret = kexec_add_buffer(); if (ret) return ret; + image->arch.backup_load_addr = kbuf.mem; pr_debug("Loaded backup region at 0x%lx backup_start=0x%lx memsz=0x%lx\n", -image->arch.backup_load_addr, src_start, src_sz); +image->arch.backup_load_addr, +image->arch.backup_src_start, kbuf.memsz); } /* Prepare elf headers and add a segment */ - ret = prepare_elf_headers(image, _addr, _sz); + ret = prepare_elf_headers(image, , ); if (ret) return ret; - image->arch.elf_headers = elf_addr; - image->arch.elf_headers_sz = elf_sz; + image->arch.elf_headers = kbuf.buffer; + image->arch.elf_headers_sz = kbuf.bufsz; - ret = kexec_add_buffer(image, (char *)elf_addr, elf_sz, elf_sz, - ELF_CORE_HEADER_ALIGN, 0, -1, 0, - >arch.elf_load_addr); + kbuf.memsz = kbuf.bufsz; + kbuf.buf_align = ELF_CORE_HEADER_ALIGN; + ret = kexec_add_buffer(); if (ret) { vfree((void *)image->arch.elf_headers); return ret; } + image->arch.elf_load_addr = kbuf.mem; pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n", -image->arch.elf_load_addr, elf_sz, elf_sz); +image->arch.elf_load_addr, kbuf.bufsz, kbuf.bufsz); return ret; } diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index f2356bda2b05..4b3a75329fb6 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c @@ -331,17 +331,17 @@ static void *bzImage64_load(struct kimage *image, char *kernel, struct setup_header *header; int setup_sects, kern16_size, ret = 0; - unsigned long setup_header_size, params_cmdline_sz, params_misc_sz; + unsigned long setup_header_size, params_cmdline_sz; struct boot_params *params; unsigned long bootparam_load_addr, kernel_load_addr, initrd_load_addr; unsigned long purgatory_load_addr; - unsigned long kernel_bufsz, kernel_memsz, kernel_align; - char *kernel_buf; struct bzimage64_data *ldata; struct kexec_entry64_regs regs64; void *stack; unsigned int setup_hdr_offset = offsetof(struct boot_params, hdr); unsigned int efi_map_offset, efi_map_sz, efi_setup_data_offset; + struct kexec_buf kbuf = { .image = image, .buf_max = ULONG_MAX, + .top_down = true }; header =