All of lore.kernel.org
 help / color / mirror / Atom feed
* [Makedumpfile PATCH] Fix SECTION_MAP_MASK for kernel >= v.13
@ 2017-08-10 17:21 Pratyush Anand
  2017-08-14  1:53 ` Atsushi Kumagai
  0 siblings, 1 reply; 2+ messages in thread
From: Pratyush Anand @ 2017-08-10 17:21 UTC (permalink / raw)
  To: ats-kumagai; +Cc: Pratyush Anand, dyoung, kexec

commit 2d070eab2e82 "mm: consider zone which is not fully populated to
have holes" added a new flag SECTION_IS_ONLINE and therefore
SECTION_MAP_MASK has been changed. We are not able to find correct
mem_map in makedumpfile for kernel version v4.13-rc1 and onward because
of the above kernel change.

This patch fixes the MASK value keeping the code backward compatible

Signed-off-by: Pratyush Anand <panand@redhat.com>
---
 makedumpfile.c | 5 ++++-
 makedumpfile.h | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 30230a15a2e7..7350e5b5af95 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3304,7 +3304,10 @@ section_mem_map_addr(unsigned long addr)
 		return NOT_KV_ADDR;
 	}
 	map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
-	map &= SECTION_MAP_MASK;
+	if (info->kernel_version <= KERNEL_VERSION(4, 12, 0))
+		map &= SECTION_MAP_MASK_4_12;
+	else
+		map &= SECTION_MAP_MASK;
 	free(mem_section);
 
 	return map;
diff --git a/makedumpfile.h b/makedumpfile.h
index 8a05794843fb..322f28c632b0 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -183,7 +183,9 @@ isAnon(unsigned long mapping)
 #define SECTIONS_PER_ROOT()	(info->sections_per_root)
 #define SECTION_ROOT_MASK()	(SECTIONS_PER_ROOT() - 1)
 #define SECTION_NR_TO_ROOT(sec)	((sec) / SECTIONS_PER_ROOT())
-#define SECTION_MAP_LAST_BIT	(1UL<<2)
+#define SECTION_IS_ONLINE	(1UL<<2)
+#define SECTION_MAP_LAST_BIT	(1UL<<3)
+#define SECTION_MAP_MASK_4_12	(~(SECTION_IS_ONLINE-1))
 #define SECTION_MAP_MASK	(~(SECTION_MAP_LAST_BIT-1))
 #define NR_SECTION_ROOTS()	divideup(num_section, SECTIONS_PER_ROOT())
 #define SECTION_NR_TO_PFN(sec)	((sec) << PFN_SECTION_SHIFT())
-- 
2.9.4


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

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

* RE: [Makedumpfile PATCH] Fix SECTION_MAP_MASK for kernel >= v.13
  2017-08-10 17:21 [Makedumpfile PATCH] Fix SECTION_MAP_MASK for kernel >= v.13 Pratyush Anand
@ 2017-08-14  1:53 ` Atsushi Kumagai
  0 siblings, 0 replies; 2+ messages in thread
From: Atsushi Kumagai @ 2017-08-14  1:53 UTC (permalink / raw)
  To: Pratyush Anand; +Cc: dyoung, kexec

Hello Pratyush,

>commit 2d070eab2e82 "mm: consider zone which is not fully populated to
>have holes" added a new flag SECTION_IS_ONLINE and therefore
>SECTION_MAP_MASK has been changed. We are not able to find correct
>mem_map in makedumpfile for kernel version v4.13-rc1 and onward because
>of the above kernel change.
>
>This patch fixes the MASK value keeping the code backward compatible
>
>Signed-off-by: Pratyush Anand <panand@redhat.com>
>---
> makedumpfile.c | 5 ++++-
> makedumpfile.h | 4 +++-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
>diff --git a/makedumpfile.c b/makedumpfile.c
>index 30230a15a2e7..7350e5b5af95 100644
>--- a/makedumpfile.c
>+++ b/makedumpfile.c
>@@ -3304,7 +3304,10 @@ section_mem_map_addr(unsigned long addr)
> 		return NOT_KV_ADDR;
> 	}
> 	map = ULONG(mem_section + OFFSET(mem_section.section_mem_map));
>-	map &= SECTION_MAP_MASK;
>+	if (info->kernel_version <= KERNEL_VERSION(4, 12, 0))

I think this condition should be "< KERNEL_VERSION(4, 13, 0)",
actually v4.12.7 doesn't have SECTION_IS_ONLINE.

Thanks,
Atsushi Kumagai

>+		map &= SECTION_MAP_MASK_4_12;
>+	else
>+		map &= SECTION_MAP_MASK;
> 	free(mem_section);
>
> 	return map;
>diff --git a/makedumpfile.h b/makedumpfile.h
>index 8a05794843fb..322f28c632b0 100644
>--- a/makedumpfile.h
>+++ b/makedumpfile.h
>@@ -183,7 +183,9 @@ isAnon(unsigned long mapping)
> #define SECTIONS_PER_ROOT()	(info->sections_per_root)
> #define SECTION_ROOT_MASK()	(SECTIONS_PER_ROOT() - 1)
> #define SECTION_NR_TO_ROOT(sec)	((sec) / SECTIONS_PER_ROOT())
>-#define SECTION_MAP_LAST_BIT	(1UL<<2)
>+#define SECTION_IS_ONLINE	(1UL<<2)
>+#define SECTION_MAP_LAST_BIT	(1UL<<3)
>+#define SECTION_MAP_MASK_4_12	(~(SECTION_IS_ONLINE-1))
> #define SECTION_MAP_MASK	(~(SECTION_MAP_LAST_BIT-1))
> #define NR_SECTION_ROOTS()	divideup(num_section, SECTIONS_PER_ROOT())
> #define SECTION_NR_TO_PFN(sec)	((sec) << PFN_SECTION_SHIFT())
>--
>2.9.4


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

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

end of thread, other threads:[~2017-08-14  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 17:21 [Makedumpfile PATCH] Fix SECTION_MAP_MASK for kernel >= v.13 Pratyush Anand
2017-08-14  1:53 ` Atsushi Kumagai

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.