mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amerigo Wang <xiyou.wangcong@gmail.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	xiyou.wangcong@gmail.com,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	ralf@linux-mips.org, benh@kernel.crashing.org,
	lethal@linux-sh.org
Subject: Re: [RFC][PATCH 4/6] kcore: kcore unify text range entry
Date: Tue, 28 Jul 2009 18:10:09 +0800	[thread overview]
Message-ID: <20090728101009.GF6036@cr0.nay.redhat.com> (raw)
In-Reply-To: <20090724171522.701497e3.kamezawa.hiroyu@jp.fujitsu.com>

On Fri, Jul 24, 2009 at 05:15:22PM +0900, KAMEZAWA Hiroyuki wrote:
>From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
>Some 64bit arch has a special segment for mapping kernel text. It should be
>entried to /proc/kcore in addtion to direct-linear-map, vmalloc area.
>This patch unifies KCORE_TEXT entry scattered under x86 and ia64.
>
>I'm not familiar with other archs (mips has its own even after this patch)
>If range of [_stext ..._end) is a valid area of text/data and it's not
>in direct-map/vmalloc area, defining CONFIG_ARCH_PROC_KCORE_TEXT is only
>a necessary thing to do for archs.
>
>Note: I left mips-64 as it is now.
>
>Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


Excellent.

Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>

>---
>Index: mmotm-2.6.31-Jul16/arch/x86/Kconfig
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/x86/Kconfig
>+++ mmotm-2.6.31-Jul16/arch/x86/Kconfig
>@@ -1244,6 +1244,10 @@ config ARCH_MEMORY_PROBE
> 	def_bool X86_64
> 	depends on MEMORY_HOTPLUG
> 
>+config ARCH_PROC_KCORE_TEXT
>+	def_bool y
>+	depends on X86_64 && PROC_KCORE
>+
> config ILLEGAL_POINTER_VALUE
>        hex
>        default 0 if X86_32
>Index: mmotm-2.6.31-Jul16/arch/ia64/Kconfig
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/ia64/Kconfig
>+++ mmotm-2.6.31-Jul16/arch/ia64/Kconfig
>@@ -496,6 +496,10 @@ config HAVE_ARCH_NODEDATA_EXTENSION
> 	def_bool y
> 	depends on NUMA
> 
>+config ARCH_PROC_KCORE_TEXT
>+	def_bool y
>+	depends on PROC_KCORE
>+
> config IA32_SUPPORT
> 	bool "Support for Linux/x86 binaries"
> 	help
>Index: mmotm-2.6.31-Jul16/arch/ia64/mm/init.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/ia64/mm/init.c
>+++ mmotm-2.6.31-Jul16/arch/ia64/mm/init.c
>@@ -617,7 +617,6 @@ mem_init (void)
> 	long reserved_pages, codesize, datasize, initsize;
> 	pg_data_t *pgdat;
> 	int i;
>-	static struct kcore_list kcore_kernel;
> 
> 	BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE);
> 	BUG_ON(PTRS_PER_PMD * sizeof(pmd_t) != PAGE_SIZE);
>@@ -637,7 +636,6 @@ mem_init (void)
> 	max_mapnr = max_low_pfn;
> #endif
> 	high_memory = __va(max_low_pfn * PAGE_SIZE);
>-	kclist_add(&kcore_kernel, _stext, _end - _stext, KCORE_TEXT);
> 
> 	for_each_online_pgdat(pgdat)
> 		if (pgdat->bdata->node_bootmem_map)
>Index: mmotm-2.6.31-Jul16/arch/x86/mm/init_64.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/arch/x86/mm/init_64.c
>+++ mmotm-2.6.31-Jul16/arch/x86/mm/init_64.c
>@@ -647,8 +647,7 @@ EXPORT_SYMBOL_GPL(memory_add_physaddr_to
> 
> #endif /* CONFIG_MEMORY_HOTPLUG */
> 
>-static struct kcore_list kcore_mem, kcore_kernel,
>-			 kcore_modules, kcore_vsyscall;
>+static struct kcore_list kcore_mem, kcore_modules, kcore_vsyscall;
> 
> void __init mem_init(void)
> {
>@@ -678,7 +677,6 @@ void __init mem_init(void)
> 
> 	/* Register memory areas for /proc/kcore */
> 	kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT, KCORE_RAM);
>-	kclist_add(&kcore_kernel, &_stext, _end - _stext, KCORE_TEXT);
> 	kclist_add(&kcore_modules, (void *)MODULES_VADDR, MODULES_LEN,
> 			KCORE_OTHER);
> 	kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
>Index: mmotm-2.6.31-Jul16/fs/proc/kcore.c
>===================================================================
>--- mmotm-2.6.31-Jul16.orig/fs/proc/kcore.c
>+++ mmotm-2.6.31-Jul16/fs/proc/kcore.c
>@@ -21,6 +21,7 @@
> #include <asm/uaccess.h>
> #include <asm/io.h>
> #include <linux/list.h>
>+#include <asm/sections.h>
> 
> #define CORE_STR "CORE"
> 
>@@ -408,10 +409,26 @@ read_kcore(struct file *file, char __use
> 
> static struct kcore_list kcore_vmalloc;
> 
>+#ifdef CONFIG_ARCH_PROC_KCORE_TEXT
>+static struct kcore_list kcore_text;
>+/*
>+ * If defined, special segment is used for mapping kernel text instead of
>+ * direct-map area. We need to create special TEXT section.
>+ */
>+static void __init proc_kcore_text_init(void)
>+{
>+	kclist_add(&kcore_text, _stext, _end - _stext, KCORE_TEXT);
>+}
>+#else
>+static void __init proc_kcore_text_init(void)
>+{
>+}
>+#endif
>+
> static int __init proc_kcore_init(void)
> {
> 	proc_root_kcore = proc_create("kcore", S_IRUSR, NULL, &proc_kcore_operations);
>-
>+	proc_kcore_text_init();
> 	kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
> 		VMALLOC_END - VMALLOC_START, KCORE_VMALLOC);
> 	return 0;
>

  reply	other threads:[~2009-07-28 10:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24  8:08 [RFC][PATCH 0/6] kcore clean up and enhance. v3 KAMEZAWA Hiroyuki
2009-07-24  8:10 ` [RFC][PATCH 1/6] kcore: clean up to use generic list ops KAMEZAWA Hiroyuki
2009-07-24  8:11 ` [RFC][PATCH 2/6] kcore : add type attribute to kclist KAMEZAWA Hiroyuki
2009-07-24  8:13 ` [RFC][PATCH 3/6] kcore: unify vmalloc range entry KAMEZAWA Hiroyuki
2009-07-28 10:05   ` Amerigo Wang
2009-07-24  8:15 ` [RFC][PATCH 4/6] kcore: kcore unify text " KAMEZAWA Hiroyuki
2009-07-28 10:10   ` Amerigo Wang [this message]
2009-07-24  8:19 ` [RFC][PATCH 5/6] kcore: check physical memory range in correct way KAMEZAWA Hiroyuki
2009-07-28 10:24   ` Amerigo Wang
2009-07-28 23:58     ` KAMEZAWA Hiroyuki
2009-07-29  8:50       ` Amerigo Wang
2009-07-24  8:22 ` [RFC][PATCH 6/6] kcore: walk_system_ram_range() KAMEZAWA Hiroyuki

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=20090728101009.GF6036@cr0.nay.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /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

all inboxes | Powered by JetHome®