From 9e329ca39b64b9c96d1db70d750c287166af92d1 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Wed, 27 Mar 2019 17:15:00 -0700 Subject: gpu: nvgpu: tsg: ensure unbound channel is disabled Multiple threads could be unbinding different channels from the same tsg at the same time. At the point where we remove the channel from the tsg's channel list, call disable_channel again, in case another thread had re-enabled the channel after we had disabled it. Bug 200404549 Change-Id: I9abbc08dc11fe1f7a0abada88376c0ef96b56610 Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/2083337 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Satish Arora Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index f4b96b7a..a1844a28 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1,7 +1,7 @@ /* * GK20A Graphics FIFO (gr host) * - * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -2193,6 +2193,11 @@ int gk20a_fifo_tsg_unbind_channel(struct channel_gk20a *ch) nvgpu_rwsem_down_write(&tsg->ch_list_lock); nvgpu_list_del(&ch->ch_entry); ch->tsgid = NVGPU_INVALID_TSG_ID; + + /* another thread could have re-enabled the channel because it was + * still on the list at that time, so make sure it's truly disabled + */ + g->ops.fifo.disable_channel(ch); nvgpu_rwsem_up_write(&tsg->ch_list_lock); /* -- cgit v1.2.2