From cd69840685d892d134e13ece4d7913fb7ebb61b7 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 16 Feb 2023 00:26:24 +0100 Subject: [PATCH] Cosmetics around the creation of the VM model --- src/kernel/resource/VirtualMachineImpl.cpp | 3 ++- src/kernel/routing/NetZoneImpl.cpp | 15 ++------------- src/surf/surf_interface.hpp | 9 +-------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/kernel/resource/VirtualMachineImpl.cpp b/src/kernel/resource/VirtualMachineImpl.cpp index 8a3365a4f8..5bff857496 100644 --- a/src/kernel/resource/VirtualMachineImpl.cpp +++ b/src/kernel/resource/VirtualMachineImpl.cpp @@ -19,8 +19,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_vm, ker_resource, "Virtual Machines, containing actors and mobile across hosts"); -void surf_vm_model_init_HL13(simgrid::kernel::resource::CpuModel* cpu_pm_model) +void surf_vm_model_init_HL13() { + auto* cpu_pm_model = simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->get_cpu_pm_model().get(); auto vm_model = std::make_shared("VM_HL13"); auto* engine = simgrid::kernel::EngineImpl::get_instance(); diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 404709eb59..57db71f7c6 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -24,18 +24,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_platform, kernel, "Kernel platform-related i namespace simgrid::kernel::routing { -/* Pick the right models for CPU, net and host, and call their model_init_preparse */ -static void surf_config_models_setup() -{ - simgrid_host_models().init_from_flag_value(); - - XBT_DEBUG("Call vm_model_init"); - /* TODO: ideally we should get back the pointer to CpuModel from init(), but this - * requires changing the declaration of the ModuleGroup returned by simgrid_cpu_models() */ - surf_vm_model_init_HL13( - simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->get_cpu_pm_model().get()); -} - xbt::signal const& link_list)> @@ -60,7 +48,8 @@ NetZoneImpl::NetZoneImpl(const std::string& name) : piface_(this), name_(name) * (FIXME: check it out by creating a file beginning with one of these tags) * but cluster and peer come down to zone creations, so putting this verification here is correct. */ - surf_config_models_setup(); + simgrid_host_models().init_from_flag_value(); + surf_vm_model_init_HL13(); } xbt_enforce(nullptr == engine->netpoint_by_name_or_null(get_name()), diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index fc3a307a84..32289c342f 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -63,14 +63,7 @@ static inline int double_equals(double value1, double value2, double precision) return (fabs(value1 - value2) < precision); } -/** @ingroup SURF_models - * @brief Initializes the VM model used in the platform - * - * A VM model depends on the physical CPU model to share the resources inside the VM - * It will also creates the CPU model for actions running inside the VM - * - */ -XBT_PUBLIC void surf_vm_model_init_HL13(simgrid::kernel::resource::CpuModel* cpu_pm_model); +XBT_PUBLIC void surf_vm_model_init_HL13(); /* -------------------- * Model Descriptions -- 2.20.1