WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-devel] Module Error

To: Artur Baruchi <mail.baruchi@xxxxxxxxx>
Subject: Re: [Xen-devel] Module Error
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Tue, 15 Nov 2011 09:27:40 -0500
Cc: Xen-devel@xxxxxxxxxxxxxxxxxxx, xen-users <Xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 15 Nov 2011 06:29:45 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CAAiDW_SQ+UnVK1Xvwk1S_24tf9BcC5BEH0WcMC104R32c1_4TQ@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <CAAiDW_SQ+UnVK1Xvwk1S_24tf9BcC5BEH0WcMC104R32c1_4TQ@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>