All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai-help] SH4 port
@ 2006-10-03 13:21 Kiichi Kameda
  2006-10-02 13:30 ` Jan Kiszka
  0 siblings, 1 reply; 9+ messages in thread
From: Kiichi Kameda @ 2006-10-03 13:21 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 3743 bytes --]


Thank you for your effort.

> Jan Kiszka wrote:
> > Kiichi Kameda wrote:
> >> ...
> >> After tough investigation, I think I found some clues such as:
> >> While in.ftpd runs hard, a "write" system call was issued and Linux
> >> kernel was processing its request.
> >>  But weird __ipipe_dispatch_event and __ipipe_sync_stage was recorded.
> >>
> >> I think the problem originates from a Xenomai context switch(which
> >> overwrites "current"), while Linux is processing  system call.
> >
> > If I interpret linux/include/asm-sh/current.h correctly, current is
> > derived from the stack on your platform (like on most archs) and cannot
>
> That's nonsense as I realised later by following the code down to
> include/asm-sh/thread_info.h: current_thread_info seems to get
> referenced by some register.

In original SH-Linux ,"current" is based on r7_bank register in SH CPU
 which is set only at context switch.  "current" macro which is
referenced everywhere(including page fault handling and stack pointer
setting
at interrupt from userspace), depends on this special register.
r7_bank register has nothing to do with stack.

So, I created modified version of  SH-Linux code , where "current" macro
uses
the stack pointer(SP & ~(THREAD_SIZE) -1).
After that, although Linux seems to work well, the Xenomai thread still
causes system panic, if I once run the Xenomai program that uses POSIX skin.

The panic messsage:
==========================================
Unable to handle kernel paging request. at virtual address 00100104
pc = 8c010658 <--requeue_task
*pde = 00000000
Oops: 0001 [#1]

Pid : 948, Comm:              in.ftpd
PC  : 8c010658 SP  : 8debfab0 SR  : 40008101 .TEA : c0198044    .Not
tainted
R0  : 8c19e958 R1  : 8c19ed10 R2  : 00100100 R3  : 00200200
R4  : 8c2769a0 R5  : 8c19e958 R6  : 00000050 R7  : 8c2769c0
R8  : 8c2769a0 R9  : 00000000 R10 : 00000050 R11 : 8c2769a0
R12 : 8c2769e0 R13 : 8c19e928 R14 : 8debfab0
MACH: 0000027e MACL: b851edb4 GBR : 29568be0 PR  : 8c0112b6.
Call trace:
== top
[<8c0112b6>] scheduler_tick
[<8c0d4d88>] smc_hard_start_xmit
[<8c00eb38>] __do_page_fault
[<8c01f828>] update_process_time
[<8c009988>] handle_timer_tick
[<8c00bd72>] tmu_timer_interrupt
[<8c03303a>] handle_IRQ_event
[<8c0330fa>] __do_IRQ
[<8c00d0f6>] __ipipe_do_IRQ
[<8c0342e4>] __ipipe_sync_stage
[<8c00d146>] __ipipe_grab_timer
[<8c010582>] dequeue_task
[<8c010876>] deactivate_task
[<8c1505d6>] schedule
[<8c15134c>] io_schedule
[<8c036406>] sync_page
[<8c151736>] __wait_on_bit_lock
[<8c036d90>] __lock_page
[<8c038050>] file_map_nopage
[<8c0444aa>] __handle_mm_fault
[<8c00e7f0>] do_page_fault
[<8c0af240>] csum_partial_copy_generic
[<8c125b64>] tcp_sendmsg
[<8c141c14>] inet_sendmsg
[<8c0f97f6>] do_sock_write
[<8c0f98ec>] sock_aio_write
[<8c01f74c>] run_timer_softirq
[<8c04e6ba>] do_sync_write
[<8c0343f6>] __ipipe_dispatch_event
[<8c04e78a>] vfs_write
[<8c04e8f4>] sys_write
[<8c0062c4>] syscall_call
== bottom
Kernel panic - not syncing: Aiee, killing interrupt handler!..
==========================================

Is it right that, while in.ftpd tries to send TCP packet,
scheduler_tick is called and requeue_task the "current" task?

Or, is threre any lack of code at returning to Linux.

>
> Still the question remains for me why this should be a general Xenomai
> problem. Xenomai may overwrite the content on switch_to (but I don't
> know your patch, how you realised context switches between RT tasks on
> SH4), but then it should definitely also restore it again on returning
> to Linux.
>
> Jan
>

Attached is some SH-related code.

xenomai-2.2.0/ksrc/arch/sh/*
xenomai-2.2.0/include/asm-sh/*
linux-2.6.17.7/arch/sh/kernel/*
linux-2.6.17.7/arch/sh/mm/*
linux-2.6.17.7/include/asm-sh/*

Thanks,
Kiichi Kameda

[-- Attachment #2: linux-sh.tar.gz --]
[-- Type: application/x-gzip, Size: 321734 bytes --]

[-- Attachment #3: xenomai-sh.tar.gz --]
[-- Type: application/x-gzip, Size: 17928 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [Xenomai-help] SH4 port
@ 2006-09-30 13:10 Kiichi Kameda
  2006-09-29 13:20 ` Jan Kiszka
  0 siblings, 1 reply; 9+ messages in thread
From: Kiichi Kameda @ 2006-09-30 13:10 UTC (permalink / raw)
  To: xenomai


After long break, I started testing SH4 port of Xenomai based on Xenomai
2.2.0

My realtime test program is a user space program using POSIX skin , and
runs periodically (1ms interval)

It works well when the load is light.
But with very heavy load such as continuous FTP, the system hangs in several
minutes,
due to panic.

the stack trace shows as follows

======================================================
Unable to handle kernel NULL pointer dereference. at virtual address
00000000
pc = 8c0104a6 <-- dequeue_task
*pde = 00000000
Oops: 0000 [#1]

Pid : 944, Comm:              in.ftpd
PC  : 8c0104a6 SP  : 8d631c00 SR  : 40008101 .TEA : c0198044    .Not
tainted
R0  : 8c19a928 R1  : 8c0104a0 R2  : 00000000 R3  : 8d5db680
R4  : 8d5db680 R5  : 00000000 R6  : 00000000 R7  : 8d5db788
R8  : 8d5db680 R9  : fffffffb R10 : 8d631c9c R11 : 8d5db680
R12 : e9bbfd00 R13 : 000f422e R14 : 8d631c08
MACH: 0000027f MACL: 5c28f7f2 GBR : 29568be0 PR  : 8c0107b6.
Call trace:
===top of stack(8d631c00)
[<8c0107b6>] deactivate_task
[<8c14d616>] schedule
[<8c14e38c>] io_schedule
[<8c035106>] sync_page
[<8c14e776>] __wait_on_bit_lock
[<8c035a64>] __lock_page
[<8c036d10>] filemap_nopage
[<8c04306a>] __handle_mm_fault
[<8c0d98ee>] ide_set_handler
[<8c00e750>] do_page_fault
[<8c0ac7dc>] csum_partial_copy_generic
[<8c122d04>] tcp_sendmsg
[<8c0d79f2>] ide_do_request
[<8c13ed74>] inet_sendmsg
[<8c0f69f6>] do_sock_write
[<8c04cc00>] wait_on_retry_sync_kiocb
[<8c0f6aec>] sock_aio_write
[<8c04cf1a>] do_sync_write
[<8c033024>] __ipipe_sync_stage
[<8c02a320>] autoremove_wake_function
[<8c033136>] __ipipe_dispatch_event
[<8c04cfea>] vfs_write
[<8c04d134>] sys_write
[<8c0062bc>] syscall_call
[<8c04d100>] sys_write
===bottom of stack
======================================================

After tough investigation, I think I found some clues such as:
While in.ftpd runs hard, a "write" system call was issued and Linux
kernel was processing its request.
 But weird __ipipe_dispatch_event and __ipipe_sync_stage was recorded.

I think the problem originates from a Xenomai context switch(which
overwrites "current"), while Linux is processing  system call.
and I am sure that some tricks (preventing such case) must be included
on other platforms.

Any suggestions on preventing such panic?

thank you,
Kiichi Kameda



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-10-03 15:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-03 13:21 [Xenomai-help] SH4 port Kiichi Kameda
2006-10-02 13:30 ` Jan Kiszka
2006-10-03 14:13   ` Kiichi Kameda
2006-10-02 14:43     ` Jan Kiszka
2006-10-03 15:18       ` Kiichi Kameda
2006-10-02 15:44         ` Jan Kiszka
  -- strict thread matches above, loose matches on Subject: below --
2006-09-30 13:10 Kiichi Kameda
2006-09-29 13:20 ` Jan Kiszka
2006-10-02  8:40   ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.