public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: JosephChan@via.com.tw, Ben Dooks <ben-linux@fluff.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [Patch 2/3] via-sdmmc: via-sdmmc.c
Date: Thu, 18 Dec 2008 13:49:55 +0100	[thread overview]
Message-ID: <200812181349.55601.arnd@arndb.de> (raw)
In-Reply-To: <C80EF34A3D2E494DBAF9AC29C7AE4EB808521780@exchtp03.taipei.via.com.tw>

On Wednesday 17 December 2008, JosephChan@via.com.tw wrote:

> > struct pcictrlreg __iomem *pcr = 
> > vcrdr_chip->pcictrl_mmiobase; pm_pcictrl_reg->pcisdclk_reg = 
> > readb(&pcr->pcisdclk_reg);
> > 
> > Of course, your code is doing the same things effectively and 
> > entirely ok here.
> 
> We'll modify the code according to your suggestions..

Ben Dooks didn't like that suggestion, and I don't care that
much, so you may want to leave this one alone.
 
> We'll try to modify the code like below, but need more tests.
> 
> In via_sdc_preparedata() function:
> 
>     int sg_cnt;
> 
>     sg_cnt = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, (data->flags & MMC_DATA_READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
>     WARN_ON(sg_cnt != 1);

AFAICT, it would be perfectly fine for sg_cnt to be larger than 1,
just not smaller. I don't understand yet how your hardware would
deal with this though.

>     via_set_ddma(host->chip, sg_dma_address(data->sg), sg_dma_len(data->sg), (data->flags & MMC_DATA_READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE );

Ideally, the via_set_ddma function would be able to program the scatterlist
into the hardware registers directly. If this doesn't work, you may
be able to look over all elements in the list manually. If this doesn't
work either, you will have to go back to your original code, and replace
the virt_to_phys conversion with dma_map_single()/dma_unmap_single().

> > What are your criteria for deciding which events to handle in 
> > interrupt context or in tasklet context? Are some of them 
> > extremely performance critical?
> 
> The criteria are: 
> 1. Because the SD card detect operations need delay about 1 ms, so it should not be implemented in interrupt context. So we implement it by via_sdc_tasklet_card.

I would argue that 1ms is too long for tasklet (softirq) context as well,
and this should better be moved to a work queue.

> 2. The STSTATUS_REG register must be reset quickly, so it should be implemented in interrupt context.
> 3. In order to finish one “request” from the mmc_block layer quickly, all operations (that can finished quickly) before the end of the “request” should be implemented in interrupt context.

It's still hard to tell what 'quickly' means here. There is a latency for
entering work queues or tasklets, but if the system is idle, that should
not be noticable. OTOH, if the system is busy, it may be worthwhile doing
something more important before working on the MMC workqueue.

It's probably something you should measure. If you don't find a significant
slowdown by moving to a work queue implementation, I would recommend doing
that in order to simplify the driver.

	Arnd <><

  reply	other threads:[~2008-12-18 12:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 11:41 [Patch 2/3] via-sdmmc: via-sdmmc.c JosephChan
2008-12-16 11:58 ` Oliver Neukum
2008-12-17 11:12   ` JosephChan
2008-12-16 13:31 ` Arnd Bergmann
2008-12-16 16:00   ` Ben Dooks
2008-12-17  9:45   ` JosephChan
2008-12-18 12:49     ` Arnd Bergmann [this message]
2008-12-22  7:17       ` JosephChan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200812181349.55601.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=JosephChan@via.com.tw \
    --cc=ben-linux@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox