linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
To: iamjoonsoo.kim@lge.com, ebiederm@xmission.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, anderson@redhat.com, vgoyal@redhat.com,
	lliubbo@gmail.com, penberg@kernel.org, kexec@lists.infradead.org,
	js1304@gmail.com
Subject: Re: [PATCH v2 7/8] mm, vmalloc: export vmap_area_list, instead of vmlist
Date: Fri, 15 Mar 2013 20:04:11 +0900	[thread overview]
Message-ID: <20130315200411.59edc3c7af0ffafdef2a9d4b@mxc.nes.nec.co.jp> (raw)
In-Reply-To: <87k3pbsst7.fsf@xmission.com>

Hello,

On Tue, 12 Mar 2013 23:43:48 -0700
ebiederm@xmission.com (Eric W. Biederman) wrote:

> Joonsoo Kim <iamjoonsoo.kim@lge.com> writes:
> 
> > From: Joonsoo Kim <js1304@gmail.com>
> >
> > Although our intention is to unexport internal structure entirely,
> > but there is one exception for kexec. kexec dumps address of vmlist
> > and makedumpfile uses this information.
> >
> > We are about to remove vmlist, then another way to retrieve information
> > of vmalloc layer is needed for makedumpfile. For this purpose,
> > we export vmap_area_list, instead of vmlist.
> 
> That seems entirely reasonable to me.  Usage by kexec should not limit
> the evoluion of the kernel especially usage by makedumpfile.
> 
> Atsushi Kumagai can you make makedumpfile work with this change?

Sure! I'm going to work with this change in the next version.
But, I noticed that necessary information is missed in this patch,
and sorry for too late reply.

Both OFFSET(vmap_area.va_start) and OFFSET(vmap_area.list) are
necessary to get vmalloc_start value from vmap_area_list, but
they aren't exported in this patch.
I understand that the policy of this patch series "to unexport
internal structure entirely", although the information is necessary
for makedumpfile.

Additionally, OFFSET(vm_struct.addr) is no longer used, should be
removed. It was added for the same purpose as vmlist in the commit
below. 

  commit acd99dbf54020f5c80b9aa2f2ea86f43cb285b02
  Author: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
  Date:   Sat Oct 18 20:28:30 2008 -0700

      kdump: add vmlist.addr to vmcoreinfo for x86 vmalloc translation.

To sum it up, I would like to push the patch below.

Thanks
Atsushi Kumagai

--
From: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Date: Fri, 15 Mar 2013 14:19:28 +0900
Subject: [PATCH] kexec, vmalloc: Export additional information of
 vmalloc layer.

Now, vmap_area_list is exported as VMCOREINFO for makedumpfile
to get the start address of vmalloc region (vmalloc_start).
The address which contains vmalloc_start value is represented as
below:

  vmap_area_list.next - OFFSET(vmap_area.list) + OFFSET(vmap_area.va_start)

However, both OFFSET(vmap_area.va_start) and OFFSET(vmap_area.list)
aren't exported as VMCOREINFO.

So, this patch exports them externally with small cleanup.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
---
 include/linux/vmalloc.h | 12 ++++++++++++
 kernel/kexec.c          |  3 ++-
 mm/vmalloc.c            | 11 -----------
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 8a25f90..62e0354 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -4,6 +4,7 @@
 #include <linux/spinlock.h>
 #include <linux/init.h>
 #include <asm/page.h>		/* pgprot_t */
+#include <linux/rbtree.h>
 
 struct vm_area_struct;		/* vma defining user mapping in mm_types.h */
 
@@ -35,6 +36,17 @@ struct vm_struct {
 	const void		*caller;
 };
 
+struct vmap_area {
+	unsigned long va_start;
+	unsigned long va_end;
+	unsigned long flags;
+	struct rb_node rb_node;         /* address sorted rbtree */
+	struct list_head list;          /* address sorted list */
+	struct list_head purge_list;    /* "lazy purge" list */
+	struct vm_struct *vm;
+	struct rcu_head rcu_head;
+};
+
 /*
  *	Highlevel APIs for driver use
  */
diff --git a/kernel/kexec.c b/kernel/kexec.c
index d9bfc6c..5db0148 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1527,7 +1527,8 @@ static int __init crash_save_vmcoreinfo_init(void)
 	VMCOREINFO_OFFSET(free_area, free_list);
 	VMCOREINFO_OFFSET(list_head, next);
 	VMCOREINFO_OFFSET(list_head, prev);
-	VMCOREINFO_OFFSET(vm_struct, addr);
+	VMCOREINFO_OFFSET(vmap_area, va_start);
+	VMCOREINFO_OFFSET(vmap_area, list);
 	VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER);
 	log_buf_kexec_setup();
 	VMCOREINFO_LENGTH(free_area.free_list, MIGRATE_TYPES);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 151da8a..72043d6 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -249,17 +249,6 @@ EXPORT_SYMBOL(vmalloc_to_pfn);
 #define VM_LAZY_FREEING	0x02
 #define VM_VM_AREA	0x04
 
-struct vmap_area {
-	unsigned long va_start;
-	unsigned long va_end;
-	unsigned long flags;
-	struct rb_node rb_node;		/* address sorted rbtree */
-	struct list_head list;		/* address sorted list */
-	struct list_head purge_list;	/* "lazy purge" list */
-	struct vm_struct *vm;
-	struct rcu_head rcu_head;
-};
-
 static DEFINE_SPINLOCK(vmap_area_lock);
 /* Export for kexec only */
 LIST_HEAD(vmap_area_list);
-- 
1.8.0.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-03-15 11:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13  6:32 [PATCH v2 0/8] remove vm_struct list management Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 1/8] mm, vmalloc: change iterating a vmlist to find_vm_area() Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 2/8] mm, vmalloc: move get_vmalloc_info() to vmalloc.c Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 3/8] mm, vmalloc: protect va->vm by vmap_area_lock Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 4/8] mm, vmalloc: iterate vmap_area_list, instead of vmlist in vread/vwrite() Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 5/8] mm, vmalloc: iterate vmap_area_list in get_vmalloc_info() Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 6/8] mm, vmalloc: iterate vmap_area_list, instead of vmlist, in vmallocinfo() Joonsoo Kim
2013-03-13  6:32 ` [PATCH v2 7/8] mm, vmalloc: export vmap_area_list, instead of vmlist Joonsoo Kim
2013-03-13  6:43   ` Eric W. Biederman
2013-03-15 11:04     ` Atsushi Kumagai [this message]
2013-03-13  6:33 ` [PATCH v2 8/8] mm, vmalloc: remove list management of vmlist after initializing vmalloc Joonsoo Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130315200411.59edc3c7af0ffafdef2a9d4b@mxc.nes.nec.co.jp \
    --to=kumagai-atsushi@mxc.nes.nec.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=anderson@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lliubbo@gmail.com \
    --cc=penberg@kernel.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox