Subject: need help with DMA and UBC synchronization
To: None <tech-kern@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: tech-kern
Date: 05/25/2005 14:03:54
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
Matthias