aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/CMakeLists.txt2
-rw-r--r--kernel/kapi/devices/bus.cpp12
-rw-r--r--kernel/kapi/devices/bus.stress.cpp2
3 files changed, 10 insertions, 6 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index a97c1e4a..c93fe9c9 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -191,7 +191,7 @@ if(BUILD_TESTING)
CXX_CLANG_TIDY ""
)
- if(COMMAND "enable_coverage")
+ if(COMMAND "enable_coverage" AND NOT TEACHOS_ENABLE_TEST_TSAN)
enable_coverage("kernel_lib")
enable_coverage("kernel_tests")
endif()
diff --git a/kernel/kapi/devices/bus.cpp b/kernel/kapi/devices/bus.cpp
index 71dd01e6..2b94e486 100644
--- a/kernel/kapi/devices/bus.cpp
+++ b/kernel/kapi/devices/bus.cpp
@@ -11,7 +11,6 @@
#include <kstd/vector.hpp>
#include <algorithm>
-#include <span>
#include <utility>
namespace kapi::devices
@@ -36,7 +35,10 @@ namespace kapi::devices
auto bus::add_child(kstd::shared_ptr<device> child) -> void
{
- child->set_parent(kstd::static_pointer_cast<bus>(shared_from_this()));
+ {
+ auto guard = kstd::lock_guard{m_lock};
+ child->set_parent(kstd::static_pointer_cast<bus>(shared_from_this()));
+ }
if (!kapi::devices::device_registry::get().add(child))
{
@@ -74,9 +76,11 @@ namespace kapi::devices
return true;
}
- [[nodiscard]] auto bus::children() const -> std::span<kstd::shared_ptr<device> const>
+ [[nodiscard]] auto bus::children() const -> kstd::vector<kstd::shared_ptr<device>>
{
- return {m_devices.data(), m_devices.size()};
+ auto guard = kstd::lock_guard{m_lock};
+
+ return m_devices;
}
auto bus::query_facet(kapi::capabilities::facet_id facet) -> void *
diff --git a/kernel/kapi/devices/bus.stress.cpp b/kernel/kapi/devices/bus.stress.cpp
index 226b0296..3fefc892 100644
--- a/kernel/kapi/devices/bus.stress.cpp
+++ b/kernel/kapi/devices/bus.stress.cpp
@@ -21,7 +21,7 @@ namespace
} // namespace
-constexpr auto thread_count = 32;
+constexpr auto thread_count = 8;
constexpr auto devices_per_thread = 200;
SCENARIO("Concurrent attach/detach/lookup on a bus is race-free")