0

Remove an existing GPU channel before creating a new GPU channel

1. Establishing GPU channel with exsisting client_id is requested
   from client. (it's a very unusual case.)
2. New GpuChannel is created.
3. New SharedStubImage is created.
4. New SyncPointClientState is created and trying to insert the state
   into client_state_maps_[namespace_id] in SyncPointManager
   and the key is command_buffer_id. However, fail to insert
   because same key already exists on the map.
5. Existing GPU channel with same client id is deleted.
   when gpu_channels_[client_id] = std::move(gpu_channel) is called.
6. SharedStubImage is deleted
7. SyncPointClientState::Destroy() and
   SyncPointManager::DestroySyncPointClientState are called.
8. Existing SyncPointClientState in client_state_maps_ is deleted
   because command_buffer_id which comes from client_id is
   same with existing one.

SyncPointClientState is deleted when establishing GPU channel
and it will cause unexpected SyncPoint issues.

To fix this issue, we will remove an existing GPU channel
before creating a new GPU channel if client id of the existing
channel is same with that of new one.

Bug: 1454023
Change-Id: If62661aef62945e843c939e25b22e413021491fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4607741
Reviewed-by: vikas soni <vikassoni@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1158337}
This commit is contained in:
ilwoo905.lee
2023-06-15 18:46:39 +00:00
committed by Chromium LUCI CQ
parent 756bfdd10d
commit 0486d940ed
2 changed files with 6 additions and 0 deletions

@ -510,6 +510,7 @@ Ian Scott <ian.scott@arteris.com>
Ibrar Ahmed <ibrar.ahmad@gmail.com>
Ilia Demianenko <ilia.demianenko@gmail.com>
Ilia K <ki.stfu@gmail.com>
Ilwoo Lee <ilwoo905.lee@samsung.com>
Ilya Konstantinov <ilya.konstantinov@gmail.com>
Imam Mohammad Bokhary <imam.bokhary@samsung.com>
Imranur Rahman <i.rahman@samsung.com>

@ -482,6 +482,11 @@ GpuChannel* GpuChannelManager::EstablishChannel(
bool is_gpu_host) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Remove existing GPU channel with same client id before creating
// new GPU channel. if not, new SyncPointClientState in SyncPointManager
// will be destroyed when existing GPU channel is destroyed.
RemoveChannel(client_id);
std::unique_ptr<GpuChannel> gpu_channel = GpuChannel::Create(
this, channel_token, scheduler_, sync_point_manager_, share_group_,
task_runner_, io_task_runner_, client_id, client_tracing_id, is_gpu_host,