All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-27 11:48 ` Dmitry Safonov
  0 siblings, 0 replies; 31+ messages in thread
From: Dmitry Safonov @ 2016-01-27 11:48 UTC (permalink / raw)
  To: linux-kernel, schwidefsky, heiko.carstens, ebiederm, akpm
  Cc: kexec, linux-s390, holzheu, dyoung, 0x7f454c46, Dmitry Safonov

For allocation of kimage failure or kexec_prepare or load segments
errors there is no need to keep crashkernel memory mapped.
It will affect only s390 as map/unmap hook defined only for it.
As on unmap s390 also changes os_info structure let's check return code
and add info only on success.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
 arch/s390/kernel/machine_kexec.c | 39 +++++++++++++++++----------------------
 include/linux/kexec.h            |  2 +-
 kernel/kexec.c                   |  4 ++--
 kernel/kexec_core.c              |  4 ++--
 4 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 2f1b721..60bf374 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -49,7 +49,7 @@ static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
 	case PM_POST_SUSPEND:
 	case PM_POST_HIBERNATION:
 		if (crashk_res.start)
-			crash_unmap_reserved_pages();
+			crash_unmap_reserved_pages(0);
 		break;
 	default:
 		return NOTIFY_DONE;
@@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
 }
 
 /*
- * Map or unmap crashkernel memory
+ * Map crashkernel memory
  */
-static void crash_map_pages(int enable)
+void crash_map_reserved_pages(void)
 {
 	unsigned long size = resource_size(&crashk_res);
 
 	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
 	       size % KEXEC_CRASH_MEM_ALIGN);
-	if (enable)
-		vmem_add_mapping(crashk_res.start, size);
-	else {
-		vmem_remove_mapping(crashk_res.start, size);
-		if (size)
-			os_info_crashkernel_add(crashk_res.start, size);
-		else
-			os_info_crashkernel_add(0, 0);
-	}
-}
-
-/*
- * Map crashkernel memory
- */
-void crash_map_reserved_pages(void)
-{
-	crash_map_pages(1);
+	vmem_add_mapping(crashk_res.start, size);
 }
 
 /*
  * Unmap crashkernel memory
  */
-void crash_unmap_reserved_pages(void)
+void crash_unmap_reserved_pages(int error)
 {
-	crash_map_pages(0);
+	unsigned long size = resource_size(&crashk_res);
+
+	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
+	       size % KEXEC_CRASH_MEM_ALIGN);
+	vmem_remove_mapping(crashk_res.start, size);
+
+	if (error)
+		return;
+	if (size)
+		os_info_crashkernel_add(crashk_res.start, size);
+	else
+		os_info_crashkernel_add(0, 0);
 }
 
 /*
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2cc643c..ef3bd1e 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -231,7 +231,7 @@ int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);
 void crash_save_vmcoreinfo(void);
 void crash_map_reserved_pages(void);
-void crash_unmap_reserved_pages(void);
+void crash_unmap_reserved_pages(int error);
 void arch_crash_save_vmcoreinfo(void);
 __printf(1, 2)
 void vmcoreinfo_append_str(const char *fmt, ...);
diff --git a/kernel/kexec.c b/kernel/kexec.c
index ee70aef..dfc6c18 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -204,13 +204,13 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 				goto out;
 		}
 		kimage_terminate(image);
-		if (flags & KEXEC_ON_CRASH)
-			crash_unmap_reserved_pages();
 	}
 	/* Install the new kernel, and  Uninstall the old */
 	image = xchg(dest_image, image);
 
 out:
+	if ((flags & KEXEC_ON_CRASH) && (nr_segments > 0))
+		crash_unmap_reserved_pages(result);
 	mutex_unlock(&kexec_mutex);
 	kimage_free(image);
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 8dc6591..cae5d11 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -965,7 +965,7 @@ int crash_shrink_memory(unsigned long new_size)
 	crashk_res.end = end - 1;
 
 	insert_resource(&iomem_resource, ram_res);
-	crash_unmap_reserved_pages();
+	crash_unmap_reserved_pages(0);
 
 unlock:
 	mutex_unlock(&kexec_mutex);
@@ -1555,5 +1555,5 @@ int kernel_kexec(void)
 void __weak crash_map_reserved_pages(void)
 {}
 
-void __weak crash_unmap_reserved_pages(void)
+void __weak crash_unmap_reserved_pages(int error)
 {}
-- 
2.7.0

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

* [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-27 11:48 ` Dmitry Safonov
  0 siblings, 0 replies; 31+ messages in thread
From: Dmitry Safonov @ 2016-01-27 11:48 UTC (permalink / raw)
  To: linux-kernel, schwidefsky, heiko.carstens, ebiederm, akpm
  Cc: kexec, linux-s390, holzheu, dyoung, 0x7f454c46, Dmitry Safonov

For allocation of kimage failure or kexec_prepare or load segments
errors there is no need to keep crashkernel memory mapped.
It will affect only s390 as map/unmap hook defined only for it.
As on unmap s390 also changes os_info structure let's check return code
and add info only on success.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
 arch/s390/kernel/machine_kexec.c | 39 +++++++++++++++++----------------------
 include/linux/kexec.h            |  2 +-
 kernel/kexec.c                   |  4 ++--
 kernel/kexec_core.c              |  4 ++--
 4 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 2f1b721..60bf374 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -49,7 +49,7 @@ static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
 	case PM_POST_SUSPEND:
 	case PM_POST_HIBERNATION:
 		if (crashk_res.start)
-			crash_unmap_reserved_pages();
+			crash_unmap_reserved_pages(0);
 		break;
 	default:
 		return NOTIFY_DONE;
@@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
 }
 
 /*
- * Map or unmap crashkernel memory
+ * Map crashkernel memory
  */
-static void crash_map_pages(int enable)
+void crash_map_reserved_pages(void)
 {
 	unsigned long size = resource_size(&crashk_res);
 
 	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
 	       size % KEXEC_CRASH_MEM_ALIGN);
-	if (enable)
-		vmem_add_mapping(crashk_res.start, size);
-	else {
-		vmem_remove_mapping(crashk_res.start, size);
-		if (size)
-			os_info_crashkernel_add(crashk_res.start, size);
-		else
-			os_info_crashkernel_add(0, 0);
-	}
-}
-
-/*
- * Map crashkernel memory
- */
-void crash_map_reserved_pages(void)
-{
-	crash_map_pages(1);
+	vmem_add_mapping(crashk_res.start, size);
 }
 
 /*
  * Unmap crashkernel memory
  */
-void crash_unmap_reserved_pages(void)
+void crash_unmap_reserved_pages(int error)
 {
-	crash_map_pages(0);
+	unsigned long size = resource_size(&crashk_res);
+
+	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
+	       size % KEXEC_CRASH_MEM_ALIGN);
+	vmem_remove_mapping(crashk_res.start, size);
+
+	if (error)
+		return;
+	if (size)
+		os_info_crashkernel_add(crashk_res.start, size);
+	else
+		os_info_crashkernel_add(0, 0);
 }
 
 /*
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2cc643c..ef3bd1e 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -231,7 +231,7 @@ int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);
 void crash_save_vmcoreinfo(void);
 void crash_map_reserved_pages(void);
-void crash_unmap_reserved_pages(void);
+void crash_unmap_reserved_pages(int error);
 void arch_crash_save_vmcoreinfo(void);
 __printf(1, 2)
 void vmcoreinfo_append_str(const char *fmt, ...);
diff --git a/kernel/kexec.c b/kernel/kexec.c
index ee70aef..dfc6c18 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -204,13 +204,13 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 				goto out;
 		}
 		kimage_terminate(image);
-		if (flags & KEXEC_ON_CRASH)
-			crash_unmap_reserved_pages();
 	}
 	/* Install the new kernel, and  Uninstall the old */
 	image = xchg(dest_image, image);
 
 out:
+	if ((flags & KEXEC_ON_CRASH) && (nr_segments > 0))
+		crash_unmap_reserved_pages(result);
 	mutex_unlock(&kexec_mutex);
 	kimage_free(image);
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 8dc6591..cae5d11 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -965,7 +965,7 @@ int crash_shrink_memory(unsigned long new_size)
 	crashk_res.end = end - 1;
 
 	insert_resource(&iomem_resource, ram_res);
-	crash_unmap_reserved_pages();
+	crash_unmap_reserved_pages(0);
 
 unlock:
 	mutex_unlock(&kexec_mutex);
@@ -1555,5 +1555,5 @@ int kernel_kexec(void)
 void __weak crash_map_reserved_pages(void)
 {}
 
-void __weak crash_unmap_reserved_pages(void)
+void __weak crash_unmap_reserved_pages(int error)
 {}
-- 
2.7.0

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

* [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-27 11:48 ` Dmitry Safonov
  0 siblings, 0 replies; 31+ messages in thread
From: Dmitry Safonov @ 2016-01-27 11:48 UTC (permalink / raw)
  To: linux-kernel, schwidefsky, heiko.carstens, ebiederm, akpm
  Cc: linux-s390, 0x7f454c46, kexec, Dmitry Safonov, holzheu, dyoung

For allocation of kimage failure or kexec_prepare or load segments
errors there is no need to keep crashkernel memory mapped.
It will affect only s390 as map/unmap hook defined only for it.
As on unmap s390 also changes os_info structure let's check return code
and add info only on success.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
 arch/s390/kernel/machine_kexec.c | 39 +++++++++++++++++----------------------
 include/linux/kexec.h            |  2 +-
 kernel/kexec.c                   |  4 ++--
 kernel/kexec_core.c              |  4 ++--
 4 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 2f1b721..60bf374 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -49,7 +49,7 @@ static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
 	case PM_POST_SUSPEND:
 	case PM_POST_HIBERNATION:
 		if (crashk_res.start)
-			crash_unmap_reserved_pages();
+			crash_unmap_reserved_pages(0);
 		break;
 	default:
 		return NOTIFY_DONE;
@@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
 }
 
 /*
- * Map or unmap crashkernel memory
+ * Map crashkernel memory
  */
-static void crash_map_pages(int enable)
+void crash_map_reserved_pages(void)
 {
 	unsigned long size = resource_size(&crashk_res);
 
 	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
 	       size % KEXEC_CRASH_MEM_ALIGN);
-	if (enable)
-		vmem_add_mapping(crashk_res.start, size);
-	else {
-		vmem_remove_mapping(crashk_res.start, size);
-		if (size)
-			os_info_crashkernel_add(crashk_res.start, size);
-		else
-			os_info_crashkernel_add(0, 0);
-	}
-}
-
-/*
- * Map crashkernel memory
- */
-void crash_map_reserved_pages(void)
-{
-	crash_map_pages(1);
+	vmem_add_mapping(crashk_res.start, size);
 }
 
 /*
  * Unmap crashkernel memory
  */
-void crash_unmap_reserved_pages(void)
+void crash_unmap_reserved_pages(int error)
 {
-	crash_map_pages(0);
+	unsigned long size = resource_size(&crashk_res);
+
+	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
+	       size % KEXEC_CRASH_MEM_ALIGN);
+	vmem_remove_mapping(crashk_res.start, size);
+
+	if (error)
+		return;
+	if (size)
+		os_info_crashkernel_add(crashk_res.start, size);
+	else
+		os_info_crashkernel_add(0, 0);
 }
 
 /*
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2cc643c..ef3bd1e 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -231,7 +231,7 @@ int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);
 void crash_save_vmcoreinfo(void);
 void crash_map_reserved_pages(void);
-void crash_unmap_reserved_pages(void);
+void crash_unmap_reserved_pages(int error);
 void arch_crash_save_vmcoreinfo(void);
 __printf(1, 2)
 void vmcoreinfo_append_str(const char *fmt, ...);
diff --git a/kernel/kexec.c b/kernel/kexec.c
index ee70aef..dfc6c18 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -204,13 +204,13 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
 				goto out;
 		}
 		kimage_terminate(image);
-		if (flags & KEXEC_ON_CRASH)
-			crash_unmap_reserved_pages();
 	}
 	/* Install the new kernel, and  Uninstall the old */
 	image = xchg(dest_image, image);
 
 out:
+	if ((flags & KEXEC_ON_CRASH) && (nr_segments > 0))
+		crash_unmap_reserved_pages(result);
 	mutex_unlock(&kexec_mutex);
 	kimage_free(image);
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 8dc6591..cae5d11 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -965,7 +965,7 @@ int crash_shrink_memory(unsigned long new_size)
 	crashk_res.end = end - 1;
 
 	insert_resource(&iomem_resource, ram_res);
-	crash_unmap_reserved_pages();
+	crash_unmap_reserved_pages(0);
 
 unlock:
 	mutex_unlock(&kexec_mutex);
@@ -1555,5 +1555,5 @@ int kernel_kexec(void)
 void __weak crash_map_reserved_pages(void)
 {}
 
-void __weak crash_unmap_reserved_pages(void)
+void __weak crash_unmap_reserved_pages(int error)
 {}
-- 
2.7.0


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-27 11:48 ` Dmitry Safonov
  (?)
@ 2016-01-27 19:15   ` Andrew Morton
  -1 siblings, 0 replies; 31+ messages in thread
From: Andrew Morton @ 2016-01-27 19:15 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-kernel, schwidefsky, heiko.carstens, ebiederm, kexec,
	linux-s390, holzheu, dyoung, 0x7f454c46, Xunlei Pang

On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:

> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.
> 

This conflicts (both mechanically and somewhat conceptually) with
Xunlei Pang's "kexec: Introduce a protection mechanism for the
crashkernel reserved memory" and "kexec: provide
arch_kexec_protect(unprotect)_crashkres()".

http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch

and

http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

so can we please sort all that out?

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-27 19:15   ` Andrew Morton
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Morton @ 2016-01-27 19:15 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-kernel, schwidefsky, heiko.carstens, ebiederm, kexec,
	linux-s390, holzheu, dyoung, 0x7f454c46, Xunlei Pang

On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:

> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.
> 

This conflicts (both mechanically and somewhat conceptually) with
Xunlei Pang's "kexec: Introduce a protection mechanism for the
crashkernel reserved memory" and "kexec: provide
arch_kexec_protect(unprotect)_crashkres()".

http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch

and

http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

so can we please sort all that out?

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-27 19:15   ` Andrew Morton
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Morton @ 2016-01-27 19:15 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-s390, heiko.carstens, kexec, linux-kernel, ebiederm,
	0x7f454c46, schwidefsky, holzheu, dyoung, Xunlei Pang

On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:

> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.
> 

This conflicts (both mechanically and somewhat conceptually) with
Xunlei Pang's "kexec: Introduce a protection mechanism for the
crashkernel reserved memory" and "kexec: provide
arch_kexec_protect(unprotect)_crashkres()".

http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch

and

http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

so can we please sort all that out?

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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-27 11:48 ` Dmitry Safonov
@ 2016-01-28  3:36   ` Xunlei Pang
  -1 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-28  3:36 UTC (permalink / raw)
  To: Dmitry Safonov, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, akpm
  Cc: linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On 2016/01/27 at 19:48, Dmitry Safonov wrote:
> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.
>
> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
> ---
>  arch/s390/kernel/machine_kexec.c | 39 +++++++++++++++++----------------------
>  include/linux/kexec.h            |  2 +-
>  kernel/kexec.c                   |  4 ++--
>  kernel/kexec_core.c              |  4 ++--
>  4 files changed, 22 insertions(+), 27 deletions(-)
>
> diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
> index 2f1b721..60bf374 100644
> --- a/arch/s390/kernel/machine_kexec.c
> +++ b/arch/s390/kernel/machine_kexec.c
> @@ -49,7 +49,7 @@ static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
>  	case PM_POST_SUSPEND:
>  	case PM_POST_HIBERNATION:
>  		if (crashk_res.start)
> -			crash_unmap_reserved_pages();
> +			crash_unmap_reserved_pages(0);
>  		break;
>  	default:
>  		return NOTIFY_DONE;
> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>  }
>  
>  /*
> - * Map or unmap crashkernel memory
> + * Map crashkernel memory
>   */
> -static void crash_map_pages(int enable)
> +void crash_map_reserved_pages(void)
>  {
>  	unsigned long size = resource_size(&crashk_res);
>  
>  	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>  	       size % KEXEC_CRASH_MEM_ALIGN);
> -	if (enable)
> -		vmem_add_mapping(crashk_res.start, size);
> -	else {
> -		vmem_remove_mapping(crashk_res.start, size);
> -		if (size)
> -			os_info_crashkernel_add(crashk_res.start, size);
> -		else
> -			os_info_crashkernel_add(0, 0);
> -	}
> -}
> -
> -/*
> - * Map crashkernel memory
> - */
> -void crash_map_reserved_pages(void)
> -{
> -	crash_map_pages(1);
> +	vmem_add_mapping(crashk_res.start, size);
>  }
>  
>  /*
>   * Unmap crashkernel memory
>   */
> -void crash_unmap_reserved_pages(void)
> +void crash_unmap_reserved_pages(int error)
>  {
> -	crash_map_pages(0);
> +	unsigned long size = resource_size(&crashk_res);
> +
> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
> +	       size % KEXEC_CRASH_MEM_ALIGN);
> +	vmem_remove_mapping(crashk_res.start, size);
> +
> +	if (error)
> +		return;
> +	if (size)
> +		os_info_crashkernel_add(crashk_res.start, size);
> +	else
> +		os_info_crashkernel_add(0, 0);
>  }

I think it doesn't hurt doing os_info_crashkernel_add() multiple times which will make
the code cleaner.

>  
>  /*
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 2cc643c..ef3bd1e 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -231,7 +231,7 @@ int kexec_should_crash(struct task_struct *);
>  void crash_save_cpu(struct pt_regs *regs, int cpu);
>  void crash_save_vmcoreinfo(void);
>  void crash_map_reserved_pages(void);
> -void crash_unmap_reserved_pages(void);
> +void crash_unmap_reserved_pages(int error);
>  void arch_crash_save_vmcoreinfo(void);
>  __printf(1, 2)
>  void vmcoreinfo_append_str(const char *fmt, ...);
> diff --git a/kernel/kexec.c b/kernel/kexec.c
> index ee70aef..dfc6c18 100644
> --- a/kernel/kexec.c
> +++ b/kernel/kexec.c
> @@ -204,13 +204,13 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
>  				goto out;
>  		}
>  		kimage_terminate(image);
> -		if (flags & KEXEC_ON_CRASH)
> -			crash_unmap_reserved_pages();
>  	}
>  	/* Install the new kernel, and  Uninstall the old */
>  	image = xchg(dest_image, image);
>  
>  out:
> +	if ((flags & KEXEC_ON_CRASH) && (nr_segments > 0))
> +		crash_unmap_reserved_pages(result);
>  	mutex_unlock(&kexec_mutex);
>  	kimage_free(image);

Shouldn't we do the similar thing for kexec_file_load()?

>  
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 8dc6591..cae5d11 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -965,7 +965,7 @@ int crash_shrink_memory(unsigned long new_size)
>  	crashk_res.end = end - 1;
>  
>  	insert_resource(&iomem_resource, ram_res);
> -	crash_unmap_reserved_pages();
> +	crash_unmap_reserved_pages(0);

If using arch_kexec_unprotect/protect_crashkres(), we don't need this since there's a judge at the entry :-)
    if (kexec_crash_image) {
        ret = -ENOENT;
        goto unlock;
    }

Regards,
Xunlei

>  
>  unlock:
>  	mutex_unlock(&kexec_mutex);
> @@ -1555,5 +1555,5 @@ int kernel_kexec(void)
>  void __weak crash_map_reserved_pages(void)
>  {}
>  
> -void __weak crash_unmap_reserved_pages(void)
> +void __weak crash_unmap_reserved_pages(int error)
>  {}

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28  3:36   ` Xunlei Pang
  0 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-28  3:36 UTC (permalink / raw)
  To: Dmitry Safonov, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, akpm
  Cc: linux-s390, dyoung, holzheu, 0x7f454c46, kexec

On 2016/01/27 at 19:48, Dmitry Safonov wrote:
> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.
>
> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
> ---
>  arch/s390/kernel/machine_kexec.c | 39 +++++++++++++++++----------------------
>  include/linux/kexec.h            |  2 +-
>  kernel/kexec.c                   |  4 ++--
>  kernel/kexec_core.c              |  4 ++--
>  4 files changed, 22 insertions(+), 27 deletions(-)
>
> diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
> index 2f1b721..60bf374 100644
> --- a/arch/s390/kernel/machine_kexec.c
> +++ b/arch/s390/kernel/machine_kexec.c
> @@ -49,7 +49,7 @@ static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
>  	case PM_POST_SUSPEND:
>  	case PM_POST_HIBERNATION:
>  		if (crashk_res.start)
> -			crash_unmap_reserved_pages();
> +			crash_unmap_reserved_pages(0);
>  		break;
>  	default:
>  		return NOTIFY_DONE;
> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>  }
>  
>  /*
> - * Map or unmap crashkernel memory
> + * Map crashkernel memory
>   */
> -static void crash_map_pages(int enable)
> +void crash_map_reserved_pages(void)
>  {
>  	unsigned long size = resource_size(&crashk_res);
>  
>  	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>  	       size % KEXEC_CRASH_MEM_ALIGN);
> -	if (enable)
> -		vmem_add_mapping(crashk_res.start, size);
> -	else {
> -		vmem_remove_mapping(crashk_res.start, size);
> -		if (size)
> -			os_info_crashkernel_add(crashk_res.start, size);
> -		else
> -			os_info_crashkernel_add(0, 0);
> -	}
> -}
> -
> -/*
> - * Map crashkernel memory
> - */
> -void crash_map_reserved_pages(void)
> -{
> -	crash_map_pages(1);
> +	vmem_add_mapping(crashk_res.start, size);
>  }
>  
>  /*
>   * Unmap crashkernel memory
>   */
> -void crash_unmap_reserved_pages(void)
> +void crash_unmap_reserved_pages(int error)
>  {
> -	crash_map_pages(0);
> +	unsigned long size = resource_size(&crashk_res);
> +
> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
> +	       size % KEXEC_CRASH_MEM_ALIGN);
> +	vmem_remove_mapping(crashk_res.start, size);
> +
> +	if (error)
> +		return;
> +	if (size)
> +		os_info_crashkernel_add(crashk_res.start, size);
> +	else
> +		os_info_crashkernel_add(0, 0);
>  }

I think it doesn't hurt doing os_info_crashkernel_add() multiple times which will make
the code cleaner.

>  
>  /*
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index 2cc643c..ef3bd1e 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -231,7 +231,7 @@ int kexec_should_crash(struct task_struct *);
>  void crash_save_cpu(struct pt_regs *regs, int cpu);
>  void crash_save_vmcoreinfo(void);
>  void crash_map_reserved_pages(void);
> -void crash_unmap_reserved_pages(void);
> +void crash_unmap_reserved_pages(int error);
>  void arch_crash_save_vmcoreinfo(void);
>  __printf(1, 2)
>  void vmcoreinfo_append_str(const char *fmt, ...);
> diff --git a/kernel/kexec.c b/kernel/kexec.c
> index ee70aef..dfc6c18 100644
> --- a/kernel/kexec.c
> +++ b/kernel/kexec.c
> @@ -204,13 +204,13 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
>  				goto out;
>  		}
>  		kimage_terminate(image);
> -		if (flags & KEXEC_ON_CRASH)
> -			crash_unmap_reserved_pages();
>  	}
>  	/* Install the new kernel, and  Uninstall the old */
>  	image = xchg(dest_image, image);
>  
>  out:
> +	if ((flags & KEXEC_ON_CRASH) && (nr_segments > 0))
> +		crash_unmap_reserved_pages(result);
>  	mutex_unlock(&kexec_mutex);
>  	kimage_free(image);

Shouldn't we do the similar thing for kexec_file_load()?

>  
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 8dc6591..cae5d11 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -965,7 +965,7 @@ int crash_shrink_memory(unsigned long new_size)
>  	crashk_res.end = end - 1;
>  
>  	insert_resource(&iomem_resource, ram_res);
> -	crash_unmap_reserved_pages();
> +	crash_unmap_reserved_pages(0);

If using arch_kexec_unprotect/protect_crashkres(), we don't need this since there's a judge at the entry :-)
    if (kexec_crash_image) {
        ret = -ENOENT;
        goto unlock;
    }

Regards,
Xunlei

>  
>  unlock:
>  	mutex_unlock(&kexec_mutex);
> @@ -1555,5 +1555,5 @@ int kernel_kexec(void)
>  void __weak crash_map_reserved_pages(void)
>  {}
>  
> -void __weak crash_unmap_reserved_pages(void)
> +void __weak crash_unmap_reserved_pages(int error)
>  {}


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-27 11:48 ` Dmitry Safonov
@ 2016-01-28  6:29   ` Minfei Huang
  -1 siblings, 0 replies; 31+ messages in thread
From: Minfei Huang @ 2016-01-28  6:29 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-kernel, schwidefsky, heiko.carstens, ebiederm, akpm,
	linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.

Hi, Dmitry.

Previously, I sent a patch to fix this issue. You can refer it in
following link.

http://lists.infradead.org/pipermail/kexec/2015-July/013960.html

And this patch is fixed from kexec.

If crash_map_reserved_pages fails to map reserved memory, is it
necessary to continue the process on s390? If no, it is better to enter
the error handle path, then return. Thus there is no need to pass the
parameter to indicate the error or not.

> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>  }
>  
>  /*
> - * Map or unmap crashkernel memory
> + * Map crashkernel memory
>   */
> -static void crash_map_pages(int enable)
> +void crash_map_reserved_pages(void)
>  {
>  	unsigned long size = resource_size(&crashk_res);
>  
>  	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>  	       size % KEXEC_CRASH_MEM_ALIGN);
> -	if (enable)
> -		vmem_add_mapping(crashk_res.start, size);
> -	else {
> -		vmem_remove_mapping(crashk_res.start, size);
> -		if (size)
> -			os_info_crashkernel_add(crashk_res.start, size);
> -		else
> -			os_info_crashkernel_add(0, 0);
> -	}
> -}
> -
> -/*
> - * Map crashkernel memory
> - */
> -void crash_map_reserved_pages(void)
> -{
> -	crash_map_pages(1);
> +	vmem_add_mapping(crashk_res.start, size);
>  }

It is fine to cleanup this function. And add the logic into function
crash_unmap_reserved_pages.

