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

[Xen-users] Re: general protection fault: 0000 [#1]

To: "Santos, Jose Renato G" <joserenato.santos@xxxxxx>
Subject: [Xen-users] Re: general protection fault: 0000 [#1]
From: "john bryant" <bryant.johan@xxxxxxxxx>
Date: Wed, 5 Mar 2008 19:51:40 -0500
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "xen-users@xxxxxxxxxxxxxxxxxxx" <xen-users@xxxxxxxxxxxxxxxxxxx>, "oprofile-list@xxxxxxxxxxxxxxxxxxxxx" <oprofile-list@xxxxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 05 Mar 2008 16:52:18 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=RgKV4Fa/41kMctD8BcfU7peT0nCa7X1+lczK5O7G8Kw=; b=pelfNH9hzx8EPqmB//9CCo+J2hZBEGQUPe7dOJy2D0DHlsiHynQl1VoHbnZjZjphBuKyVKNB9CFx2TnPlCcqsBQl1Kd3TowZTNHge1Y+oRPfgq7JAhfbbUXlFKjaE5+4LamnlsJjEZ53gCCfJPPeAw8aIGNwjZa8GfY/anIp4ks=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=i6AFhJQ5lIGJdQEMb4rIArIMsp8/BKmfubdvDh4LkdFnr06h4fcgByfhgzzzAGco4cZ2yYPmroIbyLJJc1veqNQ6dBg/k/AvrCX+bbtN6v2QOSlMU5eX9yzfLfLpcnEqQoecKftn47z7V9ymNC2OLLNtsNg7oW5i9tfR76Zg3X4=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C7B67062D31B9E459128006BAAD0DC3D0753E5CAB7@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <b743f6510803050813v19fc3703l4391457eda99717b@xxxxxxxxxxxxxx> <C7B67062D31B9E459128006BAAD0DC3D0753E5C76E@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <b743f6510803051104v645f3260g698f52ed54f3f332@xxxxxxxxxxxxxx> <C7B67062D31B9E459128006BAAD0DC3D0753E5CAB7@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Thanks again renato.

I have tried playing with xenoprof ( or oprofile). For certain kind of application, i needed to get accurate information on events; thus need information from various sources to validate my claims.
I see that rdmsr/wrmsr is virtualized in Xen Guest/Dom0 as they run in ring 1.  If i embed rdpmc- do i need to virtualize it also. My understanding is that rdpmc is enabled using X86_CR4_PCE bit to be accessed from any ring (0,1or 3). So, do i need to go through an emulation-path as explained in following conversation (in Xen forum):
http://lists.xensource.com/archives/html/xen-devel/2007-09/msg00092.html

Thanks

-John

On Wed, Mar 5, 2008 at 3:13 PM, Santos, Jose Renato G <joserenato.santos@xxxxxx> wrote:
Yep. Kernel modules are part of the kernel and should run in ring 0 for native Linux.
Renato


From: john bryant [mailto:bryant.johan@xxxxxxxxx]
Sent: Wednesday, March 05, 2008 11:04 AM
To: Santos, Jose Renato G
Cc: xen-users@xxxxxxxxxxxxxxxxxxx; xen-devel@xxxxxxxxxxxxxxxxxxx; oprofile-list@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: general protection fault: 0000 [#1]

Thanks Renato.
I have tried kernel module in normal linux, i still get "general protection" error. Question - Are all kernel modules run in CPL0. For this particular error, i have taken a traditional "hello world" module and inserted rdmsr call inside  the init program. So, does it execute in CPL0 (in normal linux) ?

Thanks again
-John

On Wed, Mar 5, 2008 at 1:12 PM, Santos, Jose Renato G <joserenato.santos@xxxxxx> wrote:
No. In Xen, kernel and modules for PV guests run in ring 1, Xen provide virtualization for some MSRs enabling access to them from ring 1, but this is not available for performance counter MSRs. For OProfile we have a Xen component (xenoprof) that acess the performance counters. Oprofile kernel module for Xen is modified to  use hypercalls in order to get the performance counters programmed instead of accessing MSRs directly. 
 
Regards
 
Renato  

From: oprofile-list-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:oprofile-list-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of john bryant
Sent: Wednesday, March 05, 2008 8:14 AM
To: xen-users@xxxxxxxxxxxxxxxxxxx; xen-devel@xxxxxxxxxxxxxxxxxxx; oprofile-list@xxxxxxxxxxxxxxxxxxxxx
Subject: general protection fault: 0000 [#1]

hi,

I have written a small kernel module to profile an event in xen. When i invoke "rdmsr", I get general protection error. As far as i understand, any kernel module is in CPL0, then rdmsr should work in kernel module. Any help ?  Below is log from syslog

-John

general protection fault: 0000 [#1]
SMP
Modules linked in: hello_printk autofs4 hidp l2cap bluetooth sunrpc ipv6 binfmt_misc dm_mirror dm_multipath dm_mod video thermal processor fan container button battery ac lp nvram tsdev evdev i2c_i801 i2c_core piix tg3 r8169 parport_pc parport serio_raw serial_core usbhid rtc ahci libata shpchp pci_hotplug ext3 jbd ehci_hcd ohci_hcd uhci_hcd usbcore
CPU:    0
EIP:    0061:[<ee07e023>]    Not tainted VLI
EFLAGS: 00010296   (2.6.16.33-xen #337)
EIP is at hello_init+0x23/0x8d [hello_printk]
eax: 00000000   ebx: 00000119   ecx: 00000119   edx: ff1bbfb4
esi: d9de86b0   edi: d9de8400   ebp: d9de86d8   esp: d9eafe1c
ds: 007b   es: 007b   ss: 0069
Process insmod (pid: 11521, threadinfo=d9eae000 task=c0713030)
Stack: <0>ee1df034 ca680746 0000b06e c0135f05 c013d301 ee1df400 d9de86b0 d9de8400
       c0137381 ee1df448 c03916c1 ee1df40c 00000000 00000008 00000003 00000000
       ee1df40c ee1df448 ee1df400 00000000 00000000 00000000 00000000 00000000
Call Trace:
 [<c0135f05>] __link_module+0x0/0x1f
 [<c013d301>] stop_machine_run+0x2e/0x34
 [<c0137381>] sys_init_module+0x13e/0x1afb
 [<c011e45a>] printk+0x0/0x1f
 [<c0162dc1>] do_sync_read+0xc3/0xff
 [<c0130e9e>] autoremove_wake_function+0x0/0x37
 [<c01540e7>] do_brk+0x21b/0x220
 [<c01c4ca4>] _atomic_dec_and_lock+0x40/0x5c
 [<c0179452>] dput+0xc3/0x12a
 [<c0163fe5>] __fput+0x137/0x18c
 [<c017d1e0>] mntput_no_expire+0x13/0x6c
 [<c0105289>] syscall_call+0x7/0xb
Code:  Bad EIP value.



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