Open Bug 1346927 Opened 7 years ago Updated 2 years ago

Replace PVRManager::GetSensorState with lock-free shared memory structure (Eliminating message queue IPC)

Categories

(Core :: WebVR, enhancement)

enhancement

Tracking

()

Performance Impact low

People

(Reporter: kip, Unassigned)

References

Details

(Keywords: perf)

Attachments

(1 file)

A lock-free structure in shared memory is more efficient than an IPC message queue, will help reduce latency, and will eliminate the sync IPC message in support of Bug 1344216.
Blocks: 1344216
See Also: → 1306493
Whiteboard: [qf:p3]
For some background on the lock-free approach, see "Concurrent reading and writing" by Leslie Lamport:

http://dl.acm.org/citation.cfm?doid=359863.359878

This is applicable to VR headset state, such as positional tracking data, as it is updated by a single thread while being read by multiple threads.  Concurrent writing by multiple threads is not necessary.
(In reply to :kip (Kearwood Gilbert) from comment #1)
> For some background on the lock-free approach, see "Concurrent reading and
> writing" by Leslie Lamport:
> 
> http://dl.acm.org/citation.cfm?doid=359863.359878
> 
> This is applicable to VR headset state, such as positional tracking data, as
> it is updated by a single thread while being read by multiple threads. 
> Concurrent writing by multiple threads is not necessary.

Specifically, I would apply the "General Readers/Writer Solution" for this application.
We will also need to ensure that the solution is tolerant of preemption and does not result in crashing the content process if the GPU process is killed.
(In reply to :kip (Kearwood Gilbert) from comment #3)
> We will also need to ensure that the solution is tolerant of preemption and
> does not result in crashing the content process if the GPU process is killed.
Pre-emption effects can be avoided by limiting the number of iterations attempting to get a new headset state in the reader.  When a valid state is read, it will be copied to the reader's non-shared memory.  In the event of the writer being pre-empted for an extended duration of time, the reader should fall back to the prior recorded sensor states.
(In reply to Daosheng Mu[:daoshengmu] from comment #6)
> Kip, have you taken a look at,
> https://dxr.mozilla.org/mozilla-central/rev/
> 0b255199db9d6a6f189b89b7906f99155bde3726/ipc/glue/SharedMemory.h? Could it
> have any help for us?
Yes, I think me may be able to use this class in our implementation.  It's nice to have some platform abstraction
Depends on: 1362578
Keywords: perf
Summary: Replace PVRManager::GetSensorState with lock-free shared memory structure (Eliminating sync IPC) → Replace PVRManager::GetSensorState with lock-free shared memory structure (Eliminating message queue IPC)
Performance Impact: --- → P3
Whiteboard: [qf:p3]

The bug assignee didn't login in Bugzilla in the last 7 months.
:jimm, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: kearwood → nobody
Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: