From: "Burkhard Schölpen" <bschoelpen@web.de>
To: linux-kernel@vger.kernel.org
Subject: Strange delay on PCI-DMA-transfer completion by wait_event_interruptible()
Date: Mon, 12 Dec 2005 19:14:29 +0100 [thread overview]
Message-ID: <356942780@web.de> (raw)
Hi all,
I'm trying to write a driver for a custom PCI-Board which is DMA-Busmaster capable (kernel 2.6.13 with SMP). Unfortunately I get some strange delay between the start of the transfer until the interrupt appears, which signals its completion.
Concerning a dma transfer from RAM to the pci device, my code does the following:
while (down_interruptible(my_device->write_semaphore));
my_device->dma_write_complete = 0;
my_device->dma_direction = PCI_DMA_TODEVICE;
my_device->bus_addr = pci_map_single(my_device->pci_device, pointer_to_buffer, my_device->dma_size, my_device->dma_direction);
writel (cpu_to_le32 (bus_addr), MY_DMA_ADDR_REGISTER);
writel (cpu_to_le32 (my_device->dma_size/4), MY_DMA_COUNT_REGISTER); //triggers dma transfer
if (wait_event_interruptible(write_wait_queue, my_device->dma_write_complete))
{
//handle error...
}
//test, if MY_DMA_COUNT_REGISTER contains 0
up(my_device->write_semaphore);
Inside the Interrupt-handler I do the following:
pci_unmap_single (my_device->pci_device, my_device->bus_addr, my_device->dma_size, my_device->dma_direction);
my_device->dma_write_complete = 1;
wake_up_interruptible(&write_wait_queue);
return IRQ_HANDLED;
Actually the dma transfer works but I get a strange timing issue, which seems to be caused by wait_event_interruptible(). I measured the clock ticks elapsing from the start of the transfer until the interrupt appears. Converted to microseconds I get more than 600 us for less than 3 kB buffers. If I try out busy waiting using "while (!my_device->dma_write_complete)" instead of wait_event_interruptible() the transfer already completes successfully after about 80 us. The device has to transport very large amounts of data, so I have to get the transfer rate as high as possible.
I'm sorry if I made a very simple mistake, because I'm quite unexperienced in driver development, so hints would be very appreciated.
Kind regards,
Burkhard
______________________________________________________________________
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130
next reply other threads:[~2005-12-12 18:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-12 18:14 Burkhard Schölpen [this message]
2005-12-12 20:14 ` Strange delay on PCI-DMA-transfer completion by wait_event_interruptible() linux-os (Dick Johnson)
-- strict thread matches above, loose matches on Subject: below --
2005-12-13 9:29 Burkhard Schölpen
2005-12-13 14:27 ` linux-os (Dick Johnson)
[not found] <5jeNG-740-1@gated-at.bofh.it>
[not found] ` <5jnfV-2xy-577@gated-at.bofh.it>
2005-12-14 2:13 ` Robert Hancock
2005-12-14 7:59 Burkhard Schölpen
2005-12-14 14:12 ` linux-os (Dick Johnson)
[not found] <5jzIB-3pY-5@gated-at.bofh.it>
2005-12-15 1:22 ` Robert Hancock
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=356942780@web.de \
--to=bschoelpen@web.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.