From: Minfei Huang <mnfhuang@gmail.com>
To: ebiederm@xmission.com, akpm@linux-foundation.org
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
mhuang@redhat.com, Minfei Huang <mnfhuang@gmail.com>
Subject: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path
Date: Tue, 1 Mar 2016 16:02:28 +0800 [thread overview]
Message-ID: <1456819349-8650-2-git-send-email-mnfhuang@gmail.com> (raw)
In-Reply-To: <1456819349-8650-1-git-send-email-mnfhuang@gmail.com>
For some arch, kexec shall map the reserved pages, then use them, when
we try to start the kdump service.
kexec may return directly, without unmaping the reserved pages, if it
fails during starting service. To fix it, we make a pair of map/unmap
reserved pages both in generic path and error path.
Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
---
kernel/kexec.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/kernel/kexec.c b/kernel/kexec.c
index ee70aef..5cd60c4 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -169,6 +169,7 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
dest_image = &kexec_image;
if (flags & KEXEC_ON_CRASH)
dest_image = &kexec_crash_image;
+
if (nr_segments > 0) {
unsigned long i;
@@ -190,22 +191,25 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
segments, flags);
}
if (result)
- goto out;
+ goto unmap_page;
if (flags & KEXEC_PRESERVE_CONTEXT)
image->preserve_context = 1;
result = machine_kexec_prepare(image);
if (result)
- goto out;
+ goto unmap_page;
for (i = 0; i < nr_segments; i++) {
result = kimage_load_segment(image, &image->segment[i]);
if (result)
- goto out;
+ goto unmap_page;
}
kimage_terminate(image);
+unmap_page:
if (flags & KEXEC_ON_CRASH)
crash_unmap_reserved_pages();
+ if (result)
+ goto out;
}
/* Install the new kernel, and Uninstall the old */
image = xchg(dest_image, image);
--
1.9.1
next prev parent reply other threads:[~2016-03-01 8:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 8:02 [PATCH V2 0/2] kexec: Make a pair of map/unmap reserved pages in error path Minfei Huang
2016-03-01 8:02 ` Minfei Huang [this message]
2016-03-01 21:56 ` [PATCH V2 1/2] " Andrew Morton
2016-03-02 3:03 ` Minfei Huang
2016-03-01 8:02 ` [PATCH V2 2/2] kexec: Do a cleanup for function kexec_load Minfei Huang
2016-03-01 22:05 ` Andrew Morton
2016-03-01 9:53 ` [PATCH V2 0/2] kexec: Make a pair of map/unmap reserved pages in error path Xunlei Pang
2016-03-23 2:48 ` Baoquan He
2016-03-23 3:32 ` Xunlei Pang
2016-03-23 8:23 ` Baoquan He
2016-03-23 9:59 ` Xunlei Pang
2016-03-23 12:32 ` Baoquan He
2016-03-24 8:36 ` Xunlei Pang
2016-03-26 15:17 ` 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=1456819349-8650-2-git-send-email-mnfhuang@gmail.com \
--to=mnfhuang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhuang@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;
as well as URLs for NNTP newsgroup(s).