linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: unable to handle kernel paging request at ffff8800cf669000
@ 2011-01-14 23:30 xing lin
  2011-01-15 23:03 ` xing lin
  2011-01-17  6:57 ` Américo Wang
  0 siblings, 2 replies; 7+ messages in thread
From: xing lin @ 2011-01-14 23:30 UTC (permalink / raw)
  To: linux-kernel

Hi,

I wrote a kernel module to calculate the hash for each page frame, in
order to see how many pages are duplicated. It works well in 32-bit
Linux with 2GB physical memory. But when I tried to run this module in
64-bit Linux(2.6.32-24-generic with NUMA enabled) with 12GB physical
memory, it can calculates hashes for the first 63553 in-use pages but
then reports a bug when the page frame number reaches 849513. This
page frame should be in use since the count for the page instance is
1. I do not know why sha_transform results in a page_fault(the data to
be digested is the page which should be in memory). Would anyone give
me some hints? Thanks.

 oops.txt from dmesg:
-----------------------------------
[  590.424038] BUG: unable to handle kernel paging request at ffff8800cf669000
[  590.438705] IP: [<ffffffff8152edc8>] sha_transform+0x18/0x1e0
[  590.452164] PGD 1002063 PUD a067 PMD b067 PTE 0
[  590.464888] Oops: 0000 [#1] SMP
[  590.476077] last sysfs file:
/sys/devices/system/cpu/cpu7/cache/index2/shared_cpu_map
[  590.499137] CPU 7
[  590.508929] Modules linked in: sha1_generic pageinfo_NUMA nfs lockd
nfs_acl auth_rpcgss sunrpc joydev fbcon tileblit dell_wmi dcdbas font
bitblit softcursor power_meter vga16fb vgastate psmouse serio_raw bnx2
lp parport usbhid hid mptsas mptscsih mptbase scsi_transport_sas
[  590.570965] Pid: 1887, comm: cat Not tainted 2.6.32-24-generic
#38+emulab1 PowerEdge R710
[  590.597398] RIP: 0010:[<ffffffff8152edc8>]  [<ffffffff8152edc8>]
sha_transform+0x18/0x1e0
[  590.625098] RSP: 0018:ffff88031eeaba58  EFLAGS: 00010292
[  590.640580] RAX: 0000000000000000 RBX: 0000000000000040 RCX: 0000000000001000
[  590.658272] RDX: ffff88031eeabaa8 RSI: ffff8800cf669000 RDI: ffff88031f45e418
[  590.676439] RBP: ffff88031eeaba88 R08: 0000000000001000 R09: ffff88031eeabd98
[  590.694972] R10: 0000000000000080 R11: 0000000000000000 R12: 0000000000001000
[  590.713897] R13: ffff88031eeabaa8 R14: ffff88031f45e410 R15: ffff8800cf669000
[  590.733149] FS:  00007f2407450700(0000) GS:ffff8800330e0000(0000)
knlGS:0000000000000000
[  590.765186] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  590.783268] CR2: ffff8800cf669000 CR3: 000000031b790000 CR4: 00000000000006e0
[  590.802954] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  590.823136] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  590.843410] Process cat (pid: 1887, threadinfo ffff88031eeaa000,
task ffff88031b5bdbc0)
[  590.878043] Stack:
[  590.893066]  0d4c51d000000018 0000000000000040 0000000000001000
ffff88031eeabaa8
[  590.914054] <0> ffff88031f45e410 ffff8800cf669000 ffff88031eeabc18
ffffffffa00ca19a
[  590.948862] <0> ffff88031eeabc28 ffff88031f45e418 0000000000000000
ffff88031f45e418
[  590.997951] Call Trace:
[  591.013756]  [<ffffffffa00ca19a>] sha1_update+0x7a/0xe0 [sha1_generic]
[  591.033840]  [<ffffffff812ba88c>] ? put_dec+0x10c/0x110
[  591.052640]  [<ffffffff812bab7e>] ? number+0x2ee/0x320
[  591.070975]  [<ffffffff8113783f>] ? __kmalloc+0x1bf/0x1d0
[  591.089383]  [<ffffffff812887fc>] ? crypto_create_tfm+0x3c/0xe0
[  591.107931]  [<ffffffff8128f71f>] ? crypto_init_shash_ops_compat+0x5f/0xe0
[  591.127289]  [<ffffffff8128f188>] crypto_shash_update+0x18/0x30
[  591.145595]  [<ffffffff8128f1de>] shash_compat_update+0x3e/0x60
[  591.163827]  [<ffffffff8128f420>] shash_compat_digest+0x100/0x130
[  591.181974]  [<ffffffffa00a624d>] de_seq_show+0x14d/0x340 [pageinfo_NUMA]
[  591.200520]  [<ffffffff81013b0e>] ? common_interrupt+0xe/0x13
[  591.217877]  [<ffffffffa00a604f>] ? de_seq_next+0x3f/0xd0 [pageinfo_NUMA]
[  591.236138]  [<ffffffff81162eb7>] seq_read+0x267/0x3f0
[  591.252486]  [<ffffffff81162c50>] ? seq_read+0x0/0x3f0
[  591.268687]  [<ffffffff8119b751>] proc_reg_read+0x81/0xc0
[  591.285048]  [<ffffffff81144385>] vfs_read+0xb5/0x1a0
[  591.300730]  [<ffffffff81144541>] sys_read+0x51/0x80
[  591.316125]  [<ffffffff810131b2>] system_call_fastpath+0x16/0x1b
[  591.332247] Code: 32 10 c7 47 10 f0 e1 d2 c3 c9 c3 0f 1f 84 00 00
00 00 00 55 31 c0 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 08 0f
1f 44 00 00 <8b> 0c 06 0f c9 89 0c 02 48 83 c0 04 48 83 f8 40 75 ee 31
c9 0f
[  591.392058] RIP  [<ffffffff8152edc8>] sha_transform+0x18/0x1e0
[  591.409156]  RSP <ffff88031eeaba58>
[  591.423662] CR2: ffff8800cf669000
[  591.437952] ---[ end trace c858b9629815433b ]---
[  591.453399] note: cat[1887] exited with preempt_count 1
[  591.469249] BUG: scheduling while atomic: cat/1887/0x10000001
[  591.485508] Modules linked in: sha1_generic pageinfo_NUMA nfs lockd
nfs_acl auth_rpcgss sunrpc joydev fbcon tileblit dell_wmi dcdbas font
bitblit softcursor power_meter vga16fb vgastate psmouse serio_raw bnx2
lp parport usbhid hid mptsas mptscsih mptbase scsi_transport_sas
[  591.556226] Pid: 1887, comm: cat Tainted: G      D
2.6.32-24-generic #38+emulab1
[  591.585964] Call Trace:
[  591.599686]  [<ffffffff8105860d>] __schedule_bug+0x7d/0x90
[  591.616501]  [<ffffffff81541f5f>] thread_return+0x1f7/0x418
[  591.633331]  [<ffffffff8106326a>] __cond_resched+0x2a/0x40
[  591.650081]  [<ffffffff81542280>] _cond_resched+0x30/0x40
[  591.666767]  [<ffffffff815434b6>] down_read+0x16/0x30
[  591.683048]  [<ffffffff8106b0fb>] exit_mm+0x3b/0x150
[  591.699185]  [<ffffffff81544325>] ? _spin_lock_irq+0x15/0x20
[  591.715919]  [<ffffffff8106b445>] do_exit+0x125/0x380
[  591.731998]  [<ffffffff81545530>] oops_end+0xb0/0xf0
[  591.748125]  [<ffffffff810408e3>] no_context+0xf3/0x190
[  591.764474]  [<ffffffff81040aa5>] __bad_area_nosemaphore+0x125/0x1e0
[  591.781962]  [<ffffffff81040b73>] bad_area_nosemaphore+0x13/0x20
[  591.799111]  [<ffffffff81547114>] do_page_fault+0x2e4/0x3b0
[  591.815948]  [<ffffffff815448a5>] page_fault+0x25/0x30
[  591.832094]  [<ffffffff8152edc8>] ? sha_transform+0x18/0x1e0
[  591.848585]  [<ffffffffa00ca19a>] sha1_update+0x7a/0xe0 [sha1_generic]
[  591.864986]  [<ffffffff812ba88c>] ? put_dec+0x10c/0x110
[  591.880099]  [<ffffffff812bab7e>] ? number+0x2ee/0x320
[  591.894975]  [<ffffffff8113783f>] ? __kmalloc+0x1bf/0x1d0
[  591.909966]  [<ffffffff812887fc>] ? crypto_create_tfm+0x3c/0xe0
[  591.925493]  [<ffffffff8128f71f>] ? crypto_init_shash_ops_compat+0x5f/0xe0
[  591.942021]  [<ffffffff8128f188>] crypto_shash_update+0x18/0x30
[  591.957478]  [<ffffffff8128f1de>] shash_compat_update+0x3e/0x60
[  591.972784]  [<ffffffff8128f420>] shash_compat_digest+0x100/0x130
[  591.988182]  [<ffffffffa00a624d>] de_seq_show+0x14d/0x340 [pageinfo_NUMA]
[  592.004313]  [<ffffffff81013b0e>] ? common_interrupt+0xe/0x13
[  592.019110]  [<ffffffffa00a604f>] ? de_seq_next+0x3f/0xd0 [pageinfo_NUMA]
[  592.035007]  [<ffffffff81162eb7>] seq_read+0x267/0x3f0
[  592.048918]  [<ffffffff81162c50>] ? seq_read+0x0/0x3f0
[  592.062783]  [<ffffffff8119b751>] proc_reg_read+0x81/0xc0
[  592.076957]  [<ffffffff81144385>] vfs_read+0xb5/0x1a0
[  592.090769]  [<ffffffff81144541>] sys_read+0x51/0x80
[  592.104463]  [<ffffffff810131b2>] system_call_fastpath+0x16/0x1b

