[wdmaudiodev] Re: WavePCI issue with multiple processors

  • From: Eugene Muzychenko <emuzychenko@xxxxxxxxx>
  • To: Jeff Pages <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 26 Mar 2007 14:38:52 +0700

Hello Jeff,

> This leads to the problem of acquiring mappings out of order, since
> the order in which they are placed into the hardware DMA queue is
> essentially the order in which the driver's spin lock is reacquired
> after the calls to GetMapping.

It is not necessary to serialize GetMapping calls. You must serialize
tag acquisitions only. If a next GetMapping call fails, you can simply
leave a last acquired tag unused. Tags are required to be monotonous but
not contiguous.

Another way is to use a "who first calls" technique. If several
processors try to simultaneously acquire mappings for a stream, it is
not necessary to serialize these calls, it is enough to allow only one
of them to enter a mapping acquisition loop and to skip it on others.
To implement this technique, you could use a variable like
"InAcquisitionLoop" and InterlockedExchange to indicate when the loop
is entered/leaved.

> According to the WDK documentation, MappingAvailable is only
> supposed to be called after a previous call to GetMapping has
> failed

It is correct but there is no need to rely upon this. You could execute
the acquisition loop in every MappingAvailable invocation, acquiring
as many mappings as you want.

> So what's the story with this pre-emptive call to MappingAvailable?
> Is it supposed to happen, and if so, under what circumstances?

portcls calls MappingAvailable in response to IOCTL_KS_READ_STREAM
and IOCTL_KS_READ_STREAM IRPs. As documented, it should notify you only
if a last GetMapping call was failed but does not always check this



WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx


Other related posts: