All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION
@ 2015-06-25  8:22 Zhou Wenjian
  2015-06-25  8:22 ` [PATCH 2/2] makedumpfile: Optimise the function reserve_diskspace Zhou Wenjian
  2015-06-29  8:33 ` [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Atsushi Kumagai
  0 siblings, 2 replies; 6+ messages in thread
From: Zhou Wenjian @ 2015-06-25  8:22 UTC (permalink / raw)
  To: kexec

Currently, there is no obvious description in IMPLEMENTATION for
distinguishing the lost pages resulted by ENOSPACE errors or others.
So, it is added.

Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
---
 IMPLEMENTATION |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/IMPLEMENTATION b/IMPLEMENTATION
index 72df5d5..70a3f7c 100644
--- a/IMPLEMENTATION
+++ b/IMPLEMENTATION
@@ -240,6 +240,8 @@
     The page header and page data are written in pairs. When writing page data
     (pfn N+1), if ENOSPACE error happens, the page headers after N won't be
     written either.
+    When reading page from incomplete core, only the page lost by ENOSPACE errors
+    has 0 in its corresponding page descriptor's member offset.
 
     If there is no page data dumped into the DUMPFILE, the DUMPFILE can't be
     analysed by crash.
-- 
1.7.1


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] makedumpfile: Optimise the function reserve_diskspace
  2015-06-25  8:22 [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Zhou Wenjian
@ 2015-06-25  8:22 ` Zhou Wenjian
  2015-06-29  8:33   ` Atsushi Kumagai
  2015-06-29  8:33 ` [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Atsushi Kumagai
  1 sibling, 1 reply; 6+ messages in thread
From: Zhou Wenjian @ 2015-06-25  8:22 UTC (permalink / raw)
  To: kexec

In current implementation, reserve_diskspace use the buffer as large as
the space that needs to be reserved. The space is reserved for PT_LOAD.
Theoretically the size of the whole PT_LOAD can be very large. So it's
necessary to make reserve_diskspace use a limited size of memory.

Signed-off-by: Zhou wenjian <zhouwj-fnst@cn.fujitsu.com>
---
 makedumpfile.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 88e3389..f7f1f77 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3801,7 +3801,8 @@ read_flat_data_header(struct makedumpfile_data_header *fdh)
 int
 reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
 {
-	size_t buf_size;
+	off_t off;
+	size_t buf_size, write_size;
 	char *buf = NULL;
 
 	int ret = FALSE;
@@ -3809,6 +3810,7 @@ reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
 	assert(start_offset < end_offset);
 	buf_size = end_offset - start_offset;
 
+	buf_size = MIN(info->page_size, buf_size);
 	if ((buf = malloc(buf_size)) == NULL) {
 		ERRMSG("Can't allocate memory for the size of reserved diskspace. %s\n",
 		       strerror(errno));
@@ -3816,8 +3818,15 @@ reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
 	}
 
 	memset(buf, 0, buf_size);
-	if (!write_buffer(fd, start_offset, buf, buf_size, file_name))
-		goto out;
+	off = start_offset;
+
+	while (off < end_offset) {
+		write_size = MIN(buf_size, end_offset - off);
+		if (!write_buffer(fd, off, buf, write_size, file_name))
+			goto out;
+
+		off += write_size;
+	}
 
 	ret = TRUE;
 out:
-- 
1.7.1


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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION
  2015-06-25  8:22 [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Zhou Wenjian
  2015-06-25  8:22 ` [PATCH 2/2] makedumpfile: Optimise the function reserve_diskspace Zhou Wenjian
@ 2015-06-29  8:33 ` Atsushi Kumagai
  2015-06-30  1:02   ` "Zhou, Wenjian/周文剑"
  1 sibling, 1 reply; 6+ messages in thread
From: Atsushi Kumagai @ 2015-06-29  8:33 UTC (permalink / raw)
  To: zhouwj-fnst@cn.fujitsu.com; +Cc: kexec@lists.infradead.org

Hello Zhou,

>Currently, there is no obvious description in IMPLEMENTATION for
>distinguishing the lost pages resulted by ENOSPACE errors or others.
>So, it is added.
>
>Signed-off-by: Zhou Wenjian <zhouwj-fnst@cn.fujitsu.com>
>---
> IMPLEMENTATION |    2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
>diff --git a/IMPLEMENTATION b/IMPLEMENTATION
>index 72df5d5..70a3f7c 100644
>--- a/IMPLEMENTATION
>+++ b/IMPLEMENTATION
>@@ -240,6 +240,8 @@
>     The page header and page data are written in pairs. When writing page data
>     (pfn N+1), if ENOSPACE error happens, the page headers after N won't be
>     written either.
>+    When reading page from incomplete core, only the page lost by ENOSPACE errors
>+    has 0 in its corresponding page descriptor's member offset.

I'm not sure this is correct.
Could you point me where is the code which sets 0 to the page_desc->offset
of the lost page ?


Thanks
Atsushi Kumagai

>     If there is no page data dumped into the DUMPFILE, the DUMPFILE can't be
>     analysed by crash.
>--
>1.7.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] 6+ messages in thread

* RE: [PATCH 2/2] makedumpfile: Optimise the function reserve_diskspace
  2015-06-25  8:22 ` [PATCH 2/2] makedumpfile: Optimise the function reserve_diskspace Zhou Wenjian
@ 2015-06-29  8:33   ` Atsushi Kumagai
  0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Kumagai @ 2015-06-29  8:33 UTC (permalink / raw)
  To: zhouwj-fnst@cn.fujitsu.com; +Cc: kexec@lists.infradead.org

Hello Zhou,

>In current implementation, reserve_diskspace use the buffer as large as
>the space that needs to be reserved. The space is reserved for PT_LOAD.
>Theoretically the size of the whole PT_LOAD can be very large. So it's
>necessary to make reserve_diskspace use a limited size of memory.
>
>Signed-off-by: Zhou wenjian <zhouwj-fnst@cn.fujitsu.com>

Looks good to me, thanks.
I'll merge this into v1.5.9.


Thanks
Atsushi Kumagai

>---
> makedumpfile.c |   15 ++++++++++++---
> 1 files changed, 12 insertions(+), 3 deletions(-)
>
>diff --git a/makedumpfile.c b/makedumpfile.c
>index 88e3389..f7f1f77 100644
>--- a/makedumpfile.c
>+++ b/makedumpfile.c
>@@ -3801,7 +3801,8 @@ read_flat_data_header(struct makedumpfile_data_header *fdh)
> int
> reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
> {
>-	size_t buf_size;
>+	off_t off;
>+	size_t buf_size, write_size;
> 	char *buf = NULL;
>
> 	int ret = FALSE;
>@@ -3809,6 +3810,7 @@ reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
> 	assert(start_offset < end_offset);
> 	buf_size = end_offset - start_offset;
>
>+	buf_size = MIN(info->page_size, buf_size);
> 	if ((buf = malloc(buf_size)) == NULL) {
> 		ERRMSG("Can't allocate memory for the size of reserved diskspace. %s\n",
> 		       strerror(errno));
>@@ -3816,8 +3818,15 @@ reserve_diskspace(int fd, off_t start_offset, off_t end_offset, char *file_name)
> 	}
>
> 	memset(buf, 0, buf_size);
>-	if (!write_buffer(fd, start_offset, buf, buf_size, file_name))
>-		goto out;
>+	off = start_offset;
>+
>+	while (off < end_offset) {
>+		write_size = MIN(buf_size, end_offset - off);
>+		if (!write_buffer(fd, off, buf, write_size, file_name))
>+			goto out;
>+
>+		off += write_size;
>+	}
>
> 	ret = TRUE;
> out:
>--
>1.7.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] 6+ messages in thread

* Re: [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION
  2015-06-29  8:33 ` [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Atsushi Kumagai
@ 2015-06-30  1:02   ` "Zhou, Wenjian/周文剑"
  2015-07-02  2:19     ` Atsushi Kumagai
  0 siblings, 1 reply; 6+ messages in thread
From: "Zhou, Wenjian/周文剑" @ 2015-06-30  1:02 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: kexec@lists.infradead.org

On 06/29/2015 04:33 PM, Atsushi Kumagai wrote:
> Hello Zhou,
>
>> Currently, there is no obvious description in IMPLEMENTATION for
>> distinguishing the lost pages resulted by ENOSPACE errors or others.
>> So, it is added.
>>
>> Signed-off-by: Zhou Wenjian<zhouwj-fnst@cn.fujitsu.com>
>> ---
>> IMPLEMENTATION |    2 ++
>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/IMPLEMENTATION b/IMPLEMENTATION
>> index 72df5d5..70a3f7c 100644
>> --- a/IMPLEMENTATION
>> +++ b/IMPLEMENTATION
>> @@ -240,6 +240,8 @@
>>      The page header and page data are written in pairs. When writing page data
>>      (pfn N+1), if ENOSPACE error happens, the page headers after N won't be
>>      written either.
>> +    When reading page from incomplete core, only the page lost by ENOSPACE errors
>> +    has 0 in its corresponding page descriptor's member offset.
>
> I'm not sure this is correct.
> Could you point me where is the code which sets 0 to the page_desc->offset
> of the lost page ?
>

There is no code to set it. Since the data lost is filled with zero when it is read,
the page_desc->offset will also be zero.
And zero page has its own offset not equal 0. So we can distinguish them with their
member offset.

-- 
Thanks
Zhou Wenjian

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION
  2015-06-30  1:02   ` "Zhou, Wenjian/周文剑"
@ 2015-07-02  2:19     ` Atsushi Kumagai
  0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Kumagai @ 2015-07-02  2:19 UTC (permalink / raw)
  To: zhouwj-fnst@cn.fujitsu.com; +Cc: kexec@lists.infradead.org

>On 06/29/2015 04:33 PM, Atsushi Kumagai wrote:
>> Hello Zhou,
>>
>>> Currently, there is no obvious description in IMPLEMENTATION for
>>> distinguishing the lost pages resulted by ENOSPACE errors or others.
>>> So, it is added.
>>>
>>> Signed-off-by: Zhou Wenjian<zhouwj-fnst@cn.fujitsu.com>
>>> ---
>>> IMPLEMENTATION |    2 ++
>>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/IMPLEMENTATION b/IMPLEMENTATION
>>> index 72df5d5..70a3f7c 100644
>>> --- a/IMPLEMENTATION
>>> +++ b/IMPLEMENTATION
>>> @@ -240,6 +240,8 @@
>>>      The page header and page data are written in pairs. When writing page data
>>>      (pfn N+1), if ENOSPACE error happens, the page headers after N won't be
>>>      written either.
>>> +    When reading page from incomplete core, only the page lost by ENOSPACE errors
>>> +    has 0 in its corresponding page descriptor's member offset.
>>
>> I'm not sure this is correct.
>> Could you point me where is the code which sets 0 to the page_desc->offset
>> of the lost page ?
>>
>
>There is no code to set it. Since the data lost is filled with zero when it is read,
>the page_desc->offset will also be zero.
>And zero page has its own offset not equal 0. So we can distinguish them with their
>member offset.

Ah, you mean the behavior of crash ?
I think it would be better to describe that in more detail in order,
otherwise this additional description sounds sudden to me.


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-02  2:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-25  8:22 [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Zhou Wenjian
2015-06-25  8:22 ` [PATCH 2/2] makedumpfile: Optimise the function reserve_diskspace Zhou Wenjian
2015-06-29  8:33   ` Atsushi Kumagai
2015-06-29  8:33 ` [PATCH 1/2] makedumpfile: Add description of pages lost by ENOSPACE in IMPLEMENTATION Atsushi Kumagai
2015-06-30  1:02   ` "Zhou, Wenjian/周文剑"
2015-07-02  2:19     ` Atsushi Kumagai

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.