From 59168e2ae344cdbfd52f9864812c73aa46ad0c42 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 29 Jul 2021 08:05:26 +0200 Subject: score: Split SMP multicast action module Split up the SMP multicast action module since the use of the SMP multicast action variants depend on the architecture and BSP. --- cpukit/Makefile.am | 3 ++ cpukit/score/src/smpbroadcastaction.c | 49 ++++++++++++++++++++++++++++++++ cpukit/score/src/smpmulticastaction.c | 33 +--------------------- cpukit/score/src/smpothercastaction.c | 53 +++++++++++++++++++++++++++++++++++ cpukit/score/src/smpsynchronize.c | 51 +++++++++++++++++++++++++++++++++ spec/build/cpukit/objsmp.yml | 3 ++ 6 files changed, 160 insertions(+), 32 deletions(-) create mode 100644 cpukit/score/src/smpbroadcastaction.c create mode 100644 cpukit/score/src/smpothercastaction.c create mode 100644 cpukit/score/src/smpsynchronize.c diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am index 5673c4e8fb..dfa5fb2412 100644 --- a/cpukit/Makefile.am +++ b/cpukit/Makefile.am @@ -1160,8 +1160,11 @@ librtemscpu_a_SOURCES += score/src/schedulerprioritysmp.c librtemscpu_a_SOURCES += score/src/schedulersimplesmp.c librtemscpu_a_SOURCES += score/src/schedulerstrongapa.c librtemscpu_a_SOURCES += score/src/smp.c +librtemscpu_a_SOURCES += score/src/smpbroadcastaction.c librtemscpu_a_SOURCES += score/src/smplock.c librtemscpu_a_SOURCES += score/src/smpmulticastaction.c +librtemscpu_a_SOURCES += score/src/smpothercastaction.c +librtemscpu_a_SOURCES += score/src/smpsychronize.c librtemscpu_a_SOURCES += score/src/smpunicastaction.c librtemscpu_a_SOURCES += score/src/schedulerdefaultaskforhelp.c librtemscpu_a_SOURCES += score/src/schedulerdefaultsetaffinity.c diff --git a/cpukit/score/src/smpbroadcastaction.c b/cpukit/score/src/smpbroadcastaction.c new file mode 100644 index 0000000000..767c6d4c7e --- /dev/null +++ b/cpukit/score/src/smpbroadcastaction.c @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSScoreSMP + * + * @brief This source file contains the implementation of + * _SMP_Broadcast_action(). + */ + +/* + * Copyright (C) 2019 embedded brains GmbH + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +void _SMP_Broadcast_action( + SMP_Action_handler handler, + void *arg +) +{ + _SMP_Multicast_action( _SMP_Get_online_processors(), handler, arg ); +} diff --git a/cpukit/score/src/smpmulticastaction.c b/cpukit/score/src/smpmulticastaction.c index 03d9e064fe..6b9e9a30db 100644 --- a/cpukit/score/src/smpmulticastaction.c +++ b/cpukit/score/src/smpmulticastaction.c @@ -6,8 +6,7 @@ * @ingroup RTEMSScoreSMP * * @brief This source file contains the implementation of - * _SMP_Broadcast_action(), _SMP_Multicast_action(), _SMP_Othercast_action(), - * and _SMP_Synchronize(). + * _SMP_Multicast_action(). */ /* @@ -108,33 +107,3 @@ void _SMP_Multicast_action( _SMP_Issue_action_jobs( targets, &jobs, cpu_max ); _SMP_Wait_for_action_jobs( targets, &jobs, cpu_max ); } - -void _SMP_Broadcast_action( - SMP_Action_handler handler, - void *arg -) -{ - _SMP_Multicast_action( _SMP_Get_online_processors(), handler, arg ); -} - -void _SMP_Othercast_action( - SMP_Action_handler handler, - void *arg -) -{ - Processor_mask targets; - - _Processor_mask_Assign( &targets, _SMP_Get_online_processors() ); - _Processor_mask_Clear( &targets, _SMP_Get_current_processor() ); - _SMP_Multicast_action( &targets, handler, arg ); -} - -static void _SMP_Do_nothing_action( void *arg ) -{ - /* Do nothing */ -} - -void _SMP_Synchronize( void ) -{ - _SMP_Othercast_action( _SMP_Do_nothing_action, NULL ); -} diff --git a/cpukit/score/src/smpothercastaction.c b/cpukit/score/src/smpothercastaction.c new file mode 100644 index 0000000000..4279c4bf54 --- /dev/null +++ b/cpukit/score/src/smpothercastaction.c @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSScoreSMP + * + * @brief This source file contains the implementation of + * _SMP_Othercast_action(). + */ + +/* + * Copyright (C) 2019 embedded brains GmbH + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +void _SMP_Othercast_action( + SMP_Action_handler handler, + void *arg +) +{ + Processor_mask targets; + + _Processor_mask_Assign( &targets, _SMP_Get_online_processors() ); + _Processor_mask_Clear( &targets, _SMP_Get_current_processor() ); + _SMP_Multicast_action( &targets, handler, arg ); +} diff --git a/cpukit/score/src/smpsynchronize.c b/cpukit/score/src/smpsynchronize.c new file mode 100644 index 0000000000..d01a15cb28 --- /dev/null +++ b/cpukit/score/src/smpsynchronize.c @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSScoreSMP + * + * @brief This source file contains the implementation of + * _SMP_Synchronize(). + */ + +/* + * Copyright (C) 2019 embedded brains GmbH + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +static void _SMP_Do_nothing_action( void *arg ) +{ + /* Do nothing */ +} + +void _SMP_Synchronize( void ) +{ + _SMP_Othercast_action( _SMP_Do_nothing_action, NULL ); +} diff --git a/spec/build/cpukit/objsmp.yml b/spec/build/cpukit/objsmp.yml index 992ed50666..ef7b331a6f 100644 --- a/spec/build/cpukit/objsmp.yml +++ b/spec/build/cpukit/objsmp.yml @@ -23,9 +23,12 @@ source: - cpukit/score/src/schedulersmp.c - cpukit/score/src/schedulersmpstartidle.c - cpukit/score/src/schedulerstrongapa.c +- cpukit/score/src/smpbroadcastaction.c - cpukit/score/src/smp.c - cpukit/score/src/smplock.c - cpukit/score/src/smpmulticastaction.c +- cpukit/score/src/smpothercastaction.c +- cpukit/score/src/smpsynchronize.c - cpukit/score/src/smpunicastaction.c - cpukit/score/src/threadunpin.c type: build -- cgit v1.2.3