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
<<attachment: smpmrsp02.doc>>
/* * 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 <sys/param.h> #include <stdio.h> #include <inttypes.h> #include <rtems.h> #include <rtems/libcsupport.h> #include <rtems/score/schedulersmpimpl.h> #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, &prio); 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, &old_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, &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, &ctx->mrsp_id, prio); printf("\n-------------------------------------------------\n"); } static void high_task_prio_obtain(rtems_task_argument arg) { test_context *ctx = &test_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); rtems_test_assert(sc == RTEMS_SUCCESSFUL); printf("TASK - after release should the prio should be 6\n"); assert_priority(RTEMS_SELF, 6); rtems_task_exit(); printf("\n-------------------------------------------------\n"); } static void test_prio_raise(test_context *ctx) { printf("\n\n--TESTING IF THERE IS PRIORITY RAISE OBTAINING THE RESOURCE PER PROCESSOR--\n\n"); rtems_status_code sc = rtems_task_create( rtems_build_name('T', 'A', 'S', 'K'), 6, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &ctx->task_id); rtems_test_assert(sc == RTEMS_SUCCESSFUL); sc = rtems_task_set_scheduler(ctx->task_id, ctx->scheduler_ids[1], 6); rtems_test_assert(sc == RTEMS_SUCCESSFUL); printf("INIT- OBTAINS THE RESOURCE \n\n"); sc = rtems_semaphore_obtain(ctx->mrsp_id, RTEMS_WAIT, RTEMS_NO_TIMEOUT); rtems_test_assert(sc == RTEMS_SUCCESSFUL); sc = rtems_task_start(ctx->task_id, high_task_prio_obtain, 0); rtems_test_assert(sc == RTEMS_SUCCESSFUL); sc = rtems_task_wake_after(2 * rtems_clock_get_ticks_per_second()); rtems_test_assert(sc == RTEMS_SUCCESSFUL); printf("TASK PRIORITY TRYING TO GAIN ACCES ON SCHED 1, the PRIORITY SHOULD BE 3\n"); assert_priority(ctx->task_id, 3); printf("\nINIT- RELEASES THE RESOURCE \n\n"); sc = rtems_semaphore_release(ctx->mrsp_id); rtems_test_assert(sc == RTEMS_SUCCESSFUL); sc = rtems_task_wake_after(5 * rtems_clock_get_ticks_per_second()); rtems_test_assert(sc == RTEMS_SUCCESSFUL); } static void Init(rtems_task_argument arg) { TEST_BEGIN(); test_context *ctx = &test_instance; uint32_t cpu_count = rtems_get_processor_count(); uint32_t cpu_index; rtems_status_code sc; ctx->init_id = rtems_task_self(); for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) { sc = rtems_scheduler_ident(cpu_index, &ctx->scheduler_ids[cpu_index]); rtems_test_assert(sc == RTEMS_SUCCESSFUL); } sc = rtems_task_set_scheduler(RTEMS_SELF, ctx->scheduler_ids[0], 4); rtems_test_assert(sc == RTEMS_SUCCESSFUL); test_prio_per_proc(ctx); test_prio_raise(ctx); TEST_END(); rtems_test_exit(0); } #define CONFIGURE_MICROSECONDS_PER_TICK 1000 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER #define CONFIGURE_MAXIMUM_TASKS 2 #define CONFIGURE_MAXIMUM_SEMAPHORES 1 #define CONFIGURE_MAXIMUM_PROCESSORS CPU_COUNT #define CONFIGURE_SCHEDULER_SIMPLE_SMP #include <rtems/scheduler.h> RTEMS_SCHEDULER_SIMPLE_SMP(0); RTEMS_SCHEDULER_SIMPLE_SMP(1); #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \ RTEMS_SCHEDULER_TABLE_SIMPLE_SMP(0, 0), \ RTEMS_SCHEDULER_TABLE_SIMPLE_SMP(1, 1), #define CONFIGURE_SCHEDULER_ASSIGNMENTS \ RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \ RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) #define CONFIGURE_INIT_TASK_NAME rtems_build_name('M', 'A', 'I', 'N') #define CONFIGURE_INIT_TASK_PRIORITY 4 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE #define CONFIGURE_INIT #include <rtems/confdefs.h>
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel