[PATCH] implementation of smp test smpmrsp02
--- testsuites/smptests/Makefile.am | 16 ++ testsuites/smptests/configure.ac| 2 + testsuites/smptests/smpmrsp02/init.c| 231 testsuites/smptests/smpmrsp02/smpmrsp02.doc | 15 ++ 4 files changed, 264 insertions(+) create mode 100755 testsuites/smptests/smpmrsp02/init.c create mode 100644 testsuites/smptests/smpmrsp02/smpmrsp02.doc diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am index 38cc87e3c5..edb6478b8f 100644 --- a/testsuites/smptests/Makefile.am +++ b/testsuites/smptests/Makefile.am @@ -314,6 +314,18 @@ smpmrsp01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_smpmrsp01) \ endif endif +if HAS_SMP +if TEST_smpmrsp02 +smp_tests += smpmrsp02 +smp_screens += smpmrsp02/smpmrsp02.scn +smp_docs += smpmrsp02/smpmrsp02.doc +smpmrsp02_SOURCES = smpmrsp02/init.c +smpmrsp02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_smpmrsp02) \ + $(support_includes) +endif +endif + + if HAS_SMP if TEST_smpmulticast01 smp_tests += smpmulticast01 @@ -670,4 +682,8 @@ smpwakeafter01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_smpwakeafter01) \ endif endif + + + noinst_PROGRAMS = $(smp_tests) + diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac index 83b5b9fe41..6336b4e481 100644 --- a/testsuites/smptests/configure.ac +++ b/testsuites/smptests/configure.ac @@ -60,6 +60,7 @@ RTEMS_TEST_CHECK([smplock01]) RTEMS_TEST_CHECK([smpmigration01]) RTEMS_TEST_CHECK([smpmigration02]) RTEMS_TEST_CHECK([smpmrsp01]) +RTEMS_TEST_CHECK([smpmrsp02]) RTEMS_TEST_CHECK([smpmulticast01]) RTEMS_TEST_CHECK([smpmutex01]) RTEMS_TEST_CHECK([smpmutex02]) @@ -93,5 +94,6 @@ RTEMS_TEST_CHECK([smpthreadpin01]) RTEMS_TEST_CHECK([smpunsupported01]) RTEMS_TEST_CHECK([smpwakeafter01]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/testsuites/smptests/smpmrsp02/init.c b/testsuites/smptests/smpmrsp02/init.c new file mode 100755 index 00..c097fde50b --- /dev/null +++ b/testsuites/smptests/smpmrsp02/init.c @@ -0,0 +1,231 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2019 Ricardo Gomes + * + * 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 +#include +#include +#include +#include +#include +#include "tmacros.h" + +const char rtems_test_name[] = "SMPMRSP 2"; + +#define CPU_COUNT 2 + +typedef struct +{ + rtems_id init_id; + rtems_id scheduler_ids[CPU_COUNT]; + rtems_id mrsp_id; + rtems_id task_id; +} test_context; + +static test_context test_instance; + +static void assert_priority(rtems_id task_id, rtems_task_priority priority) +{ + rtems_status_code sc; + rtems_task_priority prio; + + sc = rtems_task_set_priority(task_id, RTEMS_CURRENT_PRIORITY, ); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + rtems_test_assert(priority == prio); +} + +/* + * Verifying if it is possible to define a priority ceiling + * on each scheduler instance + */ +static void create_semaphore(test_context *ctx, rtems_id *id, rtems_task_priority prio) +{ + uint32_t index; + rtems_status_code sc; + + sc = rtems_semaphore_create( + rtems_build_name('M', 'R', 'S', 'P'), + 1, + RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_BINARY_SEMAPHORE, + prio, + id); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + rtems_task_priority old_prio; + + old_prio = 1; + sc = rtems_semaphore_set_priority( + *id, + ctx->scheduler_ids[1], + prio + 1, + _prio); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + + prio = 2; + for (index = 0; index < CPU_COUNT; index++) + { +rtems_task_priority pr = RTEMS_CURRENT_PRIORITY; +sc = rtems_semaphore_set_priority(*id,
MrsP Testbed
Hello Sebastian, >> Greetings, >> >> During the last six months, I have been studying RTEMS as part of my final >> project to complete my degree, more specifically analysing the MrsP >> protocol in >> order to perform an evaluation of its implementation on RTEMS. > I would be great if you can publish the evaluation once it is finished. > Please let me know if you need a > reviewer. >> In order to accomplish this analysis, I developed a set of samples that >> allows >> one to test several properties of MrsP, based its own rules, as described in >> [1], including the use of nested resources, presented in [2]. Beyond that, >> I >> have also adapted those test cases, using OMIP instead of MrsP, in order to >> establish comparisons between both protocols. >> >> So far the set of develop test cases were executed using QEMU, as up to now >> I’m >> not able to execute SMP code in a Raspberry PI 2 (I will address this topic >> with more detail later on another thread). >> >> I wanted to know if: >> >> 1- there is any interest from the community for me to submit these tests to >> the >> RTEMS repository, or at least the ones considered relevant >> >> 2- In case the answer to 1 is affirmative, If I should create a new ticket >> and >> submit the test cases as individual patches. > an independent set of test cases would be good. Currently, the tests and the > implementation are from > the same person. SMP test code in the test suite > must compile and link on all SMP targets. If you plan > to submit the code, > please plan with enough time for some review/change iterations. In first place, yes I want to submit my tests, although how may I assert if my tests compile and link on every SMP targets? >> >> Thank you for your attention. >> >> Best Regards, > >> Ricardo Gomes >> >> >> P.S. After I complete my final report I can make it available if someone is >> interested. > Yes, I am definitely interested. In this email I sending one test for you to review it and see if it is structured according to RTEMS coding conventions, that I tried to fulfill. This test case is very simple, testing only if it is possible to set one priority per scheduling instance and also verifying if, when a task attempt to obtain a MrsP semaphore, its priority is immediately raised to the ceiling priority defined on its scheduler. Best regards, Ricardo Gomes <> /* * Copyright (c) 2019 Ricardo Gomes - CISTER * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * https://www.rtems.org/license/LICENSE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include "tmacros.h" const char rtems_test_name[] = "SMPMRSP 2"; #define CPU_COUNT 2 typedef struct { rtems_id init_id; rtems_id scheduler_ids[CPU_COUNT]; rtems_id mrsp_id; rtems_id task_id; } test_context; static test_context test_instance; static void assert_priority(rtems_id task_id, rtems_task_priority priority) { rtems_status_code sc; rtems_task_priority prio; sc = rtems_task_set_priority(task_id, RTEMS_CURRENT_PRIORITY, ); rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_test_assert(priority == prio); } static void create_mrsp_semaphore(test_context *ctx, rtems_id *id, rtems_task_priority prio) { uint32_t cpu_count = rtems_get_processor_count(); uint32_t index; rtems_status_code sc; sc = rtems_semaphore_create( rtems_build_name('M', 'R', 'S', 'P'), 1, RTEMS_MULTIPROCESSOR_RESOURCE_SHARING | RTEMS_BINARY_SEMAPHORE, prio, id); rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_task_priority old_prio; old_prio = 1; sc = rtems_semaphore_set_priority( *id, ctx->scheduler_ids[1], prio + 1, _prio); rtems_test_assert(sc == RTEMS_SUCCESSFUL); prio = 2; for (index = 0; index < cpu_count; index++) { rtems_task_priority pr = RTEMS_CURRENT_PRIORITY; sc = rtems_semaphore_set_priority(*id, ctx->scheduler_ids[index], pr, ); rtems_test_assert(sc == RTEMS_SUCCESSFUL); rtems_test_assert(prio == pr); printf("CPU %d ceiling priority = %" PRIu32 "\n", index, pr); prio++; } } static void test_prio_per_proc(test_context *ctx) { printf("\n\n--TESTING IF THERE IS ONE CEILING PER PROCESSOR--\n\n"); rtems_task_priority prio = 2; create_mrsp_semaphore(ctx, >mrsp_id, prio); printf("\n-\n"); } static void high_task_prio_obtain(rtems_task_argument arg) { test_context *ctx = _instance; printf("TASK - before obtain should the prio should be 6\n"); assert_priority(RTEMS_SELF, 6); rtems_status_code sc = rtems_semaphore_obtain(ctx->mrsp_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); rtems_test_assert(sc == RTEMS_SUCCESSFUL); printf("TASK - after obtain should the prio should be 3\n"); assert_priority(RTEMS_SELF, 3); sc = rtems_semaphore_release(ctx->mrsp_id);
MrsP Testbed
Greetings, During the last six months, I have been studying RTEMS as part of my final project to complete my degree, more specifically analysing the MrsP protocol in order to perform an evaluation of its implementation on RTEMS. In order to accomplish this analysis, I developed a set of samples that allows one to test several properties of MrsP, based its own rules, as described in [1], including the use of nested resources, presented in [2]. Beyond that, I have also adapted those test cases, using OMIP instead of MrsP, in order to establish comparisons between both protocols. So far the set of develop test cases were executed using QEMU, as up to now I’m not able to execute SMP code in a Raspberry PI 2 (I will address this topic with more detail later on another thread). I wanted to know if: 1- there is any interest from the community for me to submit these tests to the RTEMS repository, or at least the ones considered relevant 2- In case the answer to 1 is affirmative, If I should create a new ticket and submit the test cases as individual patches. Thank you for your attention. Best Regards, Ricardo Gomes P.S. After I complete my final report I can make it available if someone is interested. References: [1] Alan Burns, Andy Wellings, “A schedulability Compatible Multiprocessos Resource Sharing Protocol - MrsP,” . In: 25th Euromicro Conference on Real-Time Systems (ECRTS) (2013) [2] B. Brandenburg, “A Fully Preemptive Multiprocessor Semaphore Protocol for Latency-Sensitive Real-Time Applications,” in Proceedings of the 25th Euromicro Conference on Real-Time Systems (ECRTS), Paris, 2013. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
RTEMS SMP on Raspberry Pi 2
Hello everyone, I'm trying to collect some results of some experiments that I'm doing related with synchronization mechanisms for SMPs. So far, I have the results for QEMU but I'm trying to use a Raspberry Pi 2 to obtain results in real hardware. I saw the new patches that were recently added for the raspberry pi bsp and as mentioned in the emails related to the new patches I changed the start address to 0x20. However, I have a problem running my samples in the board. The kernel compiles without any problem. I'm using the following commands to compile it: arm-rtems5-objcopy -Obinary Now the issue occurs when I try to execute my tests for SMP, as the kernel freezes during the boot loader first stage. As a side note, when I compile and execute something para single processor na RPi2 I don't have any issue. The issue only occurs when dealing with SMP. Can someone help me in figuring out what I'm doing wrong? Thanks in advance. Regards, ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel