mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Fix data race for TLB flush check
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
fe73c06b59
commit
2102117e12
@@ -105,21 +105,25 @@ struct DrmMemoryOperationsHandlerBindFixture : public ::testing::Test {
|
||||
using DrmMemoryOperationsHandlerBindMultiRootDeviceTest = DrmMemoryOperationsHandlerBindFixture<2u>;
|
||||
|
||||
TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoundToVMThenAllContextsUsingThatVMHasSetNewResourceBound) {
|
||||
struct MockOsContextLinux : OsContextLinux {
|
||||
using OsContextLinux::lastFlushedTlbFlushCounter;
|
||||
};
|
||||
|
||||
mock->setNewResourceBoundToVM(1u);
|
||||
|
||||
for (const auto &engine : device->getAllEngines()) {
|
||||
auto osContexLinux = static_cast<OsContextLinux *>(engine.osContext);
|
||||
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
|
||||
if (osContexLinux->getDeviceBitfield().test(1u)) {
|
||||
EXPECT_TRUE(osContexLinux->getNewResourceBound());
|
||||
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
|
||||
} else {
|
||||
EXPECT_FALSE(osContexLinux->getNewResourceBound());
|
||||
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
|
||||
}
|
||||
|
||||
osContexLinux->setNewResourceBound(false);
|
||||
osContexLinux->lastFlushedTlbFlushCounter.store(osContexLinux->peekTlbFlushCounter());
|
||||
}
|
||||
for (const auto &engine : devices[1]->getAllEngines()) {
|
||||
auto osContexLinux = static_cast<OsContextLinux *>(engine.osContext);
|
||||
EXPECT_FALSE(osContexLinux->getNewResourceBound());
|
||||
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
|
||||
}
|
||||
|
||||
auto mock2 = executionEnvironment->rootDeviceEnvironments[1u]->osInterface->getDriverModel()->as<DrmQueryMock>();
|
||||
@@ -128,14 +132,14 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
|
||||
for (const auto &engine : devices[1]->getAllEngines()) {
|
||||
auto osContexLinux = static_cast<OsContextLinux *>(engine.osContext);
|
||||
if (osContexLinux->getDeviceBitfield().test(0u)) {
|
||||
EXPECT_TRUE(osContexLinux->getNewResourceBound());
|
||||
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
|
||||
} else {
|
||||
EXPECT_FALSE(osContexLinux->getNewResourceBound());
|
||||
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
|
||||
}
|
||||
}
|
||||
for (const auto &engine : device->getAllEngines()) {
|
||||
auto osContexLinux = static_cast<OsContextLinux *>(engine.osContext);
|
||||
EXPECT_FALSE(osContexLinux->getNewResourceBound());
|
||||
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user