[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] PV audio drivers for Linux




>-----Original Message-----
>From: Stefano Stabellini [mailto:sstabellini@xxxxxxxxxx]
>Sent: Wednesday, January 18, 2017 5:41 AM
>To: Ughreja, Rakesh A <rakesh.a.ughreja@xxxxxxxxx>
>Cc: xen-devel@xxxxxxxxxxxxx; Oleksandr_Andrushchenko@xxxxxxxx;
>Oleksandr_Grytsov@xxxxxxxx; oleksandr.dmytryshyn@xxxxxxxxxxxxxxx;
>iurii.konovalenko@xxxxxxxxxxxxxxx; konrad.wilk@xxxxxxxxxx
>Subject: Re: [Xen-devel] PV audio drivers for Linux
>
>On Tue, 17 Jan 2017, Ughreja, Rakesh A wrote:
>> Hi,
>>
>> I am trying to develop PV audio drivers and facing one issue to
>> achieve zero copy of the buffers between Front End (DOM1) and
>> Back End (DOM0) drivers.
>
>You might want to take a look at the existing PV sound proposal:
>
>http://marc.info/?l=xen-devel&m=148094319010445
>
Sure, let me look into this.
Thank you very much for the quick reply and the reference.

>
>> When the buffer is allocated using __get_free_pages() on the DOM0
>> OS, I am able to grant the access using gnttab_grant_foreign_access()
>> to DOM1 as well as I am able to map it in the DOM1 virtual space
>> using xenbus_map_ring_valloc().
>>
>> However the existing audio driver allocates buffer using
>> dma_alloc_coherent(). In that case I am able to grant the access using
>> gnttab_grant_foreign_access() to DOM1 but when I try to map in the
>> DOM1 virtual space using xenbus_map_ring_valloc(), it returns an error.
>>
>> [1] Code returns from here.
>>
>> 507                         xenbus_dev_fatal(dev, map[i].status,
>> 508                                          "mapping in shared page %d from 
>> domain %d",
>> 509                                          gnt_refs[i], dev->otherend_id);
>>
>> gnttab_batch_map(map, i) is unable to map the page, but I am unable to
>> understand why. May be its due to the difference in the way buffers
>> are allocated dma_alloc_coherent() vs __get_free_pages().
>>
>> Since I don't want to touch existing audio driver, I need to figure out
>> how to map buffer to DOM1 space with dma_alloc_coherent().
>>
>> Any pointers would be really helpful. Thank you in advance.
>
>Pages allocated by dma_alloc_coherent can be a bit special. Are you
>going through the swiotlb-xen
>(drivers/xen/swiotlb-xen.c:xen_swiotlb_alloc_coherent) in Dom0?
>

No, I am not using this. Actually I am trying to reuse the existing
HDA driver and just opening the ALSA streams at kernel level in
PV Backend driver.

Buffers are allocated by the existing HDA driver.
http://lxr.free-electrons.com/source/sound/core/memalloc.c#L83

>I would probably add a few printks to Xen in
>xen/common/grant_table.c:do_grant_table_op to understand what is the
>error exactly.

In the gnttab_retry_eagain_gop function, when it tries to
get the status it always receives status as GNTST_eagain. After the retries
the status is marked as GNTST_bad_page.

I am unable to figure out what properties of dma_alloc_coherent allocated
buffers makes it un-mappable at Dom1.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.