Re: [patch 2/3] s3cmci - call pio_tasklet from IRQ
From: Ben Dooks
Date: Mon Sep 08 2008 - 09:47:23 EST
On Mon, Sep 08, 2008 at 02:48:50PM +0200, Christer Weinigel wrote:
> Scheduling a tasklet to perform the pio transfer introduces a bit of
> extra processing, just call pio_tasklet directly from the interrupt
> instead. Writing up to 64 bytes to a FIFO is probably uses less CPU
> than scheduling a tasklet anyway.
Hmm, i'd be interested to find out how long these are taking... I might
try and rig up something to test the time being taken via an SMDK.
If the fifo read/writes are taking significant amounts of time, then the
pio tasklet will at least improve the interrupt latencies invloved, as
iirc we're currently running the main irq handler in IRQ_DISABLED mode
to stop any problems with re-enternancy.... I'll check this and see what
is going on.
> Signed-off-by: Christer Weinigel <christer@xxxxxxxxxxx>
>
> Index: linux-2.6.26.2/drivers/mmc/host/s3cmci.c
> ===================================================================
> --- linux-2.6.26.2.orig/drivers/mmc/host/s3cmci.c
> +++ linux-2.6.26.2/drivers/mmc/host/s3cmci.c
> @@ -361,11 +361,8 @@ static void do_pio_write(struct s3cmci_h
> enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
> }
>
> -static void pio_tasklet(unsigned long data)
> +static void pio_tasklet(struct s3cmci_host *host)
> {
> - struct s3cmci_host *host = (struct s3cmci_host *) data;
> -
> -
> disable_irq(host->irq);
>
> if (host->pio_active == XFER_WRITE)
> @@ -460,10 +457,10 @@ static irqreturn_t s3cmci_irq(int irq, v
> if (!host->dodma) {
> if ((host->pio_active == XFER_WRITE) &&
> (mci_fsta & S3C2410_SDIFSTA_TFDET)) {
> -
> disable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
> - tasklet_schedule(&host->pio_tasklet);
> + pio_tasklet(host);
> host->status = "pio tx";
> + goto irq_out;
> }
>
> if ((host->pio_active == XFER_READ) &&
> @@ -473,8 +470,9 @@ static irqreturn_t s3cmci_irq(int irq, v
> S3C2410_SDIIMSK_RXFIFOHALF |
> S3C2410_SDIIMSK_RXFIFOLAST);
>
> - tasklet_schedule(&host->pio_tasklet);
> + pio_tasklet(host);
> host->status = "pio rx";
> + goto irq_out;
> }
> }
>
> @@ -595,7 +593,7 @@ close_transfer:
> host->complete_what = COMPLETION_FINALIZE;
>
> clear_imask(host);
> - tasklet_schedule(&host->pio_tasklet);
> + pio_tasklet(host);
>
> goto irq_out;
>
> @@ -666,7 +664,7 @@ void s3cmci_dma_done_callback(struct s3c
> host->complete_what = COMPLETION_FINALIZE;
>
> out:
> - tasklet_schedule(&host->pio_tasklet);
> + pio_tasklet(host);
> spin_unlock_irqrestore(&host->complete_lock, iflags);
> return;
>
> @@ -1198,7 +1196,6 @@ static int __devinit s3cmci_probe(struct
> }
>
> spin_lock_init(&host->complete_lock);
> - tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host);
>
> if (is2440) {
> host->sdiimsk = S3C2440_SDIIMSK;
> @@ -1381,7 +1378,6 @@ static int __devexit s3cmci_remove(struc
>
> clk_put(host->clk);
>
> - tasklet_disable(&host->pio_tasklet);
> s3c2410_dma_free(S3CMCI_DMA, &s3cmci_dma_client);
>
> free_irq(host->irq, host);
> Index: linux-2.6.26.2/drivers/mmc/host/s3cmci.h
> ===================================================================
> --- linux-2.6.26.2.orig/drivers/mmc/host/s3cmci.h
> +++ linux-2.6.26.2/drivers/mmc/host/s3cmci.h
> @@ -66,5 +66,4 @@ struct s3cmci_host {
> char *status;
>
> unsigned int ccnt, dcnt;
> - struct tasklet_struct pio_tasklet;
> };
>
> --
> "Just how much can I get away with and still go to heaven?"
>
> Christer Weinigel <christer@xxxxxxxxxxx> http://www.weinigel.se
--
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/