Ganis Zulfa Santoso
2015-Jul-07 01:52 UTC
I can read/write in virtio BLK Device, but I can't run a hello world program in it
Hi Linux Virtualization Mailing List Members, I am trying to develop a driver for virtio blk device in guest. I can safely mount the virtual blk device with: mount /dev/vda /mnt/ in /mnt/ I can read & write the device. But when I run a simple hello world program in /mnt/root/, this error happens: root at linux_guest:/mnt/root# ./helloworld_static [ 23.003459] CPU: 0 PID: 491 Comm: helloworld_stat Not tainted 3.19.1+ #101 [ 23.007030] Hardware name: ARM-Versatile Express [ 23.010102] task: 970f2400 ti: 9184e000 task.ti: 9184e000 [ 23.011645] PC is at 0x11d6a [ 23.012801] LR is at 0x89b3 [ 23.013627] pc : [<00011d6a>] lr : [<000089b3>] psr: 80000030 [ 23.013627] sp : 7e932c10 ip : 00008e45 fp : 00000000 [ 23.017108] r10: 00000000 r9 : 00000000 r8 : 00000000 [ 23.023165] r7 : 00000000 r6 : 00053794 r5 : 7e932dd4 r4 : 0006a9b4 [ 23.026854] r3 : 0000022c r2 : 00000000 r1 : ffffffd0 r0 : 00000021 [ 23.031814] Flags: Nzcv IRQs on FIQs on Mode USER_32 ISA Thumb Segment user [ 23.036225] Control: 10c5387d Table: 916f4059 DAC: 00000015 [ 23.040885] CPU: 0 PID: 491 Comm: helloworld_stat Not tainted 3.19.1+ #101 [ 23.043224] Hardware name: ARM-Versatile Express [ 23.045168] [<80012c68>] (unwind_backtrace) from [<80010dc8>] (show_stack+0x10/0x14) [ 23.050392] [<80010dc8>] (show_stack) from [<8030c9d0>] (__do_user_fault.isra.10+0x98/0xa8) [ 23.052687] [<8030c9d0>] (__do_user_fault.isra.10) from [<80017c6c>] (do_page_fault+0x35c/0x3b8) [ 23.055358] [<80017c6c>] (do_page_fault) from [<80008488>] (do_DataAbort+0x34/0x98) [ 23.057510] [<80008488>] (do_DataAbort) from [<80011a5c>] (__dabt_usr+0x3c/0x40) [ 23.065243] Exception stack(0x9184ffb0 to 0x9184fff8) [ 23.069425] ffa0: 00000021 ffffffd0 00000000 0000022c [ 23.073779] ffc0: 0006a9b4 7e932dd4 00053794 00000000 00000000 00000000 00000000 00000000 [ 23.079985] ffe0: 00008e45 7e932c10 000089b3 00011d6a 80000030 ffffffff Can you tell me what I could probably miss? Thank you very much, I forever in debt for your time and effort to read this. I am writing the BLK Device based on Lguest's code. some information that may help: root at linux_guest:/mnt/root# file helloworld_static helloworld_static: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.31, BuildID[sha1]=0xc63622efd65f635f2b93c05caa8a1302d60a8caa, not stripped root at linux_guest:/mnt/root# uname -a Linux linux_guest 3.19.1+ #101 Tue Jul 7 09:35:23 KST 2015 armv7l GNU/Linux root at linux_guest:/mnt/root# ls -l helloworld_static -rwxr-xr-x 1 root root 456218 Jul 7 2015 helloworld_static during booting: [ 0.202185] brd: module loaded [ 0.262288] loop: module loaded [ 0.304868] vda: unknown partition table AtLFprofile: no performance counters [ 0.399451] oprofile: using timer interrupt. CP: cubic registered [ 0.403361] NET: Registered protocol family 17 [ 0.405039] Registering SWP/SWPB emulation handler [ 0.409375] RAMDISK: gzip image found at block 0 [ 0.572643] EXT2-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended [ 0.620201] VFS: Mounted root (ext2 filesystem) on device 1:0. [ 0.622113] devtmpfs: mounted [ 0.623328] Freeing unused kernel memory: 172K (80417000 - 80442000) Starting logging: OK Initializing random number generator... [ 0.691483] random: dd urandom read with 0 bits of entropy available done. Starting network... Starting dropbear sshd: OK linux_guest login: -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20150707/01d9061e/attachment.html>
Thomas Huth
2015-Jul-07 06:55 UTC
I can read/write in virtio BLK Device, but I can't run a hello world program in it
On Tue, 7 Jul 2015 10:52:01 +0900 Ganis Zulfa Santoso <ganis.zulfa at gmail.com> wrote:> Hi Linux Virtualization Mailing List Members, > > I am trying to develop a driver for virtio blk device in guest.Why don't you simply use the driver that is already available in the kernel?> I can safely mount the virtual blk device with: mount /dev/vda /mnt/ > in /mnt/ I can read & write the device. But when I run a simple hello world program in /mnt/root/, this error happens:Have you already verified that you can successfully read the _right_ data from your block device? I.e. something like mount /dev/xxx /mnt cp helloworld_static /mnt/root/helloworld_static umount /mnt # just to make sure that it is not cached mount /dev/xxx /mnt md5sum helloworld_static md5sum /mnt/root/helloworld_static ... and then compare the two md5sums whether they are the same? Thomas
Ganis Zulfa Santoso
2015-Jul-07 07:33 UTC
I can read/write in virtio BLK Device, but I can't run a hello world program in it
> Thomas Huth <huth at tuxfamily.org> wrote: > > Why don't you simply use the driver that is already available in the > kernel?I am using a custom hypervisor, the available driver is not suitable for it.> > Have you already verified that you can successfully read the _right_ > data from your block device? I.e. something like > > mount /dev/xxx /mnt > cp helloworld_static /mnt/root/helloworld_static > umount /mnt # just to make sure that it is not cached > mount /dev/xxx /mnt > md5sum helloworld_static > md5sum /mnt/root/helloworld_static > > ... and then compare the two md5sums whether they are the same?They are different. Thank you so much. I am truly thankful.> > Thomas