my c file:
-----------------------------------------
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>

#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/highmem.h>

#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/err.h>

#define DRIVER_AUTHOR "utos"
#define DRIVER_DESC   "A driver for memory de-duplication"
#define proc_fn       "pageinfo-NUMA"

//extern struct page *mem_map;
extern unsigned long num_physpages;
//extern unsigned long max_pfn;
static unsigned long pfn = 0;
char debug = 0;

/* This function is called at the beginning of a sequence.
 * ie, when:
 *	- the /proc file is read (first time)
 *	- after the function stop (end of sequence)
 *  pos is the position in /proc/filename.
 */
static void *
de_seq_start(struct seq_file *s, loff_t * pos)
{
	if (debug == 1) {
		printk(KERN_INFO "start: seq_start, pos: %8lu\n",
	    	   *(unsigned long *) pos);
	}

	while( !pfn_valid(*pos) && *pos < num_physpages){
		*pos ++;
	}
	pfn = *(unsigned long *) pos;

	if (pfn < num_physpages) {
		/* begin the sequence. */
		return pfn_to_page(pfn);
	} else {
		printk(KERN_INFO "seq_start: index > num_physpages\n");
		*pos = 0;
		return NULL;
	}
};


/*
 * This function is called after the beginning of a sequence.
 * It's called until the return is NULL (this ends the sequence).
 */
static void *
de_seq_next(struct seq_file *s, void *v, loff_t * pos)
{
	*pos += 1;
	while( !pfn_valid(*pos) && *pos < num_physpages){
		*pos ++;
	}
	pfn = *(unsigned long *) pos;

	if (debug == 1)
		printk(KERN_INFO "seq_next, pfn:%8lu\n", pfn);

	if (pfn >= num_physpages) {
		printk(KERN_INFO "seq_next: pfn >= num_physpages!\n");
		return NULL;
	}
	return pfn_to_page(pfn);
}

/*
 * This function is called for each "step" of a sequence
 */
static int
de_seq_show(struct seq_file *s, void *v)
{
	struct page *page = (struct page *) v;
	void *virt = kmap(page);
	struct scatterlist sg;
	struct crypto_hash *tfm;
	struct hash_desc desc;
	unsigned char result[20];
	if (debug == 1)
		printk(KERN_INFO "seq_show: %8lu\n", pfn);

#ifdef SKIP_UNUSED_PAGES
	if (page_count(page) == 0) {
		if (debug == 1)
			printk(KERN_INFO "skipping page: %8lu\n", pfn);
		return 1;
	}
#endif
	if (virt == NULL) {
		printk(KERN_ALERT "This should not happen in 64-bit machine\n");
		return 1;
	}

	/* get hash of this page */
	tfm = crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC);
	if (IS_ERR(tfm)) {
		printk(KERN_ALERT "Fail to allocate transformer object!");
		return -EFAULT;
	}
	sg_init_table(&sg, 1);
	sg_set_page(&sg, page, PAGE_SIZE, 0);
	desc.tfm = tfm;
	desc.flags = 0;
	if (crypto_hash_digestsize(tfm) > sizeof (result)) {
		printk("digest size(%u) > outputbuffer(%zu)\n",
		       crypto_hash_digestsize(tfm), sizeof (result));
		return -EFAULT;
	}

	if (crypto_hash_digest(&desc, &sg, PAGE_SIZE, (u8 *) result)) {
		printk(KERN_ALERT "Fail to call digest function!");
		return -EFAULT;
	}
	crypto_free_hash(tfm);
	seq_printf(s, "%8lu: 0x%lx, "
		   "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
		   "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x,"
		   " %d, %d, %d, %d\n",
		   pfn, (unsigned long) virt,
		   result[0], result[1], result[2], result[3], result[4],
		   result[5], result[6], result[7], result[8], result[9],
		   result[10], result[11], result[12], result[13], result[14],
		   result[15], result[16], result[17], result[18], result[19],
		   page_count(page), PageActive(page),
		   PageReserved(page), PageReclaim(page));

	kunmap(page);

	return 0;
}

/*
 * This function is called at the end of a sequence
 */
static void
de_seq_stop(struct seq_file *s, void *v)
{
	//printk(KERN_INFO "seq_read finished \n");
}

static struct seq_operations de_seq_ops = {
	.start = de_seq_start,
	.next = de_seq_next,
	.stop = de_seq_stop,
	.show = de_seq_show
};

static int
proc_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &de_seq_ops);
};

static struct file_operations file_ops = {
	.owner = THIS_MODULE,
	.open = proc_open,
	.read = seq_read,
	.llseek = seq_lseek,
	.release = seq_release
};

static int __init
lkp_init(void)
{
	struct proc_dir_entry *proc_file = NULL;
	printk(KERN_INFO "Hello from memory de-duplication module for NUMA\n");
	printk("num_physpages: %lu\n", num_physpages);
	proc_file = create_proc_entry(proc_fn, 0644, NULL);
	if (proc_file == NULL) {
		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
		       proc_fn);
		return -ENOMEM;
	}
	proc_file->proc_fops = &file_ops;
	printk(KERN_INFO "/proc/%s created\n", proc_fn);
	
	return 0;
}
static void __exit
lkp_cleanup(void)
{
	remove_proc_entry(proc_fn, NULL);
	printk(KERN_INFO "Exit from memory de-duplication module\n");
}

MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);

module_init(lkp_init);
module_exit(lkp_cleanup);

Makefile:
--------------------------------
#
# Modules and the files they are made from
#
PAGEINFO = pageinfo-NUMA
MODULES = $(PAGEINFO)
CFILES = $(MODULES:=.c)
OBJFILES = $(CFILES:.c=.o)
KOFILES = $(OBJFILES:.o=.ko)

obj-m += $(OBJFILES)

# If set, don't report pages that have no users.
EXTRA_CFLAGS=-DSKIP_UNUSED_PAGES

# Make sure to set up dependencies between source and object files
%.o: %.c
%.ko: %.o

KVERSION = $(shell uname -r)
all: $(CFILES)
	make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
	make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean

#
# Convience targets
#

# insmod can't be used to install multiple modules at once. So create
# this to install all modules at once.
install: pageinfo_install

pageinfo_install: $(PAGEINFO).ko
	insmod $(PAGEINFO).ko

#singlepage_install: $(SINGLEPAGE).ko
#	insmod $(SINGLEPAGE).ko

deinstall:
	rmmod $(KOFILES)

reinstall: deinstall install

.PHONY: install deinstall reinstall clean



-- 
Regards,
Xing
School of Computing, University of Utah
http://www.cs.utah.edu/~xinglin/

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

* Re: BUG: unable to handle kernel paging request at ffff8800cf669000
  2011-01-14 23:30 BUG: unable to handle kernel paging request at ffff8800cf669000 xing lin
@ 2011-01-15 23:03 ` xing lin
  2011-01-16 22:44   ` xing lin
  2011-01-17  7:00   ` Américo Wang
  2011-01-17  6:57 ` Américo Wang
  1 sibling, 2 replies; 7+ messages in thread
From: xing lin @ 2011-01-15 23:03 UTC (permalink / raw)
  To: linux-kernel

It turns out I can not read that page in a kernel module at all. A
simple read of that page will result in an oops as well. I have
checked the flags of this page with others. They are almost the same.
Any suggestions about why this happens or how to know whether a page
can be read or not are really welcome. Thanks.

my module to print the content of a single page to dmesg:
#include <linux/module.h>       /* We're building a module */
#include <linux/kernel.h>       /* We're doing kernel work */
#include <linux/proc_fs.h>      /* because we use proc fs */
#include <asm/uaccess.h>        /* for copy_from_user */
#include <linux/mm.h>           /* for page_address and kmap */
#include <linux/highmem.h>

#define DRIVER_AUTHOR "utos"
#define DRIVER_DESC   "A driver for memory de-duplication"
#define proc_fn       "singlepage"

//extern struct page *mem_map;
extern unsigned long num_physpages;
//extern unsigned long max_mapnr;

struct proc_dir_entry *proc_file = NULL;
static unsigned long pageid = 0;
char debug = 0;

int
procfile_read(char *buffer, char **start,
              off_t offset, int count, int *peof, void *dat)
{
        struct page *page = pfn_to_page(pageid);
        void *virt = page_address(page);
        char mapped = 0;
        int i = 0;
        if (debug == 1)
                printk(KERN_DEBUG "offset: %lu, count: %d\n", offset, count);

        if (offset >= PAGE_SIZE) {
                printk(KERN_INFO "reach file end!\n");
                *peof = 1;
                return 0;
        }

        if (virt == NULL) {
                virt = kmap(page);
                if (virt == NULL) {
                        printk(KERN_ALERT "Fail to map highmem!");
                        return 0;
                }
                mapped = 1;
        }

        if (count > PAGE_SIZE - offset) {
                count = PAGE_SIZE - offset;
                *peof = 1;
        }

        if (debug == 1)
                printk(KERN_DEBUG "offset: %lu, count: %d\n", offset, count);

        i = 0;
        while (i < count) {
                //*(unsigned char *) (buffer + i) =
                  //  *((unsigned char *) virt + offset + i);
                //printk("%02X", *((unsigned char *) buffer + i));
                printk("%02X", *((unsigned char *) virt + offset + i));
                i++;
        }
       if (mapped == 1) {
                kunmap(page);
        }

        *(int *) start = count;
        return count;
}

void show_flags(struct page * page){
        if( PageLocked(page) ){
                printk(KERN_INFO "locked\t");
        }
        if( PageMlocked(page) ){
                printk(KERN_INFO "mlocked\t");
        }
        if( PageUnevictable(page) ){
                printk(KERN_INFO "unevictable\t");
        }
        if( PageHWPoison(page) ){
                printk(KERN_INFO "hwpoison\t");
        }
        if( PageError(page) ){
                printk(KERN_INFO "error\t");
        }
        if( PageActive(page) ){
                printk(KERN_INFO "active\t");
        }
        if( PageDirty(page) ){
                printk(KERN_INFO "dirty\t");
        }
        if( PagePrivate(page) ){
                printk(KERN_INFO "private\t");
        }
        if( PageReferenced(page) ){
                printk(KERN_INFO "referenced\t");
        }
        if( PageUptodate(page) ){
                printk(KERN_INFO "uptodate\t");
        }
        if( PageWriteback(page) ){
                printk(KERN_INFO "writeback\t");
        }
        if( PageSwapCache(page) ){
                printk(KERN_INFO "swapcache\t");
        }
        if( PageLRU(page) ){
                printk(KERN_INFO "lru\t");
        }
        if( PageSlab(page) ){
                printk(KERN_INFO "slab\t");
        }
        if( PageBuddy(page) ){
                printk(KERN_INFO "buddy\t");
        }
        if( PageChecked(page) ){
                printk(KERN_INFO "checked\t");
        }
        if( PageSwapBacked(page) ){
                printk(KERN_INFO "swapbacked\t");
        }
        if( PageSlobFree(page) ){
                printk(KERN_INFO "swapbacked\t");
        }
        if( PageSlubFrozen(page) ){
                printk(KERN_INFO "slubfrozen\t");
        }
        if( PageSlubDebug(page) ){
                printk(KERN_INFO "slubdebug\t");
        }
        if( PagePrivate2(page) ){
                printk(KERN_INFO "private2\t");
        }
       if( PageOwnerPriv1(page) ){
                printk(KERN_INFO "ownerpriv1\t");
        }
        if( PageMappedToDisk(page) ){
                printk(KERN_INFO "mappedtodisk\t");
        }
        if( PageReadahead(page) ){
                printk(KERN_INFO "readahead\t");
        }
        if( PageReclaim(page) ){
                printk(KERN_INFO "reclaim\t");
        }
        printk(KERN_INFO "show flags done\n");
}

int
procfile_write(struct file *file, const char *buffer, unsigned long count,
               void *data)
{
        unsigned long bytes_not_copied = 0;
        // page id is copied into kernel as a string.
        char page_id[20] = { 0 };

        bytes_not_copied = copy_from_user(page_id, buffer, count);
        if (bytes_not_copied != 0) {
                printk(KERN_ALERT "%lu bytes not copied!", bytes_not_copied);
                return -EFAULT;
        }
        pageid = simple_strtoul(page_id, NULL, 10);
        if (pageid >= num_physpages) {
                printk(KERN_ALERT "pageid >= max pageid %lu!\n", num_physpages);
                return -EFAULT;
        }
        if( !pfn_valid(pageid) ){
                printk(KERN_ALERT "pageid %lu not valid\n", pageid);
                pageid = 0;
                return -EFAULT;
        }

        printk(KERN_INFO "page id is %lu!\n", pageid);
        show_flags( pfn_to_page(pageid) );
        return count;
static int __init
lkp_init(void)
{
        printk(KERN_INFO "Hello from memory de-duplication module\n");
        printk("num_physpages: %lu\n", num_physpages);
        proc_file = create_proc_entry(proc_fn, 0666, NULL);
        if (proc_file == NULL) {
                printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
                       proc_fn);
                return -ENOMEM;
        }

        proc_file->read_proc = procfile_read;
        proc_file->write_proc = procfile_write;
        printk(KERN_INFO "/proc/%s created\n", proc_fn);
        return 0;
}

static void __exit
lkp_cleanup(void)
{
        remove_proc_entry(proc_fn, NULL);
        printk(KERN_INFO "Exit from memory de-duplication module\n");
}

MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);

module_init(lkp_init);
module_exit(lkp_cleanup);


kernel oops text:
[  372.859454] Hello from memory de-duplication module
[  372.859457] num_physpages: 3342336
[  372.859462] /proc/singlepage created
[  394.392650] page id is 1!
[  394.392653] show flags done
[  417.293931] 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000!
 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[  417.295525] reach file end!
