Re: [PATCH] esp: Make driver SMP-correct

From: Andrew Morton (akpm_at_osdl.org)
Date: 12/31/04

  • Next message: Rajsekar: "Re: swsusp: Kill O(n^2) algorithm in swsusp"
    Date:	Fri, 31 Dec 2004 01:46:11 -0800
    To: James Nelson <james4765@verizon.net>
    
    

    James Nelson <james4765@verizon.net> wrote:
    >
    > This is an attempt to make the esp serial driver SMP-correct. It also removes
    > some cruft left over from the serial_write() conversion.

    From a quick scan:

    - startup() does multiple sleeping allocations and request_irq() under
      spin_lock_irqsave(). Maybe fixed by this:

    --- 25/drivers/char/esp.c~esp-make-driver-smp-correct-fixes 2004-12-31 01:40:57.987232152 -0800
    +++ 25-akpm/drivers/char/esp.c 2004-12-31 01:42:21.444544712 -0800
    @@ -851,16 +851,14 @@ static int startup(struct esp_struct * i
             int retval=0;
             unsigned int num_chars;
     
    - spin_lock_irqsave(&info->irq_lock, flags);
    -
             if (info->flags & ASYNC_INITIALIZED)
    - goto out;
    + goto out_unlocked;
     
             if (!info->xmit_buf) {
                     info->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
                     retval = -ENOMEM;
                     if (!info->xmit_buf)
    - goto out;
    + goto out_unlocked;
             }
     
     #ifdef SERIAL_DEBUG_OPEN
    @@ -907,7 +905,7 @@ static int startup(struct esp_struct * i
                                             &info->tty->flags);
                             retval = 0;
                     }
    - goto out;
    + goto out_unocked;
             }
     
             if (!(info->stat_flags & ESP_STAT_USE_PIO) && !dma_buffer) {
    @@ -926,6 +924,8 @@ static int startup(struct esp_struct * i
                             
             }
     
    + spin_lock_irqsave(&info->irq_lock, flags);
    +
             info->MCR = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
             serial_out(info, UART_ESI_CMD1, ESI_WRITE_UART);
             serial_out(info, UART_ESI_CMD2, UART_MCR);
    @@ -965,7 +965,9 @@ static int startup(struct esp_struct * i
     
             info->flags |= ASYNC_INITIALIZED;
             retval = 0;
    -out: spin_unlock_irqrestore(&info->irq_lock, flags);
    +out:
    + spin_unlock_irqrestore(&info->irq_lock, flags);
    +out_unocked:
             return retval;
     }
     
    _

    - startup() calls change_speed() under info->irq_lock, but change_speed()
      also takes info->irq_lock. Instant deadlock on driver initialisation.

    The driver needs more serious surgery than this.
    -
    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/


  • Next message: Rajsekar: "Re: swsusp: Kill O(n^2) algorithm in swsusp"

    Relevant Pages

    • Re: My thoughts on the "new development model"
      ... |>>> 2.6 tree is great for gentoo users who like gcc consuming all CPU ... |>> that after a month or so of fixes etc it will be a very stable kernel ... driver for 2.6.7 for an ADSL card; a development driver for 2.6.5 for a ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: sata related hang with linux-2.6
      ... IMHO there's something not quite right with the Silicon Image libata ... Perhaps the driver is enabling the hardware to generate interrupts ... before setting up the interrupt routine for it? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: SL811 problem on mach-pxa
      ... It was tested with _both_ workarounds for IRQ issues; ... unlike the predecessors to this driver). ... I've had reports that one of the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.7 (future kernel) wish
      ... > I've never seen one give a STOP error from that but I guess a bad driver ... I would like to see the HAL type crap for Linux. ... to have uniform user device control from a gui programmable means. ... 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/ ...
      (Linux-Kernel)
    • [RFC] removal of legacy cdrom drivers (Re: [PATCH] mcdx.c insanity removal)
      ... bar and baz and fairly long expressions. ... if we want to keep the FPOS in the tree. ... Driver is obviously ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)