Subject: Re: need help with DMA and UBC synchronization
To: Matthias Drochner <M.Drochner@fz-juelich.de>
From: Chuck Silvers <firstname.lastname@example.org>
Date: 05/25/2005 06:49:24
a device->memory transfer should use uvm_vslock(VM_PROT_READ).
the read vs. write is from the standpoint of the host memory,
similar to bus_dmamap_sync().
On Wed, May 25, 2005 at 02:03:54PM +0200, Matthias Drochner wrote:
> Hi -
> we are working on a high-speed data acquisition system.
> (Quite specialized, based on own hardware.)
> We are getting the data through DMA (interfaced by a PLX
> chip which is scatter/gather capable).
> There is a driver which does the DMA into a user provided
> buffer -- the usual uvm_vslock() - transfer - uvm_vsunlock().
> We are using an ioctl as entry point so that we can provide
> all parameters needed and avoid the limitations of MAXPHYS.
> This works all well.
> The next step is to write the data into a file. The user
> application mmap()s a file (previously set to a reasonable
> size by ftruncate()) and passes the virtual address to
> the driver.
> Now we get the problem that the data don't get flushed
> out to disk. The reason is probably that the UBC doesn't
> get told that the pages are dirty.
> What is the right way to deal with this? I would assume
> that the uvm_vslock(PROT_WRITE) marks the pages as dirty,
> but this appearently doesn't happen.
> This is on NetBSD-2.0.2/i386.
> best regards