>  
>  /*
>   * Unmap crashkernel memory
>   */
> -void crash_unmap_reserved_pages(void)
> +void crash_unmap_reserved_pages(int error)
>  {
> -	crash_map_pages(0);
> +	unsigned long size = resource_size(&crashk_res);
> +
> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
> +	       size % KEXEC_CRASH_MEM_ALIGN);
> +	vmem_remove_mapping(crashk_res.start, size);
> +
> +	if (error)
> +		return;
> +	if (size)
> +		os_info_crashkernel_add(crashk_res.start, size);
> +	else
> +		os_info_crashkernel_add(0, 0);
>  }
>  
>  /*

Thanks
Minfei

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28  6:29   ` Minfei Huang
  0 siblings, 0 replies; 31+ messages in thread
From: Minfei Huang @ 2016-01-28  6:29 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-s390, 0x7f454c46, heiko.carstens, linux-kernel, ebiederm,
	schwidefsky, akpm, holzheu, dyoung, kexec

On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> For allocation of kimage failure or kexec_prepare or load segments
> errors there is no need to keep crashkernel memory mapped.
> It will affect only s390 as map/unmap hook defined only for it.
> As on unmap s390 also changes os_info structure let's check return code
> and add info only on success.

Hi, Dmitry.

Previously, I sent a patch to fix this issue. You can refer it in
following link.

http://lists.infradead.org/pipermail/kexec/2015-July/013960.html

And this patch is fixed from kexec.

If crash_map_reserved_pages fails to map reserved memory, is it
necessary to continue the process on s390? If no, it is better to enter
the error handle path, then return. Thus there is no need to pass the
parameter to indicate the error or not.

> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>  }
>  
>  /*
> - * Map or unmap crashkernel memory
> + * Map crashkernel memory
>   */
> -static void crash_map_pages(int enable)
> +void crash_map_reserved_pages(void)
>  {
>  	unsigned long size = resource_size(&crashk_res);
>  
>  	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>  	       size % KEXEC_CRASH_MEM_ALIGN);
> -	if (enable)
> -		vmem_add_mapping(crashk_res.start, size);
> -	else {
> -		vmem_remove_mapping(crashk_res.start, size);
> -		if (size)
> -			os_info_crashkernel_add(crashk_res.start, size);
> -		else
> -			os_info_crashkernel_add(0, 0);
> -	}
> -}
> -
> -/*
> - * Map crashkernel memory
> - */
> -void crash_map_reserved_pages(void)
> -{
> -	crash_map_pages(1);
> +	vmem_add_mapping(crashk_res.start, size);
>  }

It is fine to cleanup this function. And add the logic into function
crash_unmap_reserved_pages.

