linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()
@ 2015-12-02  5:26 Xunlei Pang
  2015-12-02  5:47 ` Dave Young
  0 siblings, 1 reply; 3+ messages in thread
From: Xunlei Pang @ 2015-12-02  5:26 UTC (permalink / raw)
  To: linux-kernel, kexec; +Cc: Dave Young, Eric Biederman, Xunlei Pang

sanity_check_segment_list() checks KEXEC_TYPE_CRASH flag to ensure
all the segments of the loaded crash kernel are winthin the kernel
crash resource limits, so set the flag beforehand.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
---
 kernel/kexec.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernel/kexec.c b/kernel/kexec.c
index d873b64..9624391 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -63,16 +63,19 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,
 	if (ret)
 		goto out_free_image;
 
-	ret = sanity_check_segment_list(image);
-	if (ret)
-		goto out_free_image;
-
-	 /* Enable the special crash kernel control page allocation policy. */
+	/*
+	 * Enable the special crash kernel control page allocation policy,
+	 * and set the crash type flag.
+	 */
 	if (kexec_on_panic) {
 		image->control_page = crashk_res.start;
 		image->type = KEXEC_TYPE_CRASH;
 	}
 
+	ret = sanity_check_segment_list(image);
+	if (ret)
+		goto out_free_image;
+
 	/*
 	 * Find a location for the control code buffer, and add it
 	 * the vector of segments so that it's pages will also be
-- 
2.5.0


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

* Re: [PATCH 1/2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()
  2015-12-02  5:26 [PATCH 1/2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list() Xunlei Pang
@ 2015-12-02  5:47 ` Dave Young
  2015-12-02  6:03   ` Xunlei Pang
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Young @ 2015-12-02  5:47 UTC (permalink / raw)
  To: Xunlei Pang; +Cc: linux-kernel, kexec, Eric Biederman, akpm

Ccing Andrew since usually he monitors and picks up kexec patches.

On 12/02/15 at 01:26pm, Xunlei Pang wrote:
> sanity_check_segment_list() checks KEXEC_TYPE_CRASH flag to ensure
> all the segments of the loaded crash kernel are winthin the kernel
> crash resource limits, so set the flag beforehand.

Looks good except a nitpick, see comments inline.

Otherwise:
Acked-by: Dave Young <dyoung@redhat.com>

> 
> Signed-off-by: Xunlei Pang <xlpang@redhat.com>
> ---
>  kernel/kexec.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/kexec.c b/kernel/kexec.c
> index d873b64..9624391 100644
> --- a/kernel/kexec.c
> +++ b/kernel/kexec.c
> @@ -63,16 +63,19 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,
>  	if (ret)
>  		goto out_free_image;
>  
> -	ret = sanity_check_segment_list(image);
> -	if (ret)
> -		goto out_free_image;
> -
> -	 /* Enable the special crash kernel control page allocation policy. */
> +	/*
> +	 * Enable the special crash kernel control page allocation policy,
> +	 * and set the crash type flag.

It is obvious it is setting the crash type flag, so no need to add extra
comment.

> +	 */
>  	if (kexec_on_panic) {

Like kexec_file.c, move /* Enable ... policy */ here sounds better.
 
>  		image->control_page = crashk_res.start;
>  		image->type = KEXEC_TYPE_CRASH;
>  	}
>  
> +	ret = sanity_check_segment_list(image);
> +	if (ret)
> +		goto out_free_image;
> +
>  	/*
>  	 * Find a location for the control code buffer, and add it
>  	 * the vector of segments so that it's pages will also be
> -- 
> 2.5.0
> 

Thanks
Dave

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

* Re: [PATCH 1/2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list()
  2015-12-02  5:47 ` Dave Young
@ 2015-12-02  6:03   ` Xunlei Pang
  0 siblings, 0 replies; 3+ messages in thread
From: Xunlei Pang @ 2015-12-02  6:03 UTC (permalink / raw)
  To: Dave Young; +Cc: linux-kernel, kexec, Eric Biederman, akpm

Hi Dave,

On 12/02/2015 at 01:47 PM, Dave Young wrote:
> Ccing Andrew since usually he monitors and picks up kexec patches.
>
> On 12/02/15 at 01:26pm, Xunlei Pang wrote:
>> sanity_check_segment_list() checks KEXEC_TYPE_CRASH flag to ensure
>> all the segments of the loaded crash kernel are winthin the kernel
>> crash resource limits, so set the flag beforehand.
> Looks good except a nitpick, see comments inline.
>
> Otherwise:
> Acked-by: Dave Young <dyoung@redhat.com>
>
>> Signed-off-by: Xunlei Pang <xlpang@redhat.com>
>> ---
>>  kernel/kexec.c | 13 ++++++++-----
>>  1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/kernel/kexec.c b/kernel/kexec.c
>> index d873b64..9624391 100644
>> --- a/kernel/kexec.c
>> +++ b/kernel/kexec.c
>> @@ -63,16 +63,19 @@ static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,
>>  	if (ret)
>>  		goto out_free_image;
>>  
>> -	ret = sanity_check_segment_list(image);
>> -	if (ret)
>> -		goto out_free_image;
>> -
>> -	 /* Enable the special crash kernel control page allocation policy. */
>> +	/*
>> +	 * Enable the special crash kernel control page allocation policy,
>> +	 * and set the crash type flag.
> It is obvious it is setting the crash type flag, so no need to add extra
> comment.
>
>> +	 */
>>  	if (kexec_on_panic) {
> Like kexec_file.c, move /* Enable ... policy */ here sounds better.

Yea, this is better. Will do, thanks.

Regards,
Xunlei

>  
>>  		image->control_page = crashk_res.start;
>>  		image->type = KEXEC_TYPE_CRASH;
>>  	}
>>  
>> +	ret = sanity_check_segment_list(image);
>> +	if (ret)
>> +		goto out_free_image;
>> +
>>  	/*
>>  	 * Find a location for the control code buffer, and add it
>>  	 * the vector of segments so that it's pages will also be
>> -- 
>> 2.5.0
>>
> Thanks
> Dave


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

end of thread, other threads:[~2015-12-02  6:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02  5:26 [PATCH 1/2] kexec: Set KEXEC_TYPE_CRASH before sanity_check_segment_list() Xunlei Pang
2015-12-02  5:47 ` Dave Young
2015-12-02  6:03   ` Xunlei Pang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).