AW: AW: AW: AW: AW: Running Linux 3.14 as a Genode VM

Nico Weichbrodt nico at ...286...
Fri Feb 6 12:48:38 CET 2015


Hi,

I first applied your patches to my 3.14 kernel but I also tried your 3.18 kernel with the same result.
The system hangs as soon as a ping should be printed after systemd took over, everything seems fine before that.

I tried editing the run file, but we have our own which looks like the tz_vmm.run file but it lacks everything after build_boot_image, so no run_genode_until. If I add run_genode_until forever then during build I get:
Error: Can't execute automatically on target 'uboot'
This is our trustinit.run: http://pastebin.com/QF62kxzpa (with the added run_genode_until forever)
And this is our build.conf: http://pastebin.com/i1Xzm6M4

I will look further into this,
Cheers, Nico
________________________________________
Von: Martin Stein
Gesendet: Donnerstag, 5. Februar 2015 12:13
An: Genode OS Framework Mailing List
Betreff: Re: AW: AW: AW: AW: Running Linux 3.14 as a Genode VM

Hey Nico,

Cool that you're still on it and got so far already. I've applied your
"ping"-snippet to my branches. Then in 'os/run/tz_vmm.run' replaced
'run_genode_until STUFF' by 'run_genode_until forever' and outcommented
everything after that line. Now I'm getting a working prompt and proper
pings at both our imx53-qsb and our imx53-usb-armory.

Are you still targeting Linux 3.14? If your kernel uses the EPIT timer
it may interfere with Genodes userland timer-driver
(os/src/drivers/timer/hw/epit) that provides the 'Timer::Connection' to you.

You may instrument 'Kernel::Vm::exception(...)' in
'base-hw/src/core/include/kernel/vm.h' or even 'kernel()' in
'base-hw/src/core/kernel/kernel.cc' to see if the context switch really
might be problem. If the problem is caused by bad Linux-IO, my
IO-tracing/filter tool for Linux may help you debugging/solving it. The
initial commit is
https://github.com/m-stein/linux/commit/579c91d159905eb61aed9e8e36748069fbbf1722
and I enhanced it yesterday on the
https://github.com/m-stein/linux/tree/usb_armory_genode_esdhc branch.

Cheers,
Martin

On 04.02.2015 17:12, Nico Weichbrodt wrote:
> Hi,
>
> quick followup: The hang is caused by my Genode "ping" loop. This is my code:
> int main()
> {
>       PDBG("creating kernel stuff");
>       static Vm vm("linux_tzrun", "imx53-qsrb-genode.dtb", "initrd.gz", cmdline,
>                       Trustzone::NONSECURE_RAM_BASE, Trustzone::NONSECURE_RAM_SIZE,
>                       KERNEL_OFFSET, MACH_TYPE_QSB);
>       PDBG("creating vmm");
>       static Vmm::Vmm vmm(&vm);
>       PDBG("starting vmm");
>       vmm.start();
>       PDBG("creating swmanager");
>       static SWManager swm(&vmm);
>       PDBG("starting swmanager");
>       swm.run();
>
> //    sleep_forever();
>
>       Timer::Connection timer;
>       while(1)
>       {
>               PDBG("ping");
>               timer.msleep(5000);
>       }
>       return 0;
> }
>
> If I change the timer sleep value, then the kernel hangs when the next print should be happening.
> If I uncomment the sleep_forever() then Linux boots and I get a login prompt and I am able to ssh into the system.
> On our 2.6.x kernel the periodic ping is working. So there seems to be an issue with the worldswitch right?
> I will investigate this further tomorrow.
>
> Cheers, Nico
>
> ________________________________________
> Von: Nico Weichbrodt
> Gesendet: Mittwoch, 4. Februar 2015 15:18
> An: Genode OS Framework Mailing List
> Betreff: AW: AW: AW: AW: Running Linux 3.14 as a Genode VM
>
> Hi,
>
> I have a deadline in the near future so I put my kernel hacking on hold and started working on the software that would run inside the Linux VM and pretended Genode was available.
> I imported your other changes into my Linux and I now have a kinda booting kernel, many thanks for this.
> But I can't get to a login prompt. I have a Debian 8 root file system and systemd is initializing all kinds of stuff.
> I also have a SATA Harddrive on my board and systemd hangs here:
> [  OK  ] Started Remount Root and Kernel File Systems.
> [  OK  ] Started Apply Kernel Variables.
>          Starting Load/Save Random Seed...
> [  OK  ] Reached target Local File Systems (Pre).
>          Starting Copy rules generated while the root was ro...
>          Starting LSB: Tune IDE hard disks...
> [  OK  ] Started Load/Save Random Seed.
> [  OK  ] Started Copy rules generated while the root was ro.
> [  OK  ] Started LSB: Tune IDE hard disks.
> [  OK  ] Found device /dev/ttymxc0.
> [  OK  ] Found device SAMSUNG_HD103UJ 1.
>          Starting File System Check on /dev/sda1...
> [    6.584147] random: nonblocking pool is initialized
> [    6.648619] systemd-fsck[150]: /dev/sda1: clean, 125/61054976 files, 4207617/244190390 blocks
> [  OK  ] Started File System Check on /dev/sda1.
>
> The root file system is on the micro SD card and sda1 should be mounted to /mnt which is working fine with a standalone Linux. I have a period console output inside Genode which writes "ping" to the console every 250ms but this is not working after the hang. The last ping I see is during the call to my initrd which mounts the root file system and starts systemd through busybox.
>
> I will try if it boots without the harddrive.
>
> I know you use the usb armory and not the i.MX53 Quick Start Board so you don't have a SATA port but if you have any ideas, please let me know.
>
> Cheers, Nico
> ________________________________________
> Von: Martin Stein
> Gesendet: Dienstag, 3. Februar 2015 18:17
> An: Genode OS Framework Mailing List
> Betreff: Re: AW: AW: AW: Running Linux 3.14 as a Genode VM
>
> Hi Nico,
>
> How's your VM-project doing? We've updated to Linux 3.18.2 in the
> meantime. It reaches the prompt now and MMC access is working. I have
> created online branches
> https://github.com/m-stein/linux/tree/usb_armory_genode_tz_vmm and
> https://github.com/m-stein/genode/tree/usb_armory_tz_vmm that provide my
> current state. I'd be glad to hear from you.
>
> Cheers,
> Martin
>
> On 26.01.2015 12:27, Nico Weichbrodt wrote:
>> Hi,
>>
>> awesome! I know it's not a good idea to disable the timer but I thought disabling it might give me more information about what's happening.
>> The data-abort you get is the same I got after disabling the timer. It's Linux trying to access the GPIO. You can take a look what I did here: https://github.com/envy/linux/commit/1aade6f960aec6fa5a18e6b6effa82f8ff1533c6 to disable it. This is basically what Stefan Kalkowski did here: https://github.com/skalk/linux/commit/eccce1c595d7962c95086d6fa60291f7c2c1a497#diff-3
>>
>> I will try your fix tomorrow, I forgot to bring my development VM to uni today...
>>
>> Cheers, Nico
>> ________________________________________
>> Von: Martin Stein
>> Gesendet: Montag, 26. Januar 2015 12:14
>> An: Genode OS Framework Mailing List
>> Betreff: Re: AW: AW: Running Linux 3.14 as a Genode VM
>>
>> Hi Nico,
>>
>> Thank you for your detailed feedback about your progress :)
>>
>> Although it enabled you to go on, I don't think that it is a good idea
>> to disable the GPT timer in the long term. Thus I've digged a little
>> deeper into the "Calibrating delay loop" problem. What goes on after the
>> 'msr CPSR_c, rx' is that the kernel catches GPT timer IRQs all the time
>> and thus not getting any further. The IRQs aren't handled because the
>> driver for the interrupt controller (arch/arm/mach-imx/tzic.c) accepts
>> secure interrupts only in 'tzic_handle_irq' (see 'stat = ... &
>> __raw_readl(tzic_base + TZIC_INTSEC0(i))' ). Looking a little bit
>> around, I've found that the driver attempts to set all IRQs secure by
>> doing '__raw_writel(0xFFFFFFFF, tzic_base + TZIC_INTSEC0(i));' in
>> 'tzic_init_irq' which, of course, gets ignored when Linux runs as
>> nonsecure VM. So I've configured out the masking in 'tzic_handle_irq'
>> via a '#define GENODE_TZ_VMM' switch and after that, my Linux got further:
>>
>> Linux version 3.16.2-ga3bd210-dirty (lypo at ...207...) (gcc version 4.9.2
>> 20140904 (prerelease) (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro
>> GCC 4.9-2014.09) ) #1 PREEMPT Mon Jan 26 11:42:29 CET 2015
>> CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c5387d
>> CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
>> Machine model: Freescale i.MX53 Quick Start Board
>> bootconsole [earlycon0] enabled
>> Memory policy: Data cache writeback
>> On node 0 totalpages: 65536
>> free_area_init_node: node 0, pgdat 803c1be8, node_mem_map 8fdf8000
>>   Normal zone: 512 pages used for memmap
>>   Normal zone: 0 pages reserved
>>   Normal zone: 65536 pages, LIFO batch:15
>> CPU: All CPU(s) started in SVC mode.
>> pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
>> pcpu-alloc: [0] 0
>> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
>> Kernel command line: console=ttymxc0,115200 earlyprintk loglevel=10
>> PID hash table entries: 1024 (order: 0, 4096 bytes)
>> Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
>> Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
>> Memory: 255824K/262144K available (2662K kernel code, 121K rwdata, 904K
>> rodata, 120K init, 86K bss, 6320K reserved, 0K highmem)
>> Virtual kern> <40fiq
>> el memory layout:
>>     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>>     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
>>     vmalloc : 0x90800000 - 0xff000000   (1768 MB)
>>     lowmem  : 0x80000000 - 0x90000000   ( 256 MB)
>>     pkmap   : 0x7fe00000 - 0x80000000   (   2 MB)
>>     modules : 0x7f000000 - 0x7fe00000   (  14 MB)
>>       .text : 0x80008000 - 0x80383a94   (3567 kB)
>>       .init : 0x80384000 - 0x803a21bc   ( 121 kB)
>>       .data : 0x803a4000 - 0x803c2620   ( 122 kB)
>>        .bss : 0x803c262c - 0x803d8018   (  87 kB)
>> SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
>> Preemptible hierarchical RCU implementation.
>> NR_IRQS:0 nr_irqs:0 0
>> TrustZone Interrupt Controller (TZIC) initialized
>> CPU identified as i.MX53, silicon rev 2.1
>> Switching to timer-based delay loop
>> sched_clock: 32 bits at 33MHz, resolution 29ns, wraps every 128849015778ns
>> clocksource_of_init: no matching clocksources found
>> Console: colour dummy device 80x30
>> Calibrating delay loop (skipped), value calculated using timer
>> frequency.. 66.66 BogoMIPS (lpj=333333)
>> pid_max: default: 32768 minimum: 301
>> Mount-cache hash table entri> <40fiq
>> es: 1024 (order: 0, 4096 bytes)
>> Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
>> CPU: Testing write buffer coherency: ok
>> Setting up static identity map for 0x8028a820 - 0x8028a878
>> VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 2
>> pinctrl core: initialized pinctrl subsystem
>> NET: Registered protocol family 16
>> DMA: preallocated 256 KiB pool for atomic coherent allocations
>>> dab f5784008
>> def
>> [init -> tz_vmm] Cpu state:
>> [init -> tz_vmm]   Register     Virt     Phys
>> [init -> tz_vmm] ---------------------------------
>> [init -> tz_vmm]   r0         = f5784008 [53f84008]
>> [init -> tz_vmm]   r1         = 8f896c10 [8f896c10]
>> [init -> tz_vmm]   r2         = 00000001 [00000000]
>> [init -> tz_vmm]   r3         = 8018d4e0 [8018d4e0]
>> [init -> tz_vmm]   r4         = 8f838e68 [8f838e68]
>> [init -> tz_vmm]   r5         = 00000000 [00000000]
>> [init -> tz_vmm]   r6         = 00000000 [00000000]
>> [init -> tz_vmm]   r7         = f5784004 [53f84004]
>> [init -> tz_vmm]   r8         = 8f898340 [8f898340]
>> [init -> tz_vmm]   r9         = 8fdedfcc [8fdedfcc]
>> [init -> tz_vmm]   r10        = 8f838e68 [8f838e68]
>> [init -> tz_vmm]   r11        = 00000000 [00000000]
>> [init -> tz_vmm]   r12        = f5784000 [53f84000]
>> [init -> tz_vmm]   sp         = 00000000 [00000000]
>> [init -> tz_vmm]   lr         = 00000000 [00000000]
>> [init -> tz_vmm]   ip         = 8018d4e0 [8018d4e0]
>> [init -> tz_vmm]   cpsr       = 20000013
>> [init -> tz_vmm]   sp_und     = 803c27d8 [803c27d8]
>> [init -> tz_vmm]   lr_und     = 803c27d8 [803c27d8]
>> [init -> tz_vmm]   spsr_und   = 00000000 [00000000]
>> [init -> tz_vmm]   sp_svc     = 8f853cd0 [8f853cd0]
>> [init -> tz_vmm]   lr_svc     = 8018dbbc [8018dbbc]
>> [init -> tz_vmm]   spsr_svc   = 20000013 [00000000]
>> [init -> tz_vmm]   sp_abt     = 803c27cc [803c27cc]
>> [init -> tz_vmm]   lr_abt     = 803c27cc [803c27cc]
>> [init -> tz_vmm]   spsr_abt   = 00000000 [00000000]
>> [init -> tz_vmm]   sp_irq     = 803c27c0 [803c27c0]
>> [init -> tz_vmm]   lr_irq     = 80010f80 [80010f80]
>> [init -> tz_vmm]   spsr_irq   = 20000093 [00000000]
>> [init -> tz_vmm]   sp_fiq     = 00000000 [00000000]
>> [init -> tz_vmm]   lr_fiq     = 00000000 [00000000]
>> [init -> tz_vmm]   spsr_fiq   = 00000000 [00000000]
>> [init -> tz_vmm]   ttbr0      = 80004019
>> [init -> tz_vmm]   ttbr1      = 80004019
>> [init -> tz_vmm]   ttbrc      = 00000000
>> [init -> tz_vmm]   dfar       = f5784008 [53f84008]
>> [init -> tz_vmm]   exception  = data_abort
>> [init -> tz_vmm] Could not handle data-abort will exit!
>>
>>
>> To be on the safe side, I've also applied the switch to
>> 'tzic_set_irq_fiq' to prevent Linux from thinking it were able to use FIQs:
>>
>> if (GENODE_TZ_VMM) {
>>     printk(KERN_NOTICE, "Warning: Can't use FIQ in nonsecure world"
>>     return -EINVAL;
>> }
>>
>> Cheers,
>> Martin
>>
>>



------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
genode-main mailing list
genode-main at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main



More information about the users mailing list