public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
To: Minfei Huang <mnfhuang@gmail.com>
Cc: ebiederm@xmission.com, vgoyal@redhat.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com, linux390@de.ibm.com,
	linux-s390@vger.kernel.org, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kexec: Make a pair of map and unmap reserved pages when kdump fails to start
Date: Wed, 1 Jul 2015 16:40:23 +0200	[thread overview]
Message-ID: <20150701164023.011988b1@holzheu> (raw)
In-Reply-To: <1435643086-8555-1-git-send-email-mnfhuang@gmail.com>

Hello Minfei,

Regarding functionality your patch looks ok for me.
But the code is not easy to read.

What about replacing the "failure" label with "fail_unmap_pages"?

Michael

On Tue, 30 Jun 2015 13:44:46 +0800
Minfei Huang <mnfhuang@gmail.com> wrote:

> For some arch, kexec shall map the reserved pages, then use them, when
> we try to start the kdump service.
> 
> Now kexec will never unmap the reserved pages, once it fails to continue
> starting the kdump service.
> 
> Make a pair of reserved pages in kdump starting path, whatever kexec
> fails or not.
> 
> Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
> ---
>  kernel/kexec.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/kernel/kexec.c b/kernel/kexec.c
> index 4589899..68f6dfb 100644
> --- a/kernel/kexec.c
> +++ b/kernel/kexec.c
> @@ -1291,35 +1291,37 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
>  			 */
> 
>  			kimage_free(xchg(&kexec_crash_image, NULL));
> -			result = kimage_alloc_init(&image, entry, nr_segments,
> -						   segments, flags);
> -			crash_map_reserved_pages();
> -		} else {
> -			/* Loading another kernel to reboot into. */
> -
> -			result = kimage_alloc_init(&image, entry, nr_segments,
> -						   segments, flags);
>  		}
> +
> +		result = kimage_alloc_init(&image, entry, nr_segments,
> +				segments, flags);
>  		if (result)
>  			goto out;
> 
> +		if (flags & KEXEC_ON_CRASH)
> +			crash_map_reserved_pages();
> +
>  		if (flags & KEXEC_PRESERVE_CONTEXT)
>  			image->preserve_context = 1;
>  		result = machine_kexec_prepare(image);
>  		if (result)
> -			goto out;
> +			goto failure;
> 
>  		for (i = 0; i < nr_segments; i++) {
>  			result = kimage_load_segment(image, &image->segment[i]);
>  			if (result)
> -				goto out;
> +				goto failure;
>  		}
>  		kimage_terminate(image);
> +
> +failure:
>  		if (flags & KEXEC_ON_CRASH)
>  			crash_unmap_reserved_pages();
>  	}
> -	/* Install the new kernel, and  Uninstall the old */
> -	image = xchg(dest_image, image);
> +
> +	if (result == 0)
> +		/* Install the new kernel, and  Uninstall the old */
> +		image = xchg(dest_image, image);
> 
>  out:
>  	mutex_unlock(&kexec_mutex);

  reply	other threads:[~2015-07-01 14:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  5:44 [PATCH v2] kexec: Make a pair of map and unmap reserved pages when kdump fails to start Minfei Huang
2015-07-01 14:40 ` Michael Holzheu [this message]
2015-07-01 15:06   ` Minfei Huang

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=20150701164023.011988b1@holzheu \
    --to=holzheu@linux.vnet.ibm.com \
    --cc=ebiederm@xmission.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=mnfhuang@gmail.com \
    --cc=schwidefsky@de.ibm.com \
    --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