UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor xrataj00
Visitor
8,341 Views
Registered: ‎07-13-2014

Linux-FreeRTOS AMP demo v2014.2

Hi,

 

I am trying to port AMP demo from UG978 to petalinux version 2014.2 and I am experiencing some problems. Obviously there are some problems with interrupts but even without interrupt from timer, Freertos app should at least write some logs to the trace buffer but nothing is there. Here is a log:

 

root@zynq:~# modprobe zynq_remoteproc
CPU1: shutdown

=================================
[ INFO: inconsistent lock state ]
3.14.2-xilinx #3 Not tainted
---------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
modprobe/804 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (irq_controller_lock){?.-...}, at: [<80219b14>] gic_set_affinity+0x60/0xac
{IN-HARDIRQ-W} state was registered at:
  [<8005f550>] __lock_acquire+0x75c/0x199c
  [<80060e8c>] lock_acquire+0x68/0x7c
  [<80495648>] _raw_spin_lock_irqsave+0x50/0x64
  [<8021a114>] gic_raise_softirq+0x14/0x80
  [<80014560>] smp_send_reschedule+0x30/0x3c
  [<8004d698>] try_to_wake_up+0x228/0x28c
  [<8005a8e0>] autoremove_wake_function+0xc/0x34
  [<8005a310>] __wake_up_common+0x4c/0x78
  [<8005a530>] __wake_up+0x34/0x48
  [<8008fd08>] __irq_work_run+0x90/0xc8
  [<800144ec>] handle_IPI+0x68/0xac
  [<8000854c>] gic_handle_irq+0x58/0x60
  [<80012444>] __irq_svc+0x44/0x78
  [<804957f0>] _raw_spin_unlock_irqrestore+0x40/0x74
  [<80072574>] rcu_process_callbacks+0x190/0x548
  [<80026c6c>] __do_softirq+0x120/0x278
  [<800270b0>] irq_exit+0x84/0xf4
  [<8000efa8>] handle_IRQ+0x6c/0x90
  [<80008530>] gic_handle_irq+0x3c/0x60
  [<80012444>] __irq_svc+0x44/0x78
  [<800e8ee8>] __d_lookup_rcu+0x138/0x288
  [<800dc844>] lookup_fast+0x40/0x2ec
  [<800dd3b0>] link_path_walk+0x200/0x774
[<800de298>] path_lookupat+0x54/0x6ec
  [<800de950>] filename_lookup.isra.49+0x20/0x5c
  [<800e0e60>] user_path_at_empty+0x54/0x78
  [<800e0e94>] user_path_at+0x10/0x18
  [<800fc77c>] do_utimes+0xcc/0x128
  [<8067b194>] do_utime+0x30/0x38
  [<8067b25c>] do_copy+0x38/0xc4
  [<8067b038>] write_buffer+0x28/0x44
  [<8067b088>] flush_buffer+0x34/0x9c
  [<8068ca5c>] gunzip+0x258/0x31c
  [<8067b43c>] unpack_to_rootfs+0x154/0x284
  [<8067b9a4>] populate_rootfs+0x18/0x224
  [<800088b8>] do_one_initcall+0xb8/0x160
  [<80679c18>] kernel_init_freeable+0x10c/0x1d0
  [<8048b47c>] kernel_init+0x8/0xe4
  [<8000e728>] ret_from_fork+0x14/0x2c
irq event stamp: 10529
hardirqs last  enabled at (10529): [<80495848>] _raw_spin_unlock_irq+0x24/0x5c
hardirqs last disabled at (10528): [<80495674>] _raw_spin_lock_irq+0x18/0x60
softirqs last  enabled at (10218): [<80026d3c>] __do_softirq+0x1f0/0x278
softirqs last disabled at (10199): [<800270b0>] irq_exit+0x84/0xf4

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0   
       ----   
  lock(irq_controller_lock);
  <Interrupt>
    lock(irq_controller_lock);

 *** DEADLOCK ***
2 locks held by modprobe/804:
 #0:  (&__lockdep_no_validate__){......}, at: [<80271388>] __driver_attach+0x34/0x94
 #1:  (&__lockdep_no_validate__){......}, at: [<802713ac>] __driver_attach+0x58/0x94

stack backtrace:
CPU: 0 PID: 804 Comm: modprobe Not tainted 3.14.2-xilinx #3
[<80015658>] (unwind_backtrace) from [<800119b4>] (show_stack+0x10/0x14)
[<800119b4>] (show_stack) from [<8048fe1c>] (dump_stack+0x8c/0xd0)
[<8048fe1c>] (dump_stack) from [<8048e540>] (print_usage_bug+0x25c/0x2d0)
[<8048e540>] (print_usage_bug) from [<8005e518>] (mark_lock+0x3d0/0x6b8)
[<8005e518>] (mark_lock) from [<8005f5bc>] (__lock_acquire+0x7c8/0x199c)
[<8005f5bc>] (__lock_acquire) from [<80060e8c>] (lock_acquire+0x68/0x7c)
[<80060e8c>] (lock_acquire) from [<80495500>] (_raw_spin_lock+0x40/0x50)
[<80495500>] (_raw_spin_lock) from [<80219b14>] (gic_set_affinity+0x60/0xac)
[<80219b14>] (gic_set_affinity) from [<80219b9c>] (gic_set_cpu+0x3c/0x44)
[<80219b9c>] (gic_set_cpu) from [<7f093464>] (zynq_remoteproc_probe+0x1c0/0x3dc [zynq_remoteproc])
[<7f093464>] (zynq_remoteproc_probe [zynq_remoteproc]) from [<802728b4>] (platform_drv_probe+0x18/0x48)
[<802728b4>] (platform_drv_probe) from [<802710f8>] (driver_probe_device+0x11c/0x334)
[<802710f8>] (driver_probe_device) from [<802713c4>] (__driver_attach+0x70/0x94)
[<802713c4>] (__driver_attach) from [<8026f6b4>] (bus_for_each_dev+0x70/0x84)
[<8026f6b4>] (bus_for_each_dev) from [<8027079c>] (bus_add_driver+0xfc/0x1f4)
[<8027079c>] (bus_add_driver) from [<802719dc>] (driver_register+0x9c/0xe0)
[<802719dc>] (driver_register) from [<800088b8>] (do_one_initcall+0xb8/0x160)
[<800088b8>] (do_one_initcall) from [<80085ec4>] (load_module+0x1744/0x1d48)
[<80085ec4>] (load_module) from [<800865c4>] (SyS_init_module+0xfc/0x10c)
[<800865c4>] (SyS_init_module) from [<8000e660>] (ret_fast_syscall+0x0/0x48)
 remoteproc0: 0.remoteproc-test is available
 remoteproc0: Note: remoteproc is still under development and considered experimental.
 remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
 remoteproc0: registered virtio0 (type 7)

root@zynq:~# modprobe rpmsg_freertos_statistic
 remoteproc0: powering up 0.remoteproc-test
 remoteproc0: Booting fw image freertos, size 2130820
 remoteproc0: remote processor 0.remoteproc-test is now up
virtio_rpmsg_bus virtio0: rpmsg host is online

--kernel hangs here for approximately a minute

 

It was working perfectly on 2013.10. Am I missing something? 

 

Thanks in advance for any ideas.

 

Tomas

0 Kudos
10 Replies
Visitor morandg
Visitor
7,890 Views
Registered: ‎11-25-2014

Re: Linux-FreeRTOS AMP demo v2014.2

Hello,

 

We have exactly the same issue with the same release but using the freertos example. Did anyone find anything?

 

Guy

0 Kudos
Xilinx Employee
Xilinx Employee
7,886 Views
Registered: ‎09-10-2008

Re: Linux-FreeRTOS AMP demo v2014.2

Hi,

I've done some work in other areas similar to this and the issue that I found was that the newer kernel uses more IPI interrupts such that the ones uses by FreeRTOS (or baremetal in my case) were overlapping with the ones the kernel used.

I moved the IPI for the remote application from 6 to 8 and that solved the issue. You can see the interrupts used by Linux in /proc/interrupts.

Thanks
John
0 Kudos
Visitor morandg
Visitor
7,809 Views
Registered: ‎11-25-2014

Re: Linux-FreeRTOS AMP demo v2014.2

We fixed the issue by skipping the global timer initialization in freertos (xtime_l.c) ...

0 Kudos
Visitor mahirztrk
Visitor
7,798 Views
Registered: ‎11-19-2009

Re: Linux-FreeRTOS AMP demo v2014.2

Hi morandg,

 

Could you give more detail on how you fixed the issue. There are only 2 functons (XTime_SetTime, XTime_GetTime) in xtime_l.c, I didn't see anything about initialization of global timer. 

 

Thanks, 

0 Kudos
Visitor readerfeifei
Visitor
7,561 Views
Registered: ‎01-24-2014

Re: Linux-FreeRTOS AMP demo v2014.2

Hi

   You need Modify xil-crt0.S in the bsp like this :

    

.Lenclbss:

/* set stack pointer */
ldr r13,.Lstack /* stack address */

/* Reset and start Global Timer */
mov r0, #0x0
mov r1, #0x0
/*bl XTime_SetTime*/

 

comment out the “bl XTime_SetTime” or it will reset the scu_timer and crash the linux 

 

I am doing the experiment too , and I have not installed the 2013.3 so could you please share the freertos demo project to me ?

0 Kudos
Observer madison_a
Observer
7,256 Views
Registered: ‎06-13-2014

Re: Linux-FreeRTOS AMP demo v2014.2

Thanks for the tip.

 

Changing the ipi assignment in the device tree entry from 6 to 8 fixes the problem with remoteproc. Can't believe that Xilinx couldn't either update UG978, or at least put a pointer on or about the link for UG978 to an updated device tree example.

 

Various expletives or other politically incorrect phrases are exercises for the reader, but consider them inserted here.

 

 

/dts-v1/;

/include/ "system-conf.dtsi"

/ {

test: remoteproc-test@0 {

compatible = "xlnx,zynq_remoteproc";

reg = < 0x0 0x10000000 >;

interrupt-parent = <&intc>;

interrupts = < 0 37 4 0 38 4 >;

firmware = "freertos";

ipino = <8>;

vring0 = <2>;

vring1 = <3>;

};

};

 

 

0 Kudos
Observer madison_a
Observer
7,255 Views
Registered: ‎06-13-2014

Re: Linux-FreeRTOS AMP demo v2014.2

contents of system-top.dts inserted to aid others searching for solutons to the problem.
0 Kudos
Observer madison_a
Observer
6,917 Views
Registered: ‎06-13-2014

Re: Linux-FreeRTOS AMP demo v2014.2

Oh, and the canned AMP Demo FreeRTOS has a bug in the port.c code in the FreeRTOS bsp.

 

The address of the application level interrupt handler registration function is saved, but never called.  I put a call to the "handler" callback function just before vPortISRStartFirstTask() in xPortStartScheduler().  Prolly would have found this bug faster if I knew how to configure symbollic debugging, but I get to learn how to do that tomorrow. Figures...

0 Kudos
Observer madison_a
Observer
6,893 Views
Registered: ‎06-13-2014

Re: Linux-FreeRTOS AMP demo v2014.2

And to be able to access the circular trace buffer as described by ug978, you need to turn on the debugfs. Which is NOT under filesystems. Gee, what a surprise.

 

Its under Kernel hacking --> Compile-time checks and compiler options. Click on Debug Filesystem.

 

Thanks for the documentation update Xilinx.

0 Kudos
Visitor joshkern
Visitor
884 Views
Registered: ‎08-05-2015

Re: Linux-FreeRTOS AMP demo v2014.2

I'm having the exact same issue using Petalinux 2014.2 with Zedboard BSP. I've tried the different solutions in this thread but none of them have solved the issue for me yet. I should also mention I am working with OpenAMP, so the firmware I am working with is different, although the zynq_remoteproc driver should be the same. I'm not sure if my issue is due to a difference between 2013.10 and 2014.2 or if it's a difference between ZC702 and Zedboard. As a test, I also tried using the Zedboard BSP in 2013.10, and that worked for me, so I think the problem is with the former. But then, I would have expected changing the ipino from 6 to 8 to solve the problem....

 

Josh

0 Kudos