Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965025AbWL2JmD (ORCPT ); Fri, 29 Dec 2006 04:42:03 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964885AbWL2JmD (ORCPT ); Fri, 29 Dec 2006 04:42:03 -0500 Received: from javad.com ([216.122.176.236]:4080 "EHLO javad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965025AbWL2JmA (ORCPT ); Fri, 29 Dec 2006 04:42:00 -0500 From: Sergei Organov To: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: irq 4: nobody cared and I/O errors on serial ports. Date: Fri, 29 Dec 2006 12:41:50 +0300 Message-ID: <874prfm42p.fsf@javad.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.19 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5245 Lines: 152 Hello, It seems that the kernel has some problems/races in opening/closing of serial ports. Simple C program below just opens/closes a port in a loop: #include #include #include #include int main() { while(1) { int fd = open("/dev/ttyS0", O_RDONLY | O_NOCTTY); if(fd < 0) fprintf(stderr, "%s\n", strerror(errno)); else close(fd); } } I've noticed 2 problems running this program. I run 2.6.19.1 smp kernel (I've also tested Debian 2.6.18.3 kernel, and it has the same issues) on hyper-threaded Pentium 4 CPU. 1. When I run the program, I begin to get "irq 4: nobody cared" in dmesg even though the port is not connected (idle). Please find relevant part of dmesg below. 2. When two copies of this program are run simultaneously, each of copies start to randomly fail to open the port with errno=5 (Input/output error). Note that I've tested this both with standard PC port ttyS0 and with serial ports of MOXA multi-port serial board (ttyM*), and [mis]behavior is the same. Also note that opening /dev/null instead of serial port doesn't have any problems. Here are relevant parts from dmesg when open/close ttyS0: irq 4: nobody cared (try booting with the "irqpoll" option) [] __report_bad_irq+0x36/0x7d [] note_interrupt+0x1bb/0x1f7 [] handle_IRQ_event+0x1a/0x3f [] handle_edge_irq+0xde/0x109 [] do_IRQ+0x7d/0xa4 [] common_interrupt+0x1a/0x20 [] common_interrupt+0x1a/0x20 [] serial_out+0x73/0x77 [] serial8250_shutdown+0x71/0x148 [] uart_shutdown+0x83/0xad [] uart_close+0x113/0x1a9 [] tty_fasync+0x3a/0xaa [] release_dev+0x1df/0x61e [] chrdev_open+0x12d/0x141 [] chrdev_open+0x0/0x141 [] nameidata_to_filp+0x24/0x33 [] do_filp_open+0x32/0x39 [] __next_cpu+0x12/0x21 [] __sched_text_start+0x5a3/0x90a [] tty_release+0xf/0x18 [] __fput+0x96/0x16a [] filp_close+0x52/0x59 [] sys_close+0x65/0x99 [] sysenter_past_esp+0x56/0x79 ======================= handlers: [] (serial8250_interrupt+0x0/0xdc) Disabling IRQ #4 irq 4: nobody cared (try booting with the "irqpoll" option) [] __report_bad_irq+0x36/0x7d [] note_interrupt+0x1bb/0x1f7 [] handle_IRQ_event+0x1a/0x3f [] handle_edge_irq+0xde/0x109 [] do_IRQ+0x7d/0xa4 [] common_interrupt+0x1a/0x20 [] mwait_idle_with_hints+0x3b/0x3f [] mwait_idle+0xc/0x1b [] cpu_idle+0x9f/0xb9 [] start_kernel+0x39f/0x3a7 [] unknown_bootoption+0x0/0x206 ======================= handlers: Disabling IRQ #4 irq 4: nobody cared (try booting with the "irqpoll" option) [] __report_bad_irq+0x36/0x7d [] note_interrupt+0x1bb/0x1f7 [] handle_IRQ_event+0x1a/0x3f [] handle_edge_irq+0xde/0x109 [] do_IRQ+0x7d/0xa4 [] common_interrupt+0x1a/0x20 [] mwait_idle_with_hints+0x3b/0x3f [] mwait_idle+0xc/0x1b [] cpu_idle+0x9f/0xb9 [] start_kernel+0x39f/0x3a7 [] unknown_bootoption+0x0/0x206 ======================= handlers: Disabling IRQ #4 irq 4: nobody cared (try booting with the "irqpoll" option) [] __report_bad_irq+0x36/0x7d [] note_interrupt+0x1bb/0x1f7 [] handle_IRQ_event+0x1a/0x3f [] handle_edge_irq+0xde/0x109 [] do_IRQ+0x7d/0xa4 [] common_interrupt+0x1a/0x20 [] common_interrupt+0x1a/0x20 [] serial_out+0x73/0x77 [] serial8250_shutdown+0x8b/0x148 [] uart_shutdown+0x83/0xad [] uart_close+0x113/0x1a9 [] tty_fasync+0x3a/0xaa [] release_dev+0x1df/0x61e [] chrdev_open+0x12d/0x141 [] chrdev_open+0x0/0x141 [] nameidata_to_filp+0x24/0x33 [] do_filp_open+0x32/0x39 [] __next_cpu+0x12/0x21 [] __sched_text_start+0x5a3/0x90a [] tty_release+0xf/0x18 [] __fput+0x96/0x16a [] filp_close+0x52/0x59 [] sys_close+0x65/0x99 [] sysenter_past_esp+0x56/0x79 ======================= handlers: [] (serial8250_interrupt+0x0/0xdc) Disabling IRQ #4 irq 4: nobody cared (try booting with the "irqpoll" option) [] __report_bad_irq+0x36/0x7d [] note_interrupt+0x1bb/0x1f7 [] handle_IRQ_event+0x1a/0x3f [] handle_edge_irq+0xde/0x109 [] do_IRQ+0x7d/0xa4 [] common_interrupt+0x1a/0x20 [] mwait_idle_with_hints+0x3b/0x3f [] mwait_idle+0xc/0x1b [] cpu_idle+0x9f/0xb9 [] start_kernel+0x39f/0x3a7 [] unknown_bootoption+0x0/0x206 ======================= handlers: Disabling IRQ #4 -- Sergei Organov. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/