mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
fix: lock csr before locking residency controller in trim to budget path
Lock on csr is needed before lock on residency controller to prevent incorrect lock order. Csr may be locked in waitOnCpu called from trimToBudget, which may lead to deadlocks Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4f308b2ea9
commit
a5e19330e9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,6 +11,7 @@
|
||||
namespace NEO {
|
||||
class MockWddmResidencyController : public WddmResidencyController {
|
||||
public:
|
||||
using WddmResidencyController::csr;
|
||||
using WddmResidencyController::lastTrimFenceValue;
|
||||
using WddmResidencyController::lock;
|
||||
using WddmResidencyController::trimCallbackHandle;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -748,6 +748,15 @@ TEST_F(WddmResidencyControllerLockTest, givenTrimToBudgetWhenTrimmingResidencyTh
|
||||
EXPECT_EQ(1u, residencyController->acquireLockCallCount);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmResidencyControllerLockTest, givenTrimToBudgetWhenTrimmingToBudgetThenLockCsr) {
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.TrimToBudget = 1;
|
||||
trimNotification.NumBytesToTrim = 0;
|
||||
|
||||
residencyController->trimResidency(trimNotification.Flags, trimNotification.NumBytesToTrim);
|
||||
EXPECT_EQ(1u, static_cast<UltCommandStreamReceiver<FamilyType> *>(residencyController->csr)->recursiveLockCounter);
|
||||
}
|
||||
|
||||
TEST_F(WddmResidencyControllerLockTest, givenPeriodicTrimAndTrimToBudgetWhenTrimmingResidencyThenLockTwice) {
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.PeriodicTrim = 1;
|
||||
|
||||
Reference in New Issue
Block a user