>  
>  /*
>   * Unmap crashkernel memory
>   */
> -void crash_unmap_reserved_pages(void)
> +void crash_unmap_reserved_pages(int error)
>  {
> -	crash_map_pages(0);
> +	unsigned long size = resource_size(&crashk_res);
> +
> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
> +	       size % KEXEC_CRASH_MEM_ALIGN);
> +	vmem_remove_mapping(crashk_res.start, size);
> +
> +	if (error)
> +		return;
> +	if (size)
> +		os_info_crashkernel_add(crashk_res.start, size);
> +	else
> +		os_info_crashkernel_add(0, 0);
>  }
>  
>  /*

Thanks
Minfei

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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-28  6:29   ` Minfei Huang
  (?)
@ 2016-01-28  8:57     ` Dmitry Safonov
  -1 siblings, 0 replies; 31+ messages in thread
From: Dmitry Safonov @ 2016-01-28  8:57 UTC (permalink / raw)
  To: Minfei Huang
  Cc: linux-kernel, schwidefsky, heiko.carstens, ebiederm, akpm,
	linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On 01/28/2016 09:29 AM, Minfei Huang wrote:
> On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
>> For allocation of kimage failure or kexec_prepare or load segments
>> errors there is no need to keep crashkernel memory mapped.
>> It will affect only s390 as map/unmap hook defined only for it.
>> As on unmap s390 also changes os_info structure let's check return code
>> and add info only on success.
> Hi, Dmitry.
>
> Previously, I sent a patch to fix this issue. You can refer it in
> following link.
>
> http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
because it has dazzled me while I was debugging around.
>
> And this patch is fixed from kexec.
>
> If crash_map_reserved_pages fails to map reserved memory, is it
> necessary to continue the process on s390? If no, it is better to enter
> the error handle path, then return. Thus there is no need to pass the
> parameter to indicate the error or not.
>
>> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>>   }
>>   
>>   /*
>> - * Map or unmap crashkernel memory
>> + * Map crashkernel memory
>>    */
>> -static void crash_map_pages(int enable)
>> +void crash_map_reserved_pages(void)
>>   {
>>   	unsigned long size = resource_size(&crashk_res);
>>   
>>   	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>>   	       size % KEXEC_CRASH_MEM_ALIGN);
>> -	if (enable)
>> -		vmem_add_mapping(crashk_res.start, size);
>> -	else {
>> -		vmem_remove_mapping(crashk_res.start, size);
>> -		if (size)
>> -			os_info_crashkernel_add(crashk_res.start, size);
>> -		else
>> -			os_info_crashkernel_add(0, 0);
>> -	}
>> -}
>> -
>> -/*
>> - * Map crashkernel memory
>> - */
>> -void crash_map_reserved_pages(void)
>> -{
>> -	crash_map_pages(1);
>> +	vmem_add_mapping(crashk_res.start, size);
>>   }
> It is fine to cleanup this function. And add the logic into function
> crash_unmap_reserved_pages.
>
>>   
>>   /*
>>    * Unmap crashkernel memory
>>    */
>> -void crash_unmap_reserved_pages(void)
>> +void crash_unmap_reserved_pages(int error)
>>   {
>> -	crash_map_pages(0);
>> +	unsigned long size = resource_size(&crashk_res);
>> +
>> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>> +	       size % KEXEC_CRASH_MEM_ALIGN);
>> +	vmem_remove_mapping(crashk_res.start, size);
>> +
>> +	if (error)
>> +		return;
>> +	if (size)
>> +		os_info_crashkernel_add(crashk_res.start, size);
>> +	else
>> +		os_info_crashkernel_add(0, 0);
>>   }
>>   
>>   /*
> Thanks
> Minfei


-- 
Regards,
Dmitry Safonov

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28  8:57     ` Dmitry Safonov
  0 siblings, 0 replies; 31+ messages in thread
From: Dmitry Safonov @ 2016-01-28  8:57 UTC (permalink / raw)
  To: Minfei Huang
  Cc: linux-kernel, schwidefsky, heiko.carstens, ebiederm, akpm,
	linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On 01/28/2016 09:29 AM, Minfei Huang wrote:
> On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
>> For allocation of kimage failure or kexec_prepare or load segments
>> errors there is no need to keep crashkernel memory mapped.
>> It will affect only s390 as map/unmap hook defined only for it.
>> As on unmap s390 also changes os_info structure let's check return code
>> and add info only on success.
> Hi, Dmitry.
>
> Previously, I sent a patch to fix this issue. You can refer it in
> following link.
>
> http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
because it has dazzled me while I was debugging around.
>
> And this patch is fixed from kexec.
>
> If crash_map_reserved_pages fails to map reserved memory, is it
> necessary to continue the process on s390? If no, it is better to enter
> the error handle path, then return. Thus there is no need to pass the
> parameter to indicate the error or not.
>
>> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>>   }
>>   
>>   /*
>> - * Map or unmap crashkernel memory
>> + * Map crashkernel memory
>>    */
>> -static void crash_map_pages(int enable)
>> +void crash_map_reserved_pages(void)
>>   {
>>   	unsigned long size = resource_size(&crashk_res);
>>   
>>   	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>>   	       size % KEXEC_CRASH_MEM_ALIGN);
>> -	if (enable)
>> -		vmem_add_mapping(crashk_res.start, size);
>> -	else {
>> -		vmem_remove_mapping(crashk_res.start, size);
>> -		if (size)
>> -			os_info_crashkernel_add(crashk_res.start, size);
>> -		else
>> -			os_info_crashkernel_add(0, 0);
>> -	}
>> -}
>> -
>> -/*
>> - * Map crashkernel memory
>> - */
>> -void crash_map_reserved_pages(void)
>> -{
>> -	crash_map_pages(1);
>> +	vmem_add_mapping(crashk_res.start, size);
>>   }
> It is fine to cleanup this function. And add the logic into function
> crash_unmap_reserved_pages.
>
>>   
>>   /*
>>    * Unmap crashkernel memory
>>    */
>> -void crash_unmap_reserved_pages(void)
>> +void crash_unmap_reserved_pages(int error)
>>   {
>> -	crash_map_pages(0);
>> +	unsigned long size = resource_size(&crashk_res);
>> +
>> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>> +	       size % KEXEC_CRASH_MEM_ALIGN);
>> +	vmem_remove_mapping(crashk_res.start, size);
>> +
>> +	if (error)
>> +		return;
>> +	if (size)
>> +		os_info_crashkernel_add(crashk_res.start, size);
>> +	else
>> +		os_info_crashkernel_add(0, 0);
>>   }
>>   
>>   /*
> Thanks
> Minfei


-- 
Regards,
Dmitry Safonov

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28  8:57     ` Dmitry Safonov
  0 siblings, 0 replies; 31+ messages in thread
From: Dmitry Safonov @ 2016-01-28  8:57 UTC (permalink / raw)
  To: Minfei Huang
  Cc: linux-s390, 0x7f454c46, heiko.carstens, linux-kernel, ebiederm,
	schwidefsky, akpm, holzheu, dyoung, kexec

On 01/28/2016 09:29 AM, Minfei Huang wrote:
> On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
>> For allocation of kimage failure or kexec_prepare or load segments
>> errors there is no need to keep crashkernel memory mapped.
>> It will affect only s390 as map/unmap hook defined only for it.
>> As on unmap s390 also changes os_info structure let's check return code
>> and add info only on success.
> Hi, Dmitry.
>
> Previously, I sent a patch to fix this issue. You can refer it in
> following link.
>
> http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
because it has dazzled me while I was debugging around.
>
> And this patch is fixed from kexec.
>
> If crash_map_reserved_pages fails to map reserved memory, is it
> necessary to continue the process on s390? If no, it is better to enter
> the error handle path, then return. Thus there is no need to pass the
> parameter to indicate the error or not.
>
>> @@ -147,39 +147,34 @@ static int kdump_csum_valid(struct kimage *image)
>>   }
>>   
>>   /*
>> - * Map or unmap crashkernel memory
>> + * Map crashkernel memory
>>    */
>> -static void crash_map_pages(int enable)
>> +void crash_map_reserved_pages(void)
>>   {
>>   	unsigned long size = resource_size(&crashk_res);
>>   
>>   	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>>   	       size % KEXEC_CRASH_MEM_ALIGN);
>> -	if (enable)
>> -		vmem_add_mapping(crashk_res.start, size);
>> -	else {
>> -		vmem_remove_mapping(crashk_res.start, size);
>> -		if (size)
>> -			os_info_crashkernel_add(crashk_res.start, size);
>> -		else
>> -			os_info_crashkernel_add(0, 0);
>> -	}
>> -}
>> -
>> -/*
>> - * Map crashkernel memory
>> - */
>> -void crash_map_reserved_pages(void)
>> -{
>> -	crash_map_pages(1);
>> +	vmem_add_mapping(crashk_res.start, size);
>>   }
> It is fine to cleanup this function. And add the logic into function
> crash_unmap_reserved_pages.
>
>>   
>>   /*
>>    * Unmap crashkernel memory
>>    */
>> -void crash_unmap_reserved_pages(void)
>> +void crash_unmap_reserved_pages(int error)
>>   {
>> -	crash_map_pages(0);
>> +	unsigned long size = resource_size(&crashk_res);
>> +
>> +	BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN ||
>> +	       size % KEXEC_CRASH_MEM_ALIGN);
>> +	vmem_remove_mapping(crashk_res.start, size);
>> +
>> +	if (error)
>> +		return;
>> +	if (size)
>> +		os_info_crashkernel_add(crashk_res.start, size);
>> +	else
>> +		os_info_crashkernel_add(0, 0);
>>   }
>>   
>>   /*
> Thanks
> Minfei


-- 
Regards,
Dmitry Safonov


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-27 19:15   ` Andrew Morton
  (?)
@ 2016-01-28 10:32     ` Michael Holzheu
  -1 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 10:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Dmitry Safonov, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, kexec, linux-s390, dyoung, 0x7f454c46, Xunlei Pang

On Wed, 27 Jan 2016 11:15:46 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> 
> > For allocation of kimage failure or kexec_prepare or load segments
> > errors there is no need to keep crashkernel memory mapped.
> > It will affect only s390 as map/unmap hook defined only for it.
> > As on unmap s390 also changes os_info structure let's check return code
> > and add info only on success.
> > 
> 
> This conflicts (both mechanically and somewhat conceptually) with
> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> crashkernel reserved memory" and "kexec: provide
> arch_kexec_protect(unprotect)_crashkres()".
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> 
> and
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
the same semantics as crash_(un)map_reserved_pages().

On s390 we don't have the crashkernel memory mapped and therefore need
crash_map_reserved_pages() before loading something into crashkernel
memory.

Perhaps I missed something?
Michael

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28 10:32     ` Michael Holzheu
  0 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 10:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Dmitry Safonov, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, kexec, linux-s390, dyoung, 0x7f454c46, Xunlei Pang

On Wed, 27 Jan 2016 11:15:46 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> 
> > For allocation of kimage failure or kexec_prepare or load segments
> > errors there is no need to keep crashkernel memory mapped.
> > It will affect only s390 as map/unmap hook defined only for it.
> > As on unmap s390 also changes os_info structure let's check return code
> > and add info only on success.
> > 
> 
> This conflicts (both mechanically and somewhat conceptually) with
> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> crashkernel reserved memory" and "kexec: provide
> arch_kexec_protect(unprotect)_crashkres()".
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> 
> and
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
the same semantics as crash_(un)map_reserved_pages().

On s390 we don't have the crashkernel memory mapped and therefore need
crash_map_reserved_pages() before loading something into crashkernel
memory.

Perhaps I missed something?
Michael

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28 10:32     ` Michael Holzheu
  0 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 10:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-s390, Dmitry Safonov, heiko.carstens, linux-kernel,
	ebiederm, 0x7f454c46, schwidefsky, dyoung, kexec, Xunlei Pang

On Wed, 27 Jan 2016 11:15:46 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> 
> > For allocation of kimage failure or kexec_prepare or load segments
> > errors there is no need to keep crashkernel memory mapped.
> > It will affect only s390 as map/unmap hook defined only for it.
> > As on unmap s390 also changes os_info structure let's check return code
> > and add info only on success.
> > 
> 
> This conflicts (both mechanically and somewhat conceptually) with
> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> crashkernel reserved memory" and "kexec: provide
> arch_kexec_protect(unprotect)_crashkres()".
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> 
> and
> 
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch

Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
the same semantics as crash_(un)map_reserved_pages().

On s390 we don't have the crashkernel memory mapped and therefore need
crash_map_reserved_pages() before loading something into crashkernel
memory.

Perhaps I missed something?
Michael


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-28 10:32     ` Michael Holzheu
@ 2016-01-28 11:56       ` Xunlei Pang
  -1 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-28 11:56 UTC (permalink / raw)
  To: Michael Holzheu, Andrew Morton
  Cc: linux-s390, Dmitry Safonov, heiko.carstens, linux-kernel,
	ebiederm, 0x7f454c46, schwidefsky, dyoung, kexec, Xunlei Pang

On 2016/01/28 at 18:32, Michael Holzheu wrote:
> On Wed, 27 Jan 2016 11:15:46 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>
>>> For allocation of kimage failure or kexec_prepare or load segments
>>> errors there is no need to keep crashkernel memory mapped.
>>> It will affect only s390 as map/unmap hook defined only for it.
>>> As on unmap s390 also changes os_info structure let's check return code
>>> and add info only on success.
>>>
>> This conflicts (both mechanically and somewhat conceptually) with
>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>> crashkernel reserved memory" and "kexec: provide
>> arch_kexec_protect(unprotect)_crashkres()".
>>
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>
>> and
>>
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> the same semantics as crash_(un)map_reserved_pages().
>
> On s390 we don't have the crashkernel memory mapped and therefore need
> crash_map_reserved_pages() before loading something into crashkernel
> memory.

I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
with no kernel mapping already means the protection is on?

Regards,
Xunlei

>
> Perhaps I missed something?
> Michael
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28 11:56       ` Xunlei Pang
  0 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-28 11:56 UTC (permalink / raw)
  To: Michael Holzheu, Andrew Morton
  Cc: linux-s390, 0x7f454c46, heiko.carstens, linux-kernel, ebiederm,
	Dmitry Safonov, schwidefsky, dyoung, kexec, Xunlei Pang

On 2016/01/28 at 18:32, Michael Holzheu wrote:
> On Wed, 27 Jan 2016 11:15:46 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>
>>> For allocation of kimage failure or kexec_prepare or load segments
>>> errors there is no need to keep crashkernel memory mapped.
>>> It will affect only s390 as map/unmap hook defined only for it.
>>> As on unmap s390 also changes os_info structure let's check return code
>>> and add info only on success.
>>>
>> This conflicts (both mechanically and somewhat conceptually) with
>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>> crashkernel reserved memory" and "kexec: provide
>> arch_kexec_protect(unprotect)_crashkres()".
>>
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>
>> and
>>
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> the same semantics as crash_(un)map_reserved_pages().
>
> On s390 we don't have the crashkernel memory mapped and therefore need
> crash_map_reserved_pages() before loading something into crashkernel
> memory.

I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
with no kernel mapping already means the protection is on?

Regards,
Xunlei

>
> Perhaps I missed something?
> Michael
>
>
> _______________________________________________
> 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] 31+ messages in thread

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-28 11:56       ` Xunlei Pang
@ 2016-01-28 12:44         ` Michael Holzheu
  -1 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 12:44 UTC (permalink / raw)
  To: xlpang
  Cc: xpang, Andrew Morton, linux-s390, Dmitry Safonov, heiko.carstens,
	linux-kernel, ebiederm, 0x7f454c46, schwidefsky, dyoung, kexec

On Thu, 28 Jan 2016 19:56:56 +0800
Xunlei Pang <xpang@redhat.com> wrote:

> On 2016/01/28 at 18:32, Michael Holzheu wrote:
> > On Wed, 27 Jan 2016 11:15:46 -0800
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> >> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> >>
> >>> For allocation of kimage failure or kexec_prepare or load segments
> >>> errors there is no need to keep crashkernel memory mapped.
> >>> It will affect only s390 as map/unmap hook defined only for it.
> >>> As on unmap s390 also changes os_info structure let's check return code
> >>> and add info only on success.
> >>>
> >> This conflicts (both mechanically and somewhat conceptually) with
> >> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> >> crashkernel reserved memory" and "kexec: provide
> >> arch_kexec_protect(unprotect)_crashkres()".
> >>
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> >>
> >> and
> >>
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> > Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> > the same semantics as crash_(un)map_reserved_pages().
> >
> > On s390 we don't have the crashkernel memory mapped and therefore need
> > crash_map_reserved_pages() before loading something into crashkernel
> > memory.
> 
> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
> with no kernel mapping already means the protection is on?

When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
we create a memory hole without page tables.

Commit (558df7209e) was necessary to load a kernel/ramdisk into
the memory hole with the kexec() system call.

We create a temporary mapping with crash_map_reserved_pages(), then
copy the kernel/ramdisk and finally remove the mapping again
via crash_unmap_reserved_pages().

We did that all in order to protect the preloaded kernel and ramdisk.

I forgot the details why commit(558df7209e) wasn't necessary before.
AFAIK it became necessary because of some kdump (mmap?) rework.

Michael

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28 12:44         ` Michael Holzheu
  0 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 12:44 UTC (permalink / raw)
  To: xlpang
  Cc: linux-s390, Dmitry Safonov, heiko.carstens, linux-kernel,
	ebiederm, 0x7f454c46, xpang, schwidefsky, Andrew Morton, dyoung,
	kexec

On Thu, 28 Jan 2016 19:56:56 +0800
Xunlei Pang <xpang@redhat.com> wrote:

> On 2016/01/28 at 18:32, Michael Holzheu wrote:
> > On Wed, 27 Jan 2016 11:15:46 -0800
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> >> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> >>
> >>> For allocation of kimage failure or kexec_prepare or load segments
> >>> errors there is no need to keep crashkernel memory mapped.
> >>> It will affect only s390 as map/unmap hook defined only for it.
> >>> As on unmap s390 also changes os_info structure let's check return code
> >>> and add info only on success.
> >>>
> >> This conflicts (both mechanically and somewhat conceptually) with
> >> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> >> crashkernel reserved memory" and "kexec: provide
> >> arch_kexec_protect(unprotect)_crashkres()".
> >>
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> >>
> >> and
> >>
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> >> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> > Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> > the same semantics as crash_(un)map_reserved_pages().
> >
> > On s390 we don't have the crashkernel memory mapped and therefore need
> > crash_map_reserved_pages() before loading something into crashkernel
> > memory.
> 
> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
> with no kernel mapping already means the protection is on?

When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
we create a memory hole without page tables.

Commit (558df7209e) was necessary to load a kernel/ramdisk into
the memory hole with the kexec() system call.

We create a temporary mapping with crash_map_reserved_pages(), then
copy the kernel/ramdisk and finally remove the mapping again
via crash_unmap_reserved_pages().

We did that all in order to protect the preloaded kernel and ramdisk.

I forgot the details why commit(558df7209e) wasn't necessary before.
AFAIK it became necessary because of some kdump (mmap?) rework.

Michael


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-28 12:44         ` Michael Holzheu
@ 2016-01-28 13:12           ` Xunlei Pang
  -1 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-28 13:12 UTC (permalink / raw)
  To: Michael Holzheu, xlpang
  Cc: Andrew Morton, linux-s390, Dmitry Safonov, heiko.carstens,
	linux-kernel, ebiederm, 0x7f454c46, schwidefsky, dyoung, kexec

On 2016/01/28 at 20:44, Michael Holzheu wrote:
> On Thu, 28 Jan 2016 19:56:56 +0800
> Xunlei Pang <xpang@redhat.com> wrote:
>
>> On 2016/01/28 at 18:32, Michael Holzheu wrote:
>>> On Wed, 27 Jan 2016 11:15:46 -0800
>>> Andrew Morton <akpm@linux-foundation.org> wrote:
>>>
>>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>>>
>>>>> For allocation of kimage failure or kexec_prepare or load segments
>>>>> errors there is no need to keep crashkernel memory mapped.
>>>>> It will affect only s390 as map/unmap hook defined only for it.
>>>>> As on unmap s390 also changes os_info structure let's check return code
>>>>> and add info only on success.
>>>>>
>>>> This conflicts (both mechanically and somewhat conceptually) with
>>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>>>> crashkernel reserved memory" and "kexec: provide
>>>> arch_kexec_protect(unprotect)_crashkres()".
>>>>
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>>>
>>>> and
>>>>
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
>>> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
>>> the same semantics as crash_(un)map_reserved_pages().
>>>
>>> On s390 we don't have the crashkernel memory mapped and therefore need
>>> crash_map_reserved_pages() before loading something into crashkernel
>>> memory.
>> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
>> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
>> with no kernel mapping already means the protection is on?
> When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
> we create a memory hole without page tables.
>
> Commit (558df7209e) was necessary to load a kernel/ramdisk into
> the memory hole with the kexec() system call.
>
> We create a temporary mapping with crash_map_reserved_pages(), then
> copy the kernel/ramdisk and finally remove the mapping again
> via crash_unmap_reserved_pages().

Thanks for the explanation.
So, on s390 the physical memory address has the same value as its kernel virtual address,
and kmap() actually returns the value of the physical address of the page, right?

>
> We did that all in order to protect the preloaded kernel and ramdisk.
>
> I forgot the details why commit(558df7209e) wasn't necessary before.
> AFAIK it became necessary because of some kdump (mmap?) rework.

Uh, this is indeed strange.

Regards,
Xunlei

>
> Michael
>

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28 13:12           ` Xunlei Pang
  0 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-28 13:12 UTC (permalink / raw)
  To: Michael Holzheu, xlpang
  Cc: linux-s390, Dmitry Safonov, heiko.carstens, linux-kernel,
	ebiederm, 0x7f454c46, schwidefsky, Andrew Morton, dyoung, kexec

On 2016/01/28 at 20:44, Michael Holzheu wrote:
> On Thu, 28 Jan 2016 19:56:56 +0800
> Xunlei Pang <xpang@redhat.com> wrote:
>
>> On 2016/01/28 at 18:32, Michael Holzheu wrote:
>>> On Wed, 27 Jan 2016 11:15:46 -0800
>>> Andrew Morton <akpm@linux-foundation.org> wrote:
>>>
>>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>>>
>>>>> For allocation of kimage failure or kexec_prepare or load segments
>>>>> errors there is no need to keep crashkernel memory mapped.
>>>>> It will affect only s390 as map/unmap hook defined only for it.
>>>>> As on unmap s390 also changes os_info structure let's check return code
>>>>> and add info only on success.
>>>>>
>>>> This conflicts (both mechanically and somewhat conceptually) with
>>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>>>> crashkernel reserved memory" and "kexec: provide
>>>> arch_kexec_protect(unprotect)_crashkres()".
>>>>
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>>>
>>>> and
>>>>
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
>>> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
>>> the same semantics as crash_(un)map_reserved_pages().
>>>
>>> On s390 we don't have the crashkernel memory mapped and therefore need
>>> crash_map_reserved_pages() before loading something into crashkernel
>>> memory.
>> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
>> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
>> with no kernel mapping already means the protection is on?
> When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
> we create a memory hole without page tables.
>
> Commit (558df7209e) was necessary to load a kernel/ramdisk into
> the memory hole with the kexec() system call.
>
> We create a temporary mapping with crash_map_reserved_pages(), then
> copy the kernel/ramdisk and finally remove the mapping again
> via crash_unmap_reserved_pages().

Thanks for the explanation.
So, on s390 the physical memory address has the same value as its kernel virtual address,
and kmap() actually returns the value of the physical address of the page, right?

>
> We did that all in order to protect the preloaded kernel and ramdisk.
>
> I forgot the details why commit(558df7209e) wasn't necessary before.
> AFAIK it became necessary because of some kdump (mmap?) rework.

Uh, this is indeed strange.

Regards,
Xunlei

>
> Michael
>


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-28 13:12           ` Xunlei Pang
@ 2016-01-28 14:01             ` Michael Holzheu
  -1 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 14:01 UTC (permalink / raw)
  To: xlpang
  Cc: xpang, Andrew Morton, linux-s390, Dmitry Safonov, heiko.carstens,
	linux-kernel, ebiederm, 0x7f454c46, schwidefsky, dyoung, kexec

On Thu, 28 Jan 2016 21:12:54 +0800
Xunlei Pang <xpang@redhat.com> wrote:

> On 2016/01/28 at 20:44, Michael Holzheu wrote:
> > On Thu, 28 Jan 2016 19:56:56 +0800
> > Xunlei Pang <xpang@redhat.com> wrote:
> >
> >> On 2016/01/28 at 18:32, Michael Holzheu wrote:
> >>> On Wed, 27 Jan 2016 11:15:46 -0800
> >>> Andrew Morton <akpm@linux-foundation.org> wrote:
> >>>
> >>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> >>>>
> >>>>> For allocation of kimage failure or kexec_prepare or load segments
> >>>>> errors there is no need to keep crashkernel memory mapped.
> >>>>> It will affect only s390 as map/unmap hook defined only for it.
> >>>>> As on unmap s390 also changes os_info structure let's check return code
> >>>>> and add info only on success.
> >>>>>
> >>>> This conflicts (both mechanically and somewhat conceptually) with
> >>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> >>>> crashkernel reserved memory" and "kexec: provide
> >>>> arch_kexec_protect(unprotect)_crashkres()".
> >>>>
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> >>>>
> >>>> and
> >>>>
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> >>> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> >>> the same semantics as crash_(un)map_reserved_pages().
> >>>
> >>> On s390 we don't have the crashkernel memory mapped and therefore need
> >>> crash_map_reserved_pages() before loading something into crashkernel
> >>> memory.
> >> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
> >> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
> >> with no kernel mapping already means the protection is on?
> > When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
> > we create a memory hole without page tables.
> >
> > Commit (558df7209e) was necessary to load a kernel/ramdisk into
> > the memory hole with the kexec() system call.
> >
> > We create a temporary mapping with crash_map_reserved_pages(), then
> > copy the kernel/ramdisk and finally remove the mapping again
> > via crash_unmap_reserved_pages().
> 
> Thanks for the explanation.
> So, on s390 the physical memory address has the same value as its kernel virtual address,
> and kmap() actually returns the value of the physical address of the page, right?

Correct. On s390 kmap() always return the physical address of the page.

We have an 1:1 mapping for all the physical memory. For this area
virtual=real. In addition to that we have the vmalloc area above
the 1:1 mapping where some of the memory is mapped a second time.

Michael

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-28 14:01             ` Michael Holzheu
  0 siblings, 0 replies; 31+ messages in thread
From: Michael Holzheu @ 2016-01-28 14:01 UTC (permalink / raw)
  To: xlpang
  Cc: linux-s390, Dmitry Safonov, heiko.carstens, linux-kernel,
	ebiederm, 0x7f454c46, xpang, schwidefsky, Andrew Morton, dyoung,
	kexec

On Thu, 28 Jan 2016 21:12:54 +0800
Xunlei Pang <xpang@redhat.com> wrote:

> On 2016/01/28 at 20:44, Michael Holzheu wrote:
> > On Thu, 28 Jan 2016 19:56:56 +0800
> > Xunlei Pang <xpang@redhat.com> wrote:
> >
> >> On 2016/01/28 at 18:32, Michael Holzheu wrote:
> >>> On Wed, 27 Jan 2016 11:15:46 -0800
> >>> Andrew Morton <akpm@linux-foundation.org> wrote:
> >>>
> >>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> >>>>
> >>>>> For allocation of kimage failure or kexec_prepare or load segments
> >>>>> errors there is no need to keep crashkernel memory mapped.
> >>>>> It will affect only s390 as map/unmap hook defined only for it.
> >>>>> As on unmap s390 also changes os_info structure let's check return code
> >>>>> and add info only on success.
> >>>>>
> >>>> This conflicts (both mechanically and somewhat conceptually) with
> >>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
> >>>> crashkernel reserved memory" and "kexec: provide
> >>>> arch_kexec_protect(unprotect)_crashkres()".
> >>>>
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
> >>>>
> >>>> and
> >>>>
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
> >>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
> >>> Hmm, It looks to me that arch_kexec_(un)protect_crashkres() has exactly
> >>> the same semantics as crash_(un)map_reserved_pages().
> >>>
> >>> On s390 we don't have the crashkernel memory mapped and therefore need
> >>> crash_map_reserved_pages() before loading something into crashkernel
> >>> memory.
> >> I don't know s390, just curious, if s390 doesn't have crash kernel memory mapped,
> >> what's the purpose of the commit(558df7209e)  for s390 as the reserved crash memory
> >> with no kernel mapping already means the protection is on?
> > When we reserve crashkernel memory on s390 ("crashkernel=" kernel parameter),
> > we create a memory hole without page tables.
> >
> > Commit (558df7209e) was necessary to load a kernel/ramdisk into
> > the memory hole with the kexec() system call.
> >
> > We create a temporary mapping with crash_map_reserved_pages(), then
> > copy the kernel/ramdisk and finally remove the mapping again
> > via crash_unmap_reserved_pages().
> 
> Thanks for the explanation.
> So, on s390 the physical memory address has the same value as its kernel virtual address,
> and kmap() actually returns the value of the physical address of the page, right?

Correct. On s390 kmap() always return the physical address of the page.

We have an 1:1 mapping for all the physical memory. For this area
virtual=real. In addition to that we have the vmalloc area above
the 1:1 mapping where some of the memory is mapped a second time.

Michael


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
       [not found]     ` <56A9D927.70402@virtuozzo.com>
@ 2016-01-29  3:14         ` Xunlei Pang
  0 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-29  3:14 UTC (permalink / raw)
  To: Dmitry Safonov, xlpang
  Cc: Andrew Morton, linux-s390, heiko.carstens, kexec, linux-kernel,
	ebiederm, 0x7f454c46, schwidefsky, holzheu, dyoung

On 2016/01/28 at 17:02, Dmitry Safonov wrote:
> On 01/28/2016 05:58 AM, Xunlei Pang wrote:
>> Hi Dmitry,
>>  
>> On 2016/01/28 at 03:15, Andrew Morton wrote:
>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>>
>>>> For allocation of kimage failure or kexec_prepare or load segments
>>>> errors there is no need to keep crashkernel memory mapped.
>>>> It will affect only s390 as map/unmap hook defined only for it.
>>>> As on unmap s390 also changes os_info structure let's check return code
>>>> and add info only on success.
>>>>
>>> This conflicts (both mechanically and somewhat conceptually) with
>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>>> crashkernel reserved memory" and "kexec: provide
>>> arch_kexec_protect(unprotect)_crashkres()".
>>>
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>>
>>> and
>>>
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
>>>
>>> so can we please sort all that out?
>>
>> Ah, I've checked git-log history, they are almost the same idea, can crash_unmap/map_reserved_pages()
>> be re-implemented using the new  arch_kexec_unprotect/protect_crashkres() on S390?
> Sorry, didn't fetched akpm before sending.
> Yes, sounds like really right thing to do to have one united arch-helper.

Yeah, as Michael said, "memblock_remove(crash_base, crash_size)" creates a big hole in the kernel pgtable.
In order to have one united arch-helper, I guess we can forbid this to let the pgtable setup for crash memory,
then we can easily move the logic of crash_map_reserved_pages() to arch_kexec_unprotect_crashkres(),  and
move crash_unmap_reserved_pages() to arch_kexec_protect_crashkres(). After that crash_map_reserved_pages()
called in crash_shrink_memory() can be safely removed as well.

Regards,
Xunlei

>>
>> Regards,
>> Xunlei
>>
>>> _______________________________________________
>>> kexec mailing list
>>> kexec@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/kexec
>>
>
>
> -- 
> Regards,
> Dmitry Safonov

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-01-29  3:14         ` Xunlei Pang
  0 siblings, 0 replies; 31+ messages in thread
From: Xunlei Pang @ 2016-01-29  3:14 UTC (permalink / raw)
  To: Dmitry Safonov, xlpang
  Cc: linux-s390, kexec, heiko.carstens, linux-kernel, ebiederm,
	0x7f454c46, schwidefsky, Andrew Morton, holzheu, dyoung

On 2016/01/28 at 17:02, Dmitry Safonov wrote:
> On 01/28/2016 05:58 AM, Xunlei Pang wrote:
>> Hi Dmitry,
>>  
>> On 2016/01/28 at 03:15, Andrew Morton wrote:
>>> On Wed, 27 Jan 2016 14:48:31 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
>>>
>>>> For allocation of kimage failure or kexec_prepare or load segments
>>>> errors there is no need to keep crashkernel memory mapped.
>>>> It will affect only s390 as map/unmap hook defined only for it.
>>>> As on unmap s390 also changes os_info structure let's check return code
>>>> and add info only on success.
>>>>
>>> This conflicts (both mechanically and somewhat conceptually) with
>>> Xunlei Pang's "kexec: Introduce a protection mechanism for the
>>> crashkernel reserved memory" and "kexec: provide
>>> arch_kexec_protect(unprotect)_crashkres()".
>>>
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory.patch
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-introduce-a-protection-mechanism-for-the-crashkernel-reserved-memory-v4.patch
>>>
>>> and
>>>
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres.patch
>>> http://ozlabs.org/~akpm/mmots/broken-out/kexec-provide-arch_kexec_protectunprotect_crashkres-v4.patch
>>>
>>> so can we please sort all that out?
>>
>> Ah, I've checked git-log history, they are almost the same idea, can crash_unmap/map_reserved_pages()
>> be re-implemented using the new  arch_kexec_unprotect/protect_crashkres() on S390?
> Sorry, didn't fetched akpm before sending.
> Yes, sounds like really right thing to do to have one united arch-helper.

Yeah, as Michael said, "memblock_remove(crash_base, crash_size)" creates a big hole in the kernel pgtable.
In order to have one united arch-helper, I guess we can forbid this to let the pgtable setup for crash memory,
then we can easily move the logic of crash_map_reserved_pages() to arch_kexec_unprotect_crashkres(),  and
move crash_unmap_reserved_pages() to arch_kexec_protect_crashkres(). After that crash_map_reserved_pages()
called in crash_shrink_memory() can be safely removed as well.

Regards,
Xunlei

>>
>> Regards,
>> Xunlei
>>
>>> _______________________________________________
>>> kexec mailing list
>>> kexec@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/kexec
>>
>
>
> -- 
> Regards,
> Dmitry Safonov


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-01-28  8:57     ` Dmitry Safonov
  (?)
@ 2016-02-02  5:45       ` Andrew Morton
  -1 siblings, 0 replies; 31+ messages in thread
From: Andrew Morton @ 2016-02-02  5:45 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: Minfei Huang, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On Thu, 28 Jan 2016 11:57:22 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:

> On 01/28/2016 09:29 AM, Minfei Huang wrote:
> > On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> >> For allocation of kimage failure or kexec_prepare or load segments
> >> errors there is no need to keep crashkernel memory mapped.
> >> It will affect only s390 as map/unmap hook defined only for it.
> >> As on unmap s390 also changes os_info structure let's check return code
> >> and add info only on success.
> > Hi, Dmitry.
> >
> > Previously, I sent a patch to fix this issue. You can refer it in
> > following link.
> >
> > http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
> Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
> because it has dazzled me while I was debugging around.

There were a bunch of patches tossed around in that thread but I'm not
sure that anything actually got applied?  Perhaps some resending is
needed.

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-02-02  5:45       ` Andrew Morton
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Morton @ 2016-02-02  5:45 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: Minfei Huang, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On Thu, 28 Jan 2016 11:57:22 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:

> On 01/28/2016 09:29 AM, Minfei Huang wrote:
> > On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> >> For allocation of kimage failure or kexec_prepare or load segments
> >> errors there is no need to keep crashkernel memory mapped.
> >> It will affect only s390 as map/unmap hook defined only for it.
> >> As on unmap s390 also changes os_info structure let's check return code
> >> and add info only on success.
> > Hi, Dmitry.
> >
> > Previously, I sent a patch to fix this issue. You can refer it in
> > following link.
> >
> > http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
> Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
> because it has dazzled me while I was debugging around.

There were a bunch of patches tossed around in that thread but I'm not
sure that anything actually got applied?  Perhaps some resending is
needed.

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-02-02  5:45       ` Andrew Morton
  0 siblings, 0 replies; 31+ messages in thread
From: Andrew Morton @ 2016-02-02  5:45 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: linux-s390, Minfei Huang, 0x7f454c46, heiko.carstens,
	linux-kernel, ebiederm, schwidefsky, holzheu, dyoung, kexec

On Thu, 28 Jan 2016 11:57:22 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:

> On 01/28/2016 09:29 AM, Minfei Huang wrote:
> > On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> >> For allocation of kimage failure or kexec_prepare or load segments
> >> errors there is no need to keep crashkernel memory mapped.
> >> It will affect only s390 as map/unmap hook defined only for it.
> >> As on unmap s390 also changes os_info structure let's check return code
> >> and add info only on success.
> > Hi, Dmitry.
> >
> > Previously, I sent a patch to fix this issue. You can refer it in
> > following link.
> >
> > http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
> Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
> because it has dazzled me while I was debugging around.

There were a bunch of patches tossed around in that thread but I'm not
sure that anything actually got applied?  Perhaps some resending is
needed.


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

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
  2016-02-02  5:45       ` Andrew Morton
@ 2016-02-02 13:56         ` Minfei Huang
  -1 siblings, 0 replies; 31+ messages in thread
From: Minfei Huang @ 2016-02-02 13:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Dmitry Safonov, linux-kernel, schwidefsky, heiko.carstens,
	ebiederm, linux-s390, 0x7f454c46, kexec, holzheu, dyoung

On 02/01/16 at 09:45pm, Andrew Morton wrote:
> On Thu, 28 Jan 2016 11:57:22 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> 
> > On 01/28/2016 09:29 AM, Minfei Huang wrote:
> > > On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> > >> For allocation of kimage failure or kexec_prepare or load segments
> > >> errors there is no need to keep crashkernel memory mapped.
> > >> It will affect only s390 as map/unmap hook defined only for it.
> > >> As on unmap s390 also changes os_info structure let's check return code
> > >> and add info only on success.
> > > Hi, Dmitry.
> > >
> > > Previously, I sent a patch to fix this issue. You can refer it in
> > > following link.
> > >
> > > http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
> > Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
> > because it has dazzled me while I was debugging around.
> 
> There were a bunch of patches tossed around in that thread but I'm not
> sure that anything actually got applied?  Perhaps some resending is
> needed.
> 

Hi, Andrew.

I will work on it to update a new patch.

Thanks
Minfei

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

* Re: [PATCH] kexec: unmap reserved pages for each error-return way
@ 2016-02-02 13:56         ` Minfei Huang
  0 siblings, 0 replies; 31+ messages in thread
From: Minfei Huang @ 2016-02-02 13:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-s390, Dmitry Safonov, heiko.carstens, linux-kernel,
	ebiederm, 0x7f454c46, schwidefsky, holzheu, dyoung, kexec

On 02/01/16 at 09:45pm, Andrew Morton wrote:
> On Thu, 28 Jan 2016 11:57:22 +0300 Dmitry Safonov <dsafonov@virtuozzo.com> wrote:
> 
> > On 01/28/2016 09:29 AM, Minfei Huang wrote:
> > > On 01/27/16 at 02:48pm, Dmitry Safonov wrote:
> > >> For allocation of kimage failure or kexec_prepare or load segments
> > >> errors there is no need to keep crashkernel memory mapped.
> > >> It will affect only s390 as map/unmap hook defined only for it.
> > >> As on unmap s390 also changes os_info structure let's check return code
> > >> and add info only on success.
> > > Hi, Dmitry.
> > >
> > > Previously, I sent a patch to fix this issue. You can refer it in
> > > following link.
> > >
> > > http://lists.infradead.org/pipermail/kexec/2015-July/013960.html
> > Oh, scratch my patch - I'm fine with yours, wanted to do the similar thing
> > because it has dazzled me while I was debugging around.
> 
> There were a bunch of patches tossed around in that thread but I'm not
> sure that anything actually got applied?  Perhaps some resending is
> needed.
> 

Hi, Andrew.

I will work on it to update a new patch.

Thanks
Minfei

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

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

end of thread, other threads:[~2016-02-02 13:53 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-27 11:48 [PATCH] kexec: unmap reserved pages for each error-return way Dmitry Safonov
2016-01-27 11:48 ` Dmitry Safonov
2016-01-27 11:48 ` Dmitry Safonov
2016-01-27 19:15 ` Andrew Morton
2016-01-27 19:15   ` Andrew Morton
2016-01-27 19:15   ` Andrew Morton
2016-01-28 10:32   ` Michael Holzheu
2016-01-28 10:32     ` Michael Holzheu
2016-01-28 10:32     ` Michael Holzheu
2016-01-28 11:56     ` Xunlei Pang
2016-01-28 11:56       ` Xunlei Pang
2016-01-28 12:44       ` Michael Holzheu
2016-01-28 12:44         ` Michael Holzheu
2016-01-28 13:12         ` Xunlei Pang
2016-01-28 13:12           ` Xunlei Pang
2016-01-28 14:01           ` Michael Holzheu
2016-01-28 14:01             ` Michael Holzheu
     [not found]   ` <56A983F3.5010506@redhat.com>
     [not found]     ` <56A9D927.70402@virtuozzo.com>
2016-01-29  3:14       ` Xunlei Pang
2016-01-29  3:14         ` Xunlei Pang
2016-01-28  3:36 ` Xunlei Pang
2016-01-28  3:36   ` Xunlei Pang
2016-01-28  6:29 ` Minfei Huang
2016-01-28  6:29   ` Minfei Huang
2016-01-28  8:57   ` Dmitry Safonov
2016-01-28  8:57     ` Dmitry Safonov
2016-01-28  8:57     ` Dmitry Safonov
2016-02-02  5:45     ` Andrew Morton
2016-02-02  5:45       ` Andrew Morton
2016-02-02  5:45       ` Andrew Morton
2016-02-02 13:56       ` Minfei Huang
2016-02-02 13:56         ` Minfei Huang

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.