All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ken'ichi Ohmichi" <oomichi@mxs.nes.nec.co.jp>
To: Jay Lan <jlan@sgi.com>
Cc: kexec@lists.infradead.org, Dave Anderson <anderson@redhat.com>,
	Hedi Berriche <hedi@sgi.com>
Subject: Re: the exiting makedumpfile is almost there... :)
Date: Thu, 25 Sep 2008 20:31:30 +0900	[thread overview]
Message-ID: <48DB7692.1020002@mxs.nes.nec.co.jp> (raw)
In-Reply-To: <48DB31D5.9040200@mxs.nes.nec.co.jp>

[-- Attachment #1: Type: text/plain, Size: 3706 bytes --]


Hi Jay,

The last patch contained a bug yet, so please use this patch.
Sorry for my mistake.

Ken'ichi Ohmichi wrote:
> Yes, your test data helps me.
> Your test informed me that there was the buffer-handling problem
> referring different page yet, so the last patch is not enough.
> I created the attached patch for fixing it. Could you test the
> attached patch again ?  Sorry for many tests.
> 
> This patch is for makedumpfile-1.2.9.
> 
> 
> Thanks
> Ken'ichi Ohmichi
> 
> diff -puN a/makedumpfile.c b/makedumpfile.c
> --- a/makedumpfile.c	2008-09-25 15:39:00.000000000 +0900
> +++ b/makedumpfile.c	2008-09-25 15:39:17.000000000 +0900
> @@ -4133,6 +4133,7 @@ exclude_unnecessary_pages(void)
>  	unsigned int mm;
>  	unsigned long mem_map;
>  	unsigned long long pfn, paddr, pfn_mm;
> +	unsigned long long pfn_read_start, pfn_read_end, index_pg;
>  	unsigned char *page_cache = NULL, *pcache;
>  	unsigned int _count;
>  	unsigned long flags, mapping;
> @@ -4156,6 +4157,12 @@ exclude_unnecessary_pages(void)
>  		if (mem_map == NOT_MEMMAP_ADDR)
>  			continue;
>  
> +		/*
> +		 * Refresh the buffer of struct page, when changing mem_map.
> +		 */
> +		pfn_read_start = ULONGLONG_MAX;
> +		pfn_read_end   = 0;
> +
>  		for (; pfn < mmd->pfn_end;
>  		    pfn++, mem_map += SIZE(page),
>  		    paddr += info->page_size) {
> @@ -4166,16 +4173,23 @@ exclude_unnecessary_pages(void)
>  			if (!is_in_segs(paddr))
>  				continue;
>  
> -			if ((pfn % PGMM_CACHED) == 0) {
> -				if (pfn + PGMM_CACHED < mmd->pfn_end)
> -					pfn_mm = PGMM_CACHED;
> +			index_pg = pfn % PGMM_CACHED;
> +			if (pfn < pfn_read_start || pfn_read_end < pfn) {
> +				if (roundup(pfn, PGMM_CACHED) < mmd->pfn_end)
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~ This is a bug.
The above should be roundup(pfn + 1, PGMM_CACHED).


Thanks
Ken'ichi Ohmichi

---
diff -puN a/makedumpfile.c b/makedumpfile.c
--- a/makedumpfile.c	2008-09-04 16:31:58.000000000 +0900
+++ b/makedumpfile.c	2008-09-25 20:27:48.000000000 +0900
@@ -4133,6 +4133,7 @@ exclude_unnecessary_pages(void)
 	unsigned int mm;
 	unsigned long mem_map;
 	unsigned long long pfn, paddr, pfn_mm;
+	unsigned long long pfn_read_start, pfn_read_end, index_pg;
 	unsigned char *page_cache = NULL, *pcache;
 	unsigned int _count;
 	unsigned long flags, mapping;
@@ -4156,6 +4157,12 @@ exclude_unnecessary_pages(void)
 		if (mem_map == NOT_MEMMAP_ADDR)
 			continue;
 
+		/*
+		 * Refresh the buffer of struct page, when changing mem_map.
+		 */
+		pfn_read_start = ULONGLONG_MAX;
+		pfn_read_end   = 0;
+
 		for (; pfn < mmd->pfn_end;
 		    pfn++, mem_map += SIZE(page),
 		    paddr += info->page_size) {
@@ -4166,16 +4173,24 @@ exclude_unnecessary_pages(void)
 			if (!is_in_segs(paddr))
 				continue;
 
-			if ((pfn % PGMM_CACHED) == 0) {
-				if (pfn + PGMM_CACHED < mmd->pfn_end)
-					pfn_mm = PGMM_CACHED;
+			index_pg = pfn % PGMM_CACHED;
+			if (pfn < pfn_read_start || pfn_read_end < pfn) {
+				if (roundup(pfn + 1, PGMM_CACHED) < mmd->pfn_end)
+					pfn_mm = PGMM_CACHED - index_pg;
 				else
 					pfn_mm = mmd->pfn_end - pfn;
-				if (!readmem(VADDR, mem_map, page_cache,
-				    SIZE(page) * pfn_mm))
+
+				if (!readmem(VADDR, mem_map,
+				    page_cache + (index_pg * SIZE(page)),
+				    SIZE(page) * pfn_mm)) {
+					ERRMSG("Can't read the buffer of struct page.\n");
 					goto out;
+				}
+				pfn_read_start = pfn;
+				pfn_read_end   = pfn + pfn_mm - 1;
 			}
-			pcache  = page_cache + ((pfn%PGMM_CACHED) * SIZE(page));
+			pcache  = page_cache + (index_pg * SIZE(page));
+
 			flags   = ULONG(pcache + OFFSET(page.flags));
 			_count  = UINT(pcache + OFFSET(page._count));
 			mapping = ULONG(pcache + OFFSET(page.mapping));



[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2008-09-25 11:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10 23:28 the exiting makedumpfile is almost there... :) Jay Lan
2008-09-11  2:03 ` Ken'ichi Ohmichi
2008-09-11  8:21   ` Bernhard Walle
2008-09-11  2:31 ` Ken'ichi Ohmichi
2008-09-11 14:13 ` Dave Anderson
2008-09-11 14:32 ` Hedi Berriche
2008-09-12  2:21   ` Ken'ichi Ohmichi
2008-09-12 13:38     ` Jay Lan
2008-09-12 19:49       ` Jay Lan
2008-09-12 20:38         ` Dave Anderson
2008-09-12 22:21           ` Jay Lan
2008-09-15 15:24             ` Dave Anderson
2008-09-22 11:14             ` Ken'ichi Ohmichi
2008-09-23 15:41               ` Dave Anderson
2008-09-24  1:09                 ` Ken'ichi Ohmichi
2008-09-24 18:30                   ` Jay Lan
2008-09-24 21:56                     ` Jay Lan
2008-09-25  6:38                       ` Ken'ichi Ohmichi
2008-09-25 11:31                         ` Ken'ichi Ohmichi [this message]
2008-09-25 19:22                           ` Jay Lan
2008-09-26  0:17                             ` Ken'ichi Ohmichi
2008-09-23 20:20               ` Jay Lan
2008-09-23 20:47                 ` Dave Anderson

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=48DB7692.1020002@mxs.nes.nec.co.jp \
    --to=oomichi@mxs.nes.nec.co.jp \
    --cc=anderson@redhat.com \
    --cc=hedi@sgi.com \
    --cc=jlan@sgi.com \
    --cc=kexec@lists.infradead.org \
    /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 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.