xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Artur Baruchi <mail.baruchi@gmail.com>
Cc: Xen-devel@lists.xensource.com, xen-users <Xen-users@lists.xensource.com>
Subject: Re: Module Error
Date: Tue, 15 Nov 2011 09:27:40 -0500	[thread overview]
Message-ID: <20111115142740.GA22675@phenom.dumpdata.com> (raw)
In-Reply-To: <CAAiDW_SQ+UnVK1Xvwk1S_24tf9BcC5BEH0WcMC104R32c1_4TQ@mail.gmail.com>

On Sun, Oct 30, 2011 at 07:16:11PM -0200, Artur Baruchi wrote:
> Hi.
> 
> Im writing a kernel module to extract some information from kernel,
> the module is working really fine in an AMD (AMD Athlon(tm) 64 X2 Dual
> Core Processor 3800+), but, when trying to run the module in a i7
> (Intel(R) Core(TM) i7 CPU 930 @ 2.80GHz) Im facing some strange errors
> (see below). The kernel versions are just the same on both machines
> (2.6.34.10-0.2-xen #1 SMP x86_64 x86_64 x86_64 GNU/Linux). The
> difference are the amount of memory AND processor vendor. I noted that
> the line of code that hangs my machine is this one:
> 
> if(end->host==NULL) {

That sounds like a lazy PTE setting issue. Meaning that the PTE write
hadn't been actually flushed, but not sure.

What happens if you run with 3.1 kernel? Do you get the same problem?

> 
> The end->host points to an Inode type (end is an address_space type).
> If I remove this line, the module works (but, obviously, do not return
> what I want). I tried the same code in a kernel without xen
> (2.6.34.10-0.2-desktop #1 SMP x86_64 x86_64 x86_64 GNU/Linux) and
> worked fine, so I suppose that this error is due to something in Xen
> running in a intel processor (I tried the module in an intel quad, and
> got the same error). Follow some outputs:
> 
> The error stack:
> Oct 28 23:40:35 goku kernel: [ 4472.129718] BUG: unable to handle
> kernel paging request at 000003d600000004
> Oct 28 23:40:35 goku kernel: [ 4472.129933] IP: [<ffffffffa08d118c>]
> get_files+0x6c/0x220 [pagecache]
> Oct 28 23:40:35 goku kernel: [ 4472.130098] PGD 0
> Oct 28 23:40:35 goku kernel: [ 4472.130250] Oops: 0000 [#4] SMP
> Oct 28 23:40:35 goku kernel: [ 4472.130452] last sysfs file:
> /sys/devices/system/cpu/cpu7/online
> Oct 28 23:40:35 goku kernel: [ 4472.130562] CPU 0
> Oct 28 23:40:35 goku kernel: [ 4472.130615] Modules linked in:
> pagecache ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager
> ocfs2_stackglue configfs drbd crc32c libcrc32c bridge stp llc nfsd
> lockd nfs_acl snd_pcm_oss auth_rpcgss snd_mixer_oss usbbk gntdev netbk
> blkbk blkback_pagemap blktap domctl xenbus_be snd_seq evtchn
> snd_seq_device sunrpc exportfs edd fuse loop snd_hda_codec_realtek
> firewire_ohci snd_hda_intel firewire_core snd_hda_codec crc_itu_t
> snd_hwdep snd_pcm snd_timer ohci1394 iTCO_wdt snd soundcore sr_mod
> xhci_hcd ieee1394 i2c_i801 iTCO_vendor_support pcspkr snd_page_alloc
> sg r8169 wmi serio_raw ext4 jbd2 crc16 linear uhci_hcd sd_mod nouveau
> ehci_hcd ttm drm_kms_helper usbcore drm agpgart i2c_algo_bit i2c_core
> button dm_snapshot dm_mod xenblk cdrom xennet fan processor ata_piix
> ahci pata_jmicron ata_generic libata scsi_mod thermal thermal_sys
> hwmon
> Oct 28 23:40:35 goku kernel: [ 4472.132037]
> Oct 28 23:40:35 goku kernel: [ 4472.132037] Pid: 4641, comm: cat
> Tainted: G      D    2.6.34.10-0.2-xen #1 X58A-UD3R/X58A-UD3R
> Oct 28 23:40:35 goku kernel: [ 4472.132037] RIP:
> e030:[<ffffffffa08d118c>]  [<ffffffffa08d118c>] get_files+0x6c/0x220
> [pagecache]
> Oct 28 23:40:35 goku kernel: [ 4472.132037] RSP: e02b:ffff8801ded93c88
>  EFLAGS: 00010246
> Oct 28 23:40:35 goku kernel: [ 4472.132037] RAX: 8000000004000400 RBX:
> ffff8801e8ea5bd0 RCX: 0000000000000001
> Oct 28 23:40:35 goku kernel: [ 4472.132037] RDX: ffff8801efc8c7e8 RSI:
> ffffffffa08d15c0 RDI: ffff8801e8ea4c28
> Oct 28 23:40:35 goku kernel: [ 4472.132037] RBP: 0000000000000001 R08:
> ffff8801eed81e00 R09: 0000000000000000
> Oct 28 23:40:35 goku kernel: [ 4472.132037] R10: ffff8801e8ea5c00 R11:
> 0000000000000000 R12: 00000000001e6000
> Oct 28 23:40:35 goku kernel: [ 4472.132037] R13: 0000000006a50000 R14:
> ffff8801e8ea5b88 R15: 000003d600000004
> Oct 28 23:40:35 goku kernel: [ 4472.132037] FS:
> 00007fcb81c3b700(0000) GS:ffff88000200b000(0000)
> knlGS:0000000000000000
> Oct 28 23:40:35 goku kernel: [ 4472.132037] CS:  e033 DS: 0000 ES:
> 0000 CR0: 0000000080050033
> Oct 28 23:40:35 goku kernel: [ 4472.132037] CR2: 000003d600000004 CR3:
> 00000001edecf000 CR4: 0000000000002660
> Oct 28 23:40:35 goku kernel: [ 4472.132037] DR0: 0000000000000000 DR1:
> 0000000000000000 DR2: 0000000000000000
> Oct 28 23:40:35 goku kernel: [ 4472.132037] DR3: 0000000000000000 DR6:
> 00000000ffff0ff0 DR7: 0000000000000400
> Oct 28 23:40:35 goku kernel: [ 4472.132037] Process cat (pid: 4641,
> threadinfo ffff8801ded92000, task ffff8801eedfa780)
> Oct 28 23:40:35 goku kernel: [ 4472.132037] Stack:
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  0000000101baa5b4
> 0000000200000002 0000000000000000 ffff8801f16ffae8
> Oct 28 23:40:35 goku kernel: [ 4472.132037] <0> 0000000000000000
> ffff8801ee7c6500 ffff8801efd32bc0 ffff8801e45de2d0
> Oct 28 23:40:35 goku kernel: [ 4472.132037] <0> ffff8801ee7c6500
> ffff8801f05d80f8 ffffffff801314f0 ffffffffa08d1349
> Oct 28 23:40:35 goku kernel: [ 4472.132037] Call Trace:
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffffa08d1349>]
> cache_open+0x9/0x20 [pagecache]
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffff8016c529>]
> proc_reg_open+0xb9/0x240
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffff8011060b>]
> __dentry_open+0xeb/0x340
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffff801206a8>]
> finish_open+0xe8/0x1c0
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffff80120f40>]
> do_filp_open+0x1a0/0x630
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffff8011214a>]
> do_sys_open+0x6a/0x140
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<ffffffff80007438>]
> system_call_fastpath+0x16/0x1b
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  [<00007fcb817a7130>] 0x7fcb817a7130
> Oct 28 23:40:35 goku kernel: [ 4472.132037] Code: 03 05 69 9d f9 df 4c
> 8b 78 18 4d 85 ff 0f 84 9c 00 00 00 41 f6 c7 01 0f 85 92 00 00 00 48
> 8b 00 a9 00 00 02 00 0f 85 84 00 00 00 <49> 8b 1f 48 85 db 0f 84 78 00
> 00 00 48 83 7b 40 00 74 71 4c 8b
> Oct 28 23:40:35 goku kernel: [ 4472.132037] RIP  [<ffffffffa08d118c>]
> get_files+0x6c/0x220 [pagecache]
> Oct 28 23:40:35 goku kernel: [ 4472.132037]  RSP <ffff8801ded93c88>
> Oct 28 23:40:35 goku kernel: [ 4472.132037] CR2: 000003d600000004
> Oct 28 23:40:35 goku kernel: [ 4472.143966] ---[ end trace a998217447e12d1d ]---
> 
> Peace of code (simplified):
> int init_module () {
> 
> 	unsigned long pfn;
> 	struct inode *ino;
> 	unsigned char * c;
> 	struct address_space *end;
> 	struct dentry *dentry;
> 	int fl;
> 
> 	struct filepage * temp;
> 	struct filepage *pos;
> 
> 	for (pfn = 0; pfn < num_physpages; pfn++) {
> 		struct page *page;
> 		if (!pfn_valid(pfn))
> 			continue;
> 		page = pfn_to_page(pfn);
> 				if((page->mapping!=NULL) && (!PageAnon(page)) && (!PageSwapCache(page))) {
> 						end = page->mapping;
> 						if(end->host==NULL) {  <- without this line, no hangs, but the
> module returns wrong data to me...
> 							printk(KERN_INFO "Cool... found an valid inode \n");
> 						}
> 				}				
> 					
> 	}
> return 0;
> }
> 
> Thanks in advance.
> 
> Att.
> Artur Baruchi
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

      parent reply	other threads:[~2011-11-15 14:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-30 21:16 Module Error Artur Baruchi
2011-11-14 12:00 ` Artur Baruchi
2011-11-15 14:27 ` Konrad Rzeszutek Wilk [this message]

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=20111115142740.GA22675@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=Xen-users@lists.xensource.com \
    --cc=mail.baruchi@gmail.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;
as well as URLs for NNTP newsgroup(s).