[  453.987176] page id is 849513!
[  453.987178] show flags done
[  465.667568] BUG: unable to handle kernel paging request at ffff8800cf669000
[  465.682373] IP: [<ffffffffa00da5cc>] procfile_read+0x14c/0x178 [singlepage]
[  465.697178] PGD 1002063 PUD a067 PMD b067 PTE 0
[  465.710129] Oops: 0000 [#1] SMP
[  465.721590] last sysfs file:
/sys/devices/system/cpu/cpu7/cache/index2/shared_cpu_map
[  465.745166] CPU 5
[  465.755224] Modules linked in: singlepage nfs lockd nfs_acl
auth_rpcgss sunrpc fbcon tileblit font bitblit power_meter psmouse
softcursor joydev dell_wmi serio_raw dcdbas vga16fb vgastate bnx2 lp
parport usbhid hid mptsas mptscsih mptbase scsi_transport_sas [last
unloaded: singlepage]
[  465.820069] Pid: 2349, comm: cat Not tainted 2.6.32-24-generic
#38+emulab1 PowerEdge R710
[  465.847062] RIP: 0010:[<ffffffffa00da5cc>]  [<ffffffffa00da5cc>]
procfile_read+0x14c/0x178 [singlepage]
[  465.847067] RSP: 0018:ffff8803209abda8  EFLAGS: 00010246
[  465.847069] RAX: ffff880000000000 RBX: 0000000000000000 RCX: 0000000000000c00
[  465.847071] RDX: 0000000000000c00 RSI: ffff8803209abe08 RDI: ffff88031ea6e000
[  465.847074] RBP: ffff8803209abdd8 R08: ffff8803209abe14 R09: 0000000000000000
[  465.847076] R10: ffffffffa00da480 R11: 0000000000000c00 R12: ffff8803209abe08
[  465.847078] R13: ffff8800cf669000 R14: ffff88031ea6e000 R15: 0000000000008000
[  465.847081] FS:  00007fd434162700(0000) GS:ffff8800330a0000(0000)
knlGS:0000000000000000
[  465.847083] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  465.847085] CR2: ffff8800cf669000 CR3: 000000031b575000 CR4: 00000000000006e0
[  465.847088] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  465.847090] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  465.847093] Process cat (pid: 2349, threadinfo ffff8803209aa000,
task ffff88032179c4d0)
[  465.847094] Stack:
[  465.847096]  ffff8803209abf48 fffffffffffffff4 0000000000c01000
ffff8803209abf48
[  465.847098] <0> 0000000000000c00 0000000000c01000 ffff8803209abe48
ffffffff811a10d7
[  465.847101] <0> 0000000000008000 0000000000000000 0000000000000000
ffff88032171e900
[  465.847105] Call Trace:
[  465.847112]  [<ffffffff811a10d7>] __proc_file_read+0x197/0x2e0
[  465.847118]  [<ffffffff811a128d>] proc_file_read+0x6d/0xb0
[  465.847121]  [<ffffffff811a1220>] ? proc_file_read+0x0/0xb0
[  465.847125]  [<ffffffff8119b751>] proc_reg_read+0x81/0xc0
[  465.847130]  [<ffffffff81144385>] vfs_read+0xb5/0x1a0
[  465.847134]  [<ffffffff81546f88>] ? do_page_fault+0x158/0x3b0
[  465.847137]  [<ffffffff81144541>] sys_read+0x51/0x80
[  465.847143]  [<ffffffff810131b2>] system_call_fastpath+0x16/0x1b
[  465.847145] Code: 89 4d d8 4c 89 45 d0 e8 57 71 46 e1 4c 8b 45 d0
8b 4d d8 e9 fa fe ff ff 48 b8 00 00 00 00 00 88 ff ff 48 01 c3 4e 8d
2c 2b 31 db <41> 0f b6 75 00 31 c0 48 c7 c7 68 a8 0d a0 89 4d d8 83 c3
01 49
[  465.847165] RIP  [<ffffffffa00da5cc>] procfile_read+0x14c/0x178 [singlepage]
[  465.847169]  RSP <ffff8803209abda8>
[  465.847171] CR2: ffff8800cf669000
[  465.847173] ---[ end trace a6d7a7d3359f2672 ]---

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

* Re: BUG: unable to handle kernel paging request at ffff8800cf669000
  2011-01-15 23:03 ` xing lin
@ 2011-01-16 22:44   ` xing lin
  2011-01-17  7:00   ` Américo Wang
  1 sibling, 0 replies; 7+ messages in thread
From: xing lin @ 2011-01-16 22:44 UTC (permalink / raw)
  To: linux-kernel

I think I have solved this problem: it is because some areas of the
physical memory are not accessible to the kernel. The physical memory
Some areas are for special usages such as ACPI and some areas are
reserved: even kernel can not access these areas. The configuration of
the layout of the physical memory space is determined by BIOS and is
stored in the data structure e820map.

Kernel is allowed to access two types of physical memory: E820_RAM and
E820_RESERVED_KERN. So, before calculate the hash, I get the physical
address and check against these two types. Return immediately if the
physical address is not accessible to kernel.

My c file is as following now:
----------------------------------
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>

#include <linux/mm.h>
#include <asm/e820.h>
//#include <linux/mmzone.h>

#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/err.h>

#define DRIVER_AUTHOR "FLUX Research Group"
#define DRIVER_DESC   "A driver for memory de-duplication - UNMA"
#define proc_fn       "pageinfo-NUMA"

extern unsigned long num_physpages;
extern int e820_any_mapped(u64 start, u64 end, unsigned type);
static unsigned long pfn = 0;
char debug = 1;

/* This function is called at the beginning of a sequence.
 * ie, when:
 *  - the /proc file is read (first time)
 *  - after the function stop (end of sequence)
 *  pos is the position in /proc/filename.
 */
static void *
de_seq_start(struct seq_file *s, loff_t * pos)
{
    if (debug == 1) {
        printk(KERN_INFO "start: seq_start, pos: %8lu\n",
               *(unsigned long *) pos);
    }

    pfn = *(unsigned long *) pos;
    while(  !pfn_valid(pfn) && pfn < num_physpages) {
        pfn ++;
    }

    if (pfn < num_physpages) {
        /* begin the sequence. */
        *pos = pfn;
        return pfn_to_page(pfn);
    } else {
        printk(KERN_INFO "seq_start: %8lu > num_physpages\n", pfn);
        *pos = 0;
        return NULL;
    }
};

/*
 * This function is called after the beginning of a sequence.
 * It's called until the return is NULL (this ends the sequence).
 */
static void *
de_seq_next(struct seq_file *s, void *v, loff_t * pos)
{
    pfn = *pos + 1;

    while(  !pfn_valid(pfn) && pfn < num_physpages) {
        pfn ++;
    }
    *pos = pfn;

    if (debug == 1)
        printk(KERN_INFO "seq_next, pfn:%8lu\n", pfn);

    if (pfn >= num_physpages) {
        printk(KERN_INFO "seq_next: %8lu >= num_physpages!\n", pfn);
        return NULL;
    }
    return pfn_to_page(pfn);
}

/*
 * This function is called for each "step" of a sequence
 */
static int
de_seq_show(struct seq_file *s, void *v)
{
    struct page *page = (struct page *) v;
    u64 va = (u64)page_address(page);
    u64 pa = __pa(va);
    struct scatterlist sg;
    struct crypto_hash *tfm;
    struct hash_desc desc;
    unsigned char result[20];
    if (debug == 1)
        printk(KERN_INFO "seq_show: %8lu\n", pfn);

#ifdef SKIP_UNUSED_PAGES
    if (page_count(page) == 0) {
        if (debug == 1)
            printk(KERN_INFO "skipping page: %8lu\n", pfn);
        return 1;
    }
#endif
    /* for the current 64-bit machine, all physical memory can be
       direct-mapped into kernel space, beginning at a constant offset.
       So the kernel virtual address can never be 0. */
    if (va == 0) {
        printk(KERN_ALERT "This should not happen in 64-bit machine\n");
        return 1;
    }

    /* check whether the physical memory is accessible to kernel or not. */
    if( !(e820_any_mapped(pa, pa+PAGE_SIZE-1, E820_RAM) ||
        e820_any_mapped(pa, pa+PAGE_SIZE-1, E820_RESERVED_KERN)) ){
        printk(KERN_INFO "%8lu not usable\n", pfn);
        return 1;
    }

    /* get hash of this page */
    tfm = crypto_alloc_hash("sha1", 0, CRYPTO_ALG_ASYNC);
    if (IS_ERR(tfm)) {
        printk(KERN_ALERT "Fail to allocate transformer object!");
        return -EFAULT;
    }
    sg_init_table(&sg, 1);
    sg_set_page(&sg, page, PAGE_SIZE, 0);
    desc.tfm = tfm;
    desc.flags = 0;
    if (crypto_hash_digest(&desc, &sg, PAGE_SIZE, (u8 *) result)) {
        printk(KERN_ALERT "Fail to call digest function!");
        return -EFAULT;
    }
    crypto_free_hash(tfm);
    seq_printf(s, "%8lu: 0x%lx, "
           "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
           "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x,"
           " %d, %d, %d, %d\n",
           pfn, (unsigned long) va,
           result[0], result[1], result[2], result[3], result[4],
           result[5], result[6], result[7], result[8], result[9],
           result[10], result[11], result[12], result[13], result[14],
           result[15], result[16], result[17], result[18], result[19],
           page_count(page), PageActive(page),
           PageReserved(page), PageReclaim(page));

    return 0;
}

/*
 * This function is called at the end of a sequence
 */
static void
de_seq_stop(struct seq_file *s, void *v)
{
    if (debug == 1){
        printk(KERN_INFO "seq_read finished \n");
    }
}
static struct seq_operations de_seq_ops = {
    .start = de_seq_start,
    .next = de_seq_next,
    .stop = de_seq_stop,
    .show = de_seq_show
};

static int
proc_open(struct inode *inode, struct file *file)
{
    return seq_open(file, &de_seq_ops);
};

static struct file_operations file_ops = {
    .owner = THIS_MODULE,
    .open = proc_open,
    .read = seq_read,
    .llseek = seq_lseek,
    .release = seq_release
};

static int __init
lkp_init(void)
{
    struct proc_dir_entry *proc_file = NULL;

    printk(KERN_INFO "Hello from memory de-duplication module for NUMA\n");
    printk("num_physpages: %lu\n", num_physpages);
    proc_file = create_proc_entry(proc_fn, 0644, NULL);
    if (proc_file == NULL) {
        printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
               proc_fn);
        return -ENOMEM;
   }
    proc_file->proc_fops = &file_ops;
    printk(KERN_INFO "/proc/%s created\n", proc_fn);

    return 0;
}

static void __exit
lkp_cleanup(void)
{
    remove_proc_entry(proc_fn, NULL);
    printk(KERN_INFO "Exit from memory de-duplication module\n");
}

MODULE_LICENSE("GPL");
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);

module_init(lkp_init);
module_exit(lkp_cleanup);

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

* Re: BUG: unable to handle kernel paging request at ffff8800cf669000
  2011-01-14 23:30 BUG: unable to handle kernel paging request at ffff8800cf669000 xing lin
  2011-01-15 23:03 ` xing lin
@ 2011-01-17  6:57 ` Américo Wang
  2011-01-17 18:34   ` xing lin
  1 sibling, 1 reply; 7+ messages in thread
From: Américo Wang @ 2011-01-17  6:57 UTC (permalink / raw)
  To: xing lin; +Cc: linux-kernel

On Fri, Jan 14, 2011 at 04:30:51PM -0700, xing lin wrote:
>Hi,
>
>I wrote a kernel module to calculate the hash for each page frame, in
>order to see how many pages are duplicated. It works well in 32-bit
>Linux with 2GB physical memory. But when I tried to run this module in
>64-bit Linux(2.6.32-24-generic with NUMA enabled) with 12GB physical
>memory, it can calculates hashes for the first 63553 in-use pages but
>then reports a bug when the page frame number reaches 849513. This
>page frame should be in use since the count for the page instance is
>1. I do not know why sha_transform results in a page_fault(the data to
>be digested is the page which should be in memory). Would anyone give
>me some hints? Thanks.
>

Isn't this what KSM does? :) Check mm/ksm.c, it uses jhash2().


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

* Re: BUG: unable to handle kernel paging request at ffff8800cf669000
  2011-01-15 23:03 ` xing lin
  2011-01-16 22:44   ` xing lin
@ 2011-01-17  7:00   ` Américo Wang
  2011-01-17 19:11     ` xing lin
  1 sibling, 1 reply; 7+ messages in thread
From: Américo Wang @ 2011-01-17  7:00 UTC (permalink / raw)
  To: xing lin; +Cc: linux-kernel

On Sat, Jan 15, 2011 at 04:03:59PM -0700, xing lin wrote:
>It turns out I can not read that page in a kernel module at all. A
>simple read of that page will result in an oops as well. I have
>checked the flags of this page with others. They are almost the same.
>Any suggestions about why this happens or how to know whether a page
>can be read or not are really welcome. Thanks.
>

If you are using x86, you have CONFIG_X86_PTDUMP, with which
you can dump all page tables via debugfs.

Hope this helps.

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

* Re: BUG: unable to handle kernel paging request at ffff8800cf669000
  2011-01-17  6:57 ` Américo Wang
@ 2011-01-17 18:34   ` xing lin
  0 siblings, 0 replies; 7+ messages in thread
From: xing lin @ 2011-01-17 18:34 UTC (permalink / raw)
  To: Américo Wang; +Cc: linux-kernel

On Sun, Jan 16, 2011 at 11:57 PM, Américo Wang <xiyou.wangcong@gmail.com> wrote:
> Isn't this what KSM does? :) Check mm/ksm.c, it uses jhash2().

Oh, it seems mm/ksm.c does do content-based sharing. I have not known
this and am interested to see the percentage of duplicated pages. If
there are more than 10% duplicated pages, then I plan to implement
content-based page sharing. Your input is really helpful to me.
Thanks.

>From the configuration file, I found KSM is enabled in my Ubuntu but I
still found many duplicated pages when I compile Linux-2.6.37.
(Freeable pages means the number of pages which are duplicated and can
be freed. Freeable and nonzeroed pages means the number of pages which
can be freed and do not contain all 0s.) make12G_??.als shows the
number of duplicated pages when Linux-2.6.37 is being compiled.

 utos@node:/boot$ grep CONFIG_KSM /boot/config-2.6.32-24-generic
CONFIG_KSM=y

utos@node:/tmp/data$ grep Freeable make*
make12G_00.als:Freeable pages: 42037 (22.29% of allocated pages)
make12G_00.als:Freeable and nonzeroed pages: 1220  (0.65% of allocated pages)
make12G_01.als:Freeable pages: 42441 (19.38% of allocated pages)
make12G_01.als:Freeable and nonzeroed pages: 1409  (0.64% of allocated pages)
make12G_02.als:Freeable pages: 42831 (17.51% of allocated pages)
make12G_02.als:Freeable and nonzeroed pages: 1524  (0.62% of allocated pages)
make12G_03.als:Freeable pages: 43182 (16.27% of allocated pages)
make12G_03.als:Freeable and nonzeroed pages: 1876  (0.71% of allocated pages)
make12G_05.als:Freeable pages: 48564 (15.41% of allocated pages)
make12G_05.als:Freeable and nonzeroed pages: 7171  (2.27% of allocated pages)
make12G_06.als:Freeable pages: 50040 (14.83% of allocated pages)
make12G_06.als:Freeable and nonzeroed pages: 8629  (2.56% of allocated pages)
make12G_07.als:Freeable pages: 50649 (14.27% of allocated pages)
make12G_07.als:Freeable and nonzeroed pages: 9170  (2.58% of allocated pages)
make12G_08.als:Freeable pages: 53225 (13.54% of allocated pages)
make12G_08.als:Freeable and nonzeroed pages: 11655  (2.97% of allocated pages)
make12G_09.als:Freeable pages: 57595 (13.54% of allocated pages)
make12G_09.als:Freeable and nonzeroed pages: 15946  (3.75% of allocated pages)
make12G_10.als:Freeable pages: 58137 (12.99% of allocated pages)
make12G_10.als:Freeable and nonzeroed pages: 16419  (3.67% of allocated pages)
make12G_11.als:Freeable pages: 58561 (12.56% of allocated pages)
make12G_11.als:Freeable and nonzeroed pages: 16810  (3.61% of allocated pages)
make12G_12.als:Freeable pages: 59325 (12.14% of allocated pages)
make12G_12.als:Freeable and nonzeroed pages: 17556  (3.59% of allocated pages)
make12G_13.als:Freeable pages: 60144 (11.85% of allocated pages)
make12G_13.als:Freeable and nonzeroed pages: 18293  (3.61% of allocated pages)
make12G_14.als:Freeable pages: 60521 (11.40% of allocated pages)
make12G_14.als:Freeable and nonzeroed pages: 18661  (3.51% of allocated pages)
make12G_15.als:Freeable pages: 61205 (11.07% of allocated pages)
make12G_15.als:Freeable and nonzeroed pages: 19223  (3.48% of allocated pages)
make12G_16.als:Freeable pages: 61906 (10.86% of allocated pages)
make12G_16.als:Freeable and nonzeroed pages: 19961  (3.50% of allocated pages)
make12G_17.als:Freeable pages: 62701 (10.49% of allocated pages)
make12G_17.als:Freeable and nonzeroed pages: 20537  (3.44% of allocated pages)
make12G_18.als:Freeable pages: 63207 (10.21% of allocated pages)
make12G_18.als:Freeable and nonzeroed pages: 20978  (3.39% of allocated pages)
make12G_19.als:Freeable pages: 63689 (9.94% of allocated pages)
make12G_19.als:Freeable and nonzeroed pages: 21522  (3.36% of allocated pages)
make12G_20.als:Freeable pages: 65469 (9.91% of allocated pages)
make12G_20.als:Freeable and nonzeroed pages: 23098  (3.50% of allocated pages)
make12G_21.als:Freeable pages: 65979 (9.67% of allocated pages)
make12G_21.als:Freeable and nonzeroed pages: 23554  (3.45% of allocated pages)
make12G_22.als:Freeable pages: 66527 (9.40% of allocated pages)
make12G_22.als:Freeable and nonzeroed pages: 23997  (3.39% of allocated pages)
make12G_23.als:Freeable pages: 66887 (9.14% of allocated pages)
make12G_23.als:Freeable and nonzeroed pages: 24326  (3.33% of allocated pages)
make12G_24.als:Freeable pages: 67329 (8.85% of allocated pages)
make12G_24.als:Freeable and nonzeroed pages: 24678  (3.25% of allocated pages)
make12G_25.als:Freeable pages: 68351 (8.82% of allocated pages)
make12G_25.als:Freeable and nonzeroed pages: 25537  (3.30% of allocated pages)
make12G_26.als:Freeable pages: 68913 (8.57% of allocated pages)
make12G_26.als:Freeable and nonzeroed pages: 26067  (3.24% of allocated pages)
make12G_27.als:Freeable pages: 69400 (8.44% of allocated pages)
make12G_27.als:Freeable and nonzeroed pages: 26426  (3.21% of allocated pages)
make12G_28.als:Freeable pages: 70063 (8.25% of allocated pages)
make12G_28.als:Freeable and nonzeroed pages: 27007  (3.18% of allocated pages)
make12G_29.als:Freeable pages: 71409 (8.11% of allocated pages)
make12G_29.als:Freeable and nonzeroed pages: 28383  (3.22% of allocated pages)
make12G_30.als:Freeable pages: 72235 (8.01% of allocated pages)
make12G_30.als:Freeable and nonzeroed pages: 29074  (3.23% of allocated pages)
make12G_31.als:Freeable pages: 73271 (7.70% of allocated pages)
make12G_31.als:Freeable and nonzeroed pages: 29872  (3.14% of allocated pages)
make12G_32.als:Freeable pages: 73799 (7.54% of allocated pages)
make12G_32.als:Freeable and nonzeroed pages: 30314  (3.10% of allocated pages)
make12G_33.als:Freeable pages: 74712 (7.41% of allocated pages)
make12G_33.als:Freeable and nonzeroed pages: 31019  (3.08% of allocated pages)
make12G_34.als:Freeable pages: 75264 (7.27% of allocated pages)
make12G_34.als:Freeable and nonzeroed pages: 31459  (3.04% of allocated pages)
make12G_35.als:Freeable pages: 75883 (7.15% of allocated pages)
make12G_35.als:Freeable and nonzeroed pages: 31934  (3.01% of allocated pages)
make12G_36.als:Freeable pages: 76961 (7.07% of allocated pages)
make12G_36.als:Freeable and nonzeroed pages: 32928  (3.03% of allocated pages)
make12G_37.als:Freeable pages: 77797 (6.96% of allocated pages)
make12G_37.als:Freeable and nonzeroed pages: 33726  (3.02% of allocated pages)
make12G_38.als:Freeable pages: 78814 (6.85% of allocated pages)
make12G_38.als:Freeable and nonzeroed pages: 34557  (3.00% of allocated pages)
make12G_39.als:Freeable pages: 139392 (10.02% of allocated pages)
make12G_39.als:Freeable and nonzeroed pages: 91904  (6.60% of allocated pages)
make12G_40.als:Freeable pages: 145535 (9.78% of allocated pages)
make12G_40.als:Freeable and nonzeroed pages: 97907  (6.58% of allocated pages)
make12G_41.als:Freeable pages: 152047 (9.26% of allocated pages)
make12G_41.als:Freeable and nonzeroed pages: 104118  (6.34% of allocated pages)
make12G_42.als:Freeable pages: 157866 (8.90% of allocated pages)
make12G_42.als:Freeable and nonzeroed pages: 109994  (6.20% of allocated pages)


-- 
Regards,
Xing
School of Computing, University of Utah
http://www.cs.utah.edu/~xinglin/

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

* Re: BUG: unable to handle kernel paging request at ffff8800cf669000
  2011-01-17  7:00   ` Américo Wang
@ 2011-01-17 19:11     ` xing lin
  0 siblings, 0 replies; 7+ messages in thread
From: xing lin @ 2011-01-17 19:11 UTC (permalink / raw)
  To: Américo Wang; +Cc: linux-kernel

On Mon, Jan 17, 2011 at 12:00 AM, Américo Wang <xiyou.wangcong@gmail.com> wrote:
> If you are using x86, you have CONFIG_X86_PTDUMP, with which
> you can dump all page tables via debugfs.

It turns out CONFIG_X86_PTDUMP is not set. :-)
utos@node:/boot$ grep PTDUMP /boot/config-2.6.32-24-generic
# CONFIG_X86_PTDUMP is not set
utos@node:/boot$ uname -a
Linux node.memcached.checkpoint.emulab.net 2.6.32-24-generic
#38+emulab1 SMP Mon Aug 23 18:07:24 MDT 2010 x86_64 GNU/Linux

On the other hand, I do not understand why I need to look into page
tables. I think for the current 64-bit machines, all the physical
memory can be direct-mapped into the kernel logical space. In the AMD
64-bit machine, the kernel space ranges from [0xFFFF 8000 0000 0000,
0xFFFF FFFF FFFF FFFF] which is 128TB. In my Intel 64-bit machine, the
kernel is mapped at 0xFFFF 8800 0000 0000. I think the kernel space is
from [0xFFFF 8800 0000 0000, 0xFFFF FFFF FFFF FFFF] which is 119TB. So
I can use __pa() or __va() to get physical address or virtual address
directly. Right?


-- 
Regards,
Xing
School of Computing, University of Utah
http://www.cs.utah.edu/~xinglin/

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

end of thread, other threads:[~2011-01-17 19:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 23:30 BUG: unable to handle kernel paging request at ffff8800cf669000 xing lin
2011-01-15 23:03 ` xing lin
2011-01-16 22:44   ` xing lin
2011-01-17  7:00   ` Américo Wang
2011-01-17 19:11     ` xing lin
2011-01-17  6:57 ` Américo Wang
2011-01-17 18:34   ` xing lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).