Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1346438 > unrolled thread

[PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path

Started byMinfei Huang <mnfhuang@gmail.com>
First post2016-03-01 09:10 +0100
Last post2016-03-02 04:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path Minfei Huang <mnfhuang@gmail.com> - 2016-03-01 09:10 +0100
    Re: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages  in error path Andrew Morton <akpm@linux-foundation.org> - 2016-03-01 23:00 +0100
      Re: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in  error path Minfei Huang <mhuang@redhat.com> - 2016-03-02 04:00 +0100

#1346438 — [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path

FromMinfei Huang <mnfhuang@gmail.com>
Date2016-03-01 09:10 +0100
Subject[PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path
Message-ID<r7Nxw-6uW-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1347055 — Re: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-03-01 23:00 +0100
SubjectRe: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path
Message-ID<r80uJ-6zV-3@gated-at.bofh.it>
In reply to#1346438
On Tue,  1 Mar 2016 16:02:28 +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.

Which architectures are these, by the way?

> 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.

I'm having trouble understanding the urgency of this patch.  Do you
think it is needed in 4.5?  -stable?  If so, why?

Thanks.

[toc] | [prev] | [next] | [standalone]


#1347748 — Re: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path

FromMinfei Huang <mhuang@redhat.com>
Date2016-03-02 04:00 +0100
SubjectRe: [PATCH V2 1/2] kexec: Make a pair of map/unmap reserved pages in error path
Message-ID<r85b4-1lk-11@gated-at.bofh.it>
In reply to#1347055
On 03/01/16 at 01:56pm, Andrew Morton wrote:
> On Tue,  1 Mar 2016 16:02:28 +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.
> 
> Which architectures are these, by the way?

Hi.

This patch only affects s390. The others doesn't implement the interface
of crash_unmap_reserved_pages and crash_map_reserved_pages.

> 
> > 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.
> 
> I'm having trouble understanding the urgency of this patch.  Do you
> think it is needed in 4.5?  -stable?  If so, why?

IMHO, it is fine in next release as it isn't a urgent patch. Kernel can
work well without any risk, although the reseverd pages are not unmaped
before returning in error path.

Thanks
Minfei

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web