Re: dsp mmap change

From: John Baldwin <jhb_at_freebsd.org>
Date: Fri, 6 May 2011 16:16:40 -0400
On Friday, May 06, 2011 10:04:28 am Kostik Belousov wrote:
> On Fri, May 06, 2011 at 04:38:00PM +0300, Andriy Gapon wrote:
> > on 06/05/2011 16:32 Kostik Belousov said the following:
> > > On Fri, May 06, 2011 at 11:55:00AM +0300, Andriy Gapon wrote:
> > >>
> > >> I would like to ask for a review and/or testing of the following patch:
> > >> http://people.freebsd.org/~avg/dev_dsp_mmap.diff
> > >>
> > >> It's supposed to fix an issue described here:
> > >> http://lists.freebsd.org/pipermail/freebsd-multimedia/2011-
February/011691.html
> > >>
> > >> In short, the following pseudo-code should do the right thing:
> > >> fd = open(/dev/dsp, O_RDWR);
> > >> mmap(PROT_READ, fd);
> > >> mmap(PROT_WRITE, fd);
> > >>
> > >> Thank you!
> > > 
> > > I think that you have to call PCM_GIANT_LEAVE() when returning
> > > EINVAL on the vm_pager_alloc() failure.
> > 
> > Yes, thank you.
> > 
> > > Your patch hardcodes an assumption that sndbufs are always
> > > contiguous. I was unable to convince myself that this is true.
> > 
> > I think that this should be true for the case when DMA is used?
> In the current driver, yes, but there is nothing that theoretically
> prevents scatter-gather from be used.

You could "fix" this by creating an sglist (via sglist_build()) and an
OBJT_SG VM object that the d_mmap_single callback returned.  I wish there
was a cleaner way to just create a VM object and populate it with pages
though, and then use vm_map_insert() to map it into the kernel rather
than the more roundabout method of OBJT_SG.

-- 
John Baldwin
Received on Fri May 06 2011 - 18:19:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC