LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices

Reply
 
Search this Thread
Old 03-18-2008, 06:54 AM   #1
debuser123
Member
 
Registered: Nov 2006
Distribution: Ubuntu Hardy
Posts: 69

Rep: Reputation: 15
Question setserial always results in deadlock when uart specified


I am trying to configure a PC104/16C550 modem which has jumpers to set the port address(8 ports) & irq(from 3 thru 7). The host is an Arcom Viper (PC104, Linux viper 2.6.16.28-arcom1-1-viper #1 Wed Sep 13 11:29:51 BST 2006 armv5tel unknown). This comptuer has 5 serial ports by default:
Code:
Serial: 8250/16550 driver $Revision: 1.90 $ 64 ports, IRQ sharing enabled
serial8250.0: ttyS0 at MMIO 0x40100000 (irq = 15) is a XScale
serial8250.0: ttyS1 at MMIO 0x40200000 (irq = 14) is a XScale
serial8250.0: ttyS2 at MMIO 0x40700000 (irq = 13) is a XScale
serial8250.0: ttyS3 at MMIO 0x14300010 (irq = 27) is a XR16850
serial8250.0: ttyS4 at MMIO 0x14300000 (irq = 26) is a XR16850
...so I set the port to 0x2A8 (6th port) and irq is set as 7 with setserial:

Code:
# setserial /dev/ttyS5 baud_base 115200 port 0x2a8 irq 7 uart 16550
but this always results in a deadlock & a lot of debugging info is displayed below
Code:
Unable to handle kernel NULL pointer dereference at virtual address 000002aa
pgd = c30b8000
[000002aa] *pgd=a311a031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
Modules linked in: serial_cs isp116x_hcd usbcore pxa2xx_cs pxa2xx_core pcmcia pcmcia_core firmware_class ds1307
CPU: 0
PC is at serial_out+0x78/0x80
LR is at 0x1
pc : [<c00e4f44>]    lr : [<00000001>]    Not tainted
sp : c30a5c40  ip : 00000000  fp : c30a5c4c
r10: 00000000  r9 : 00000000  r8 : 00000001
r7 : 00000000  r6 : c02b112c  r5 : c01c9c38  r4 : 00000000
r3 : 000002a8  r2 : 00000001  r1 : 00000002  r0 : c01c9c38
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: 397F  Table: A30B8000  DAC: 00000015
Process setserial (pid: 718, stack limit = 0xc30a4198)
Code:
Backtrace: 
[<c00e4ecc>] (serial_out+0x0/0x80) from [<c00e5c20>] (serial8250_startup+0xd4/0x3a8)
[<c00e5b4c>] (serial8250_startup+0x0/0x3a8) from [<c00e24a4>] (uart_startup+0xa0/0x19c)
 r6 = C02B112C  r5 = C01C9C38  r4 = C38DFC60 
[<c00e2404>] (uart_startup+0x0/0x19c) from [<c00e3324>] (uart_ioctl+0x5a4/0xa44)
 r8 = BEF30CB8  r7 = 00000000  r6 = C02B112C  r5 = 00000000
 r4 = C01C9C38 
[<c00e2d80>] (uart_ioctl+0x0/0xa44) from [<c00d2c3c>] (tty_ioctl+0xcc0/0xd64)
[<c00d1f7c>] (tty_ioctl+0x0/0xd64) from [<c0076bfc>] (do_ioctl+0x78/0x88)
[<c0076b84>] (do_ioctl+0x0/0x88) from [<c0076e9c>] (vfs_ioctl+0x290/0x2b0)
 r6 = 00000003  r5 = BEF30CB8  r4 = C397D4E0 
[<c0076c0c>] (vfs_ioctl+0x0/0x2b0) from [<c0076efc>] (sys_ioctl+0x40/0x5c)
 r7 = 00000036  r6 = 0000541F  r5 = FFFFFFF7  r4 = C397D4E0
[<c0076ebc>] (sys_ioctl+0x0/0x5c) from [<c0018ce0>] (ret_fast_syscall+0x0/0x2c)
 r6 = BEF30ECA  r5 = 000132DC  r4 = 0000A058 
Code: e5903004 e7832001 e89da800 e5903000 (e7c3e001) 
 
==========================================
[ BUG: lock recursion deadlock detected! |
------------------------------------------

setserial/718 is trying to acquire this lock:
 [c02b1144] {uart_register_driver}
.. held by:         setserial:  718 [c03cd820, 117]
... acquired at:               uart_ioctl+0x1ec/0xa44
... trying at:                 uart_close+0x38/0x1d4
------------------------------
| showing all locks held by: |  (setserial/718 [c03cd820, 117]):
------------------------------

#001:             [c02b1144] {uart_register_driver}
... acquired at:               uart_ioctl+0x1ec/0xa44

Code:
Showing all blocking locks in the system:
S            init:    1 [c0284d60, 116] (not blocked on mutex)
S     ksoftirqd/0:    2 [c0284ac0, 134] (not blocked on mutex)
S      watchdog/0:    3 [c0284820,   0] (not blocked on mutex)
S        events/0:    4 [c0284580, 110] (not blocked on mutex)
S         khelper:    5 [c02842e0, 110] (not blocked on mutex)
S         kthread:    6 [c0284040, 115] (not blocked on mutex)
S       kblockd/0:   25 [c02fed60, 120] (not blocked on mutex)
S         pdflush:   48 [c0335040, 120] (not blocked on mutex)
S         pdflush:   49 [c0349d60, 115] (not blocked on mutex)
S           aio/0:   51 [c0349820, 120] (not blocked on mutex)
S         kswapd0:   50 [c0349ac0, 125] (not blocked on mutex)
S       mtdblockd:  200 [c02c02e0, 125] (not blocked on mutex)
S  jffs2_gcd_mtd2:  258 [c03cd040, 135] (not blocked on mutex)
S         pccardd:  482 [c03cd2e0, 115] (not blocked on mutex)
S           khubd:  511 [c02d6ac0, 110] (not blocked on mutex)
S         portmap:  606 [c02c0580, 115] (not blocked on mutex)
S         syslogd:  627 [c02d62e0, 116] (not blocked on mutex)
R           klogd:  630 [c03cd580, 116] (not blocked on mutex)
S       rpc.statd:  635 [c02d6820, 120] (not blocked on mutex)
S           inetd:  662 [c02b3820, 120] (not blocked on mutex)
R          thttpd:  667 [c02c0820, 116] (not blocked on mutex)
S            sshd:  674 [c03ff580, 116] (not blocked on mutex)
S            cron:  679 [c02fe820, 115] (not blocked on mutex)
S           getty:  680 [c3c16d60, 116] (not blocked on mutex)
S            sshd:  681 [c0349580, 115] (not blocked on mutex)
S              sh:  685 [c03492e0, 115] (not blocked on mutex)
R       setserial:  718 [c03cd820, 117] (not blocked on mutex)

I am however able to repeat the above command successfully but I have to exclude the uart option and setserial returns instantly. The settings were verified as being set, however any operation with the port (/dev/ttyS5) results in an I/O error (even a simple cat < /dev/ttyS5).

I've removed all gettys on serial ports...what could be the problem?

Last edited by debuser123; 03-18-2008 at 06:55 AM.
 
Old 03-27-2008, 01:41 AM   #2
debuser123
Member
 
Registered: Nov 2006
Distribution: Ubuntu Hardy
Posts: 69

Original Poster
Rep: Reputation: 15
"Unable to handle kernel NULL pointer dereference at virtual address 000002aa"

This is obviously wrong...because:
1) the physical address of the PC104 bus is @ 0x30000000
2) the virtual address of 0x30000000phys = 0xf1000000 (verified in kernel source [arch=arm, machine=pxa255 w/CONFIG_VIPER=y])
3) the port I had supplied was 0x2a8, so the above info means it was trying to send out a byte at the uart's 3rd register. it did this I guess on testing the uart (skip_test not supplied).

So, I'm making a kernel module that simply maps the resources at the right places. I've got it to map the right locations (0x300002a8 physical for 8 bytes) using serial8250_register_port() which returns line 5.....ttyS5, right?


Except now I just get a Read error when even trying to cat /dev/ttyS5. Is there something I'm missing in order to simply map a port and let the serial8250 driver handle it?

Last edited by debuser123; 03-27-2008 at 01:43 AM.
 
Old 03-27-2008, 06:31 AM   #3
debuser123
Member
 
Registered: Nov 2006
Distribution: Ubuntu Hardy
Posts: 69

Original Poster
Rep: Reputation: 15
I figured it out:
#1 I had to use irq 108 instead of irq 7 because 7 was my "ISA" irq. arch/arm/mach-pxa/viper.c maps ISA irqs to 101+isa_irq with some exceptions.
#2 (this was the main reason it didn't work) the iotype (of the uart_port) had to be set to UPIO_MEM instead of UPIO_PORT. though I knew ARM doesn't have in/out-type instructions I thought the translation would be abstracted and not have to worry about other things. but it was pretty evident that serial_in() was using the port's iobase member (which I had set to the physical address of the 'port' [x300002a8]).

So changing the port .iotype to UPIO_MEM, supplying UPF_BOOT_AUTOCONF | UPF_IOREMAP for the .flags, setting .mapbase to the physical address of the port, and using the ISA-mapped irq worked.

The funny thing is that this board works using an .iotype of UPIO_PORT on a separate computer which is also ARM but a different machine type (ep93xx). However, it's a 2.4 kernel, while the stuff I'm working on is 2.6.

Last edited by debuser123; 03-27-2008 at 06:34 AM.
 
Old 09-23-2010, 03:59 AM   #4
purwoadi
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
PC/104 serial card on top of Viper

Hi debuser123,
I fall in the same problem as yours. But I don't really understand
what you have done to solve the problem. Did you rebuild the 8250.o
modul kernel or did you rebuild the setserial program.

Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deadlock management in linux btap_644 Linux - Desktop 3 02-07-2011 04:46 PM
Simple pipe in deadlock? nutthick Programming 3 05-10-2006 07:59 AM
Apt Dependency Deadlock Quantumstate Debian 7 04-23-2006 09:33 AM
Diagnosing Deadlock jcase008 Linux - Software 3 07-03-2004 09:09 PM
deadlock rajani Programming 0 03-11-2002 06:34 AM


All times are GMT -5. The time now is 03:18 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration