From: Simon Horman <horms@verge.net.au>
To: WANG Chao <chaowang@redhat.com>
Cc: kexec@lists.infradead.org, linn@hp.com, hpa@zytor.com,
dyoung@redhat.com, trenn@suse.de, vgoyal@redhat.com,
ebiederm@xmission.com
Subject: Re: [PATCH RESEND v5 02/10] x86, cleanup: add extra arguments to add_memmap() and delete_memmap()
Date: Mon, 14 Apr 2014 11:11:50 +0900 [thread overview]
Message-ID: <20140414021149.GI22411@verge.net.au> (raw)
In-Reply-To: <1397183011-1526-3-git-send-email-chaowang@redhat.com>
On Fri, Apr 11, 2014 at 10:23:23AM +0800, WANG Chao wrote:
> This change will be used later:
>
> add_memmap(.., int *nr_memmap, .., int type);
> delete_memmap(.., int *nr_memmap, ..);
Could you please include an explanation of the motivation for this
change in the change log (i.e. here).
>
> Signed-off-by: WANG Chao <chaowang@redhat.com>
> ---
> kexec/arch/i386/crashdump-x86.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
> index 72bce0b..e695eaf 100644
> --- a/kexec/arch/i386/crashdump-x86.c
> +++ b/kexec/arch/i386/crashdump-x86.c
> @@ -476,8 +476,8 @@ static int exclude_region(int *nr_ranges, uint64_t start, uint64_t end)
>
> /* Adds a segment from list of memory regions which new kernel can use to
> * boot. Segment start and end should be aligned to 1K boundary. */
> -static int add_memmap(struct memory_range *memmap_p, unsigned long long addr,
> - size_t size)
> +static int add_memmap(struct memory_range *memmap_p, int *nr_memmap_p,
> + unsigned long long addr, size_t size, int type)
> {
> int i, j, nr_entries = 0, tidx = 0, align = 1024;
> unsigned long long mstart, mend;
> @@ -514,6 +514,8 @@ static int add_memmap(struct memory_range *memmap_p, unsigned long long addr,
> memmap_p[j+1] = memmap_p[j];
> memmap_p[tidx].start = addr;
> memmap_p[tidx].end = addr + size - 1;
> + memmap_p[tidx].type = type;
> + *nr_memmap_p = nr_entries + 1;
>
> dbgprintf("Memmap after adding segment\n");
> for (i = 0; i < CRASH_MAX_MEMMAP_NR; i++) {
> @@ -530,8 +532,8 @@ static int add_memmap(struct memory_range *memmap_p, unsigned long long addr,
>
> /* Removes a segment from list of memory regions which new kernel can use to
> * boot. Segment start and end should be aligned to 1K boundary. */
> -static int delete_memmap(struct memory_range *memmap_p, unsigned long long addr,
> - size_t size)
> +static int delete_memmap(struct memory_range *memmap_p, int *nr_memmap_p,
> + unsigned long long addr, size_t size)
> {
> int i, j, nr_entries = 0, tidx = -1, operation = 0, align = 1024;
> unsigned long long mstart, mend;
> @@ -593,12 +595,14 @@ static int delete_memmap(struct memory_range *memmap_p, unsigned long long addr,
> for (j = nr_entries-1; j > tidx; j--)
> memmap_p[j+1] = memmap_p[j];
> memmap_p[tidx+1] = temp_region;
> + *nr_memmap_p = nr_entries + 1;
> }
> if ((operation == -1) && tidx >=0) {
> /* Delete the exact match memory region. */
> for (j = i+1; j < CRASH_MAX_MEMMAP_NR; j++)
> memmap_p[j-1] = memmap_p[j];
> memmap_p[j-1].start = memmap_p[j-1].end = 0;
> + *nr_memmap_p = nr_entries - 1;
> }
>
> dbgprintf("Memmap after deleting segment\n");
> @@ -865,7 +869,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
> {
> void *tmp;
> unsigned long sz, bufsz, memsz, elfcorehdr;
> - int nr_ranges = 0, align = 1024, i;
> + int nr_ranges = 0, nr_memmap_p = 0, align = 1024, i;
> struct memory_range *mem_range, *memmap_p;
> struct crash_elf_info elf_info;
> unsigned kexec_arch;
> @@ -941,10 +945,10 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
> sz = (sizeof(struct memory_range) * CRASH_MAX_MEMMAP_NR);
> memmap_p = xmalloc(sz);
> memset(memmap_p, 0, sz);
> - add_memmap(memmap_p, info->backup_src_start, info->backup_src_size);
> + add_memmap(memmap_p, &nr_memmap_p, info->backup_src_start, info->backup_src_size, RANGE_RAM);
> for (i = 0; i < crash_reserved_mem_nr; i++) {
> sz = crash_reserved_mem[i].end - crash_reserved_mem[i].start +1;
> - if (add_memmap(memmap_p, crash_reserved_mem[i].start, sz) < 0)
> + if (add_memmap(memmap_p, &nr_memmap_p, crash_reserved_mem[i].start, sz, RANGE_RAM) < 0)
> return ENOCRASHKERNEL;
> }
>
> @@ -957,7 +961,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
> 0, max_addr, -1);
> dbgprintf("Created backup segment at 0x%lx\n",
> info->backup_start);
> - if (delete_memmap(memmap_p, info->backup_start, sz) < 0)
> + if (delete_memmap(memmap_p, &nr_memmap_p, info->backup_start, sz) < 0)
> return EFAILED;
> }
>
> @@ -993,7 +997,7 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
> elfcorehdr = add_buffer(info, tmp, bufsz, memsz, align, min_base,
> max_addr, -1);
> dbgprintf("Created elf header segment at 0x%lx\n", elfcorehdr);
> - if (delete_memmap(memmap_p, elfcorehdr, memsz) < 0)
> + if (delete_memmap(memmap_p, &nr_memmap_p, elfcorehdr, memsz) < 0)
> return -1;
> cmdline_add_memmap(mod_cmdline, memmap_p);
> if (!bzImage_support_efi_boot)
> --
> 1.8.5.3
>
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2014-04-14 2:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 2:23 [PATCH RESEND v5 00/10] kexec-tools, x86: E820 memmap pass for kdump WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 01/10] x86, cleanup: fix indent WANG Chao
2014-04-14 2:09 ` Simon Horman
2014-04-11 2:23 ` [PATCH RESEND v5 02/10] x86, cleanup: add extra arguments to add_memmap() and delete_memmap() WANG Chao
2014-04-14 2:11 ` Simon Horman [this message]
2014-04-14 5:41 ` WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 03/10] x86, cleanup: add other types of memory range for 2nd kernel boot to memmap_p WANG Chao
2014-04-14 2:12 ` Simon Horman
2014-04-14 5:24 ` WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 04/10] x86, cleanup: add_memmap() only do alignment check on RANGE_RAM WANG Chao
2014-04-14 2:13 ` Simon Horman
2014-04-14 5:17 ` WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 05/10] x86, cleanup: use dbgprint_mem_range for memory range debugging WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 06/10] x86, cleanup: increase CRASH_MAX_MEMMAP_NR up to CRASH_MAX_MEMORY_RANGES WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 07/10] x86, cleanup: Store crash memory ranges kexec_info WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 08/10] x86, cleanup: Add a funtion add_setup_data() WANG Chao
2014-04-14 2:16 ` Simon Horman
2014-04-11 2:23 ` [PATCH RESEND v5 09/10] x86: add --pass-memmap-cmdline option WANG Chao
2014-04-11 2:23 ` [PATCH RESEND v5 10/10] x86: Pass memory range via E820 for kdump WANG Chao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140414021149.GI22411@verge.net.au \
--to=horms@verge.net.au \
--cc=chaowang@redhat.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=kexec@lists.infradead.org \
--cc=linn@hp.com \
--cc=trenn@suse.de \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox