Changeset 5fa893e in rtems


Ignore:
Timestamp:
May 20, 2019, 7:15:36 AM (5 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
327e45da
Parents:
41cddcc
git-author:
Sebastian Huber <sebastian.huber@…> (05/20/19 07:15:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/20/19 07:31:25)
Message:

score: Add _SMP_Unicast_action()

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/Makefile.am

    r41cddcc r5fa893e  
    11191119librtemscpu_a_SOURCES += score/src/smplock.c
    11201120librtemscpu_a_SOURCES += score/src/smpmulticastaction.c
     1121librtemscpu_a_SOURCES += score/src/smpunicastaction.c
    11211122librtemscpu_a_SOURCES += score/src/schedulerdefaultaskforhelp.c
    11221123librtemscpu_a_SOURCES += score/src/schedulerdefaultsetaffinity.c
  • cpukit/include/rtems/score/smpimpl.h

    r41cddcc r5fa893e  
    262262
    263263/**
     264 * @brief Initiates an SMP action on the specified target processor.
     265 *
     266 * This is an optimized variant of _SMP_Multicast_action().
     267 *
     268 * @param cpu_index The index of the target processor.
     269 * @param handler The action handler.
     270 * @param arg The action argument.
     271 */
     272void _SMP_Unicast_action(
     273  uint32_t            cpu_index,
     274  SMP_Action_handler  handler,
     275  void               *arg
     276);
     277
     278/**
    264279 * @brief Ensures that all store operations issued by the current processor
    265280 * before the call this function are visible to all other online processors.
  • testsuites/smptests/smpmulticast01/init.c

    r41cddcc r5fa893e  
    6060}
    6161
     62static void unicast_action_irq_disabled(
     63  uint32_t cpu_index,
     64  SMP_Action_handler handler,
     65  void *arg
     66)
     67{
     68  rtems_interrupt_level level;
     69
     70  rtems_interrupt_local_disable(level);
     71  _SMP_Unicast_action(cpu_index, handler, arg);
     72  rtems_interrupt_local_enable(level);
     73}
     74
     75static void unicast_action_dispatch_disabled(
     76  uint32_t cpu_index,
     77  SMP_Action_handler handler,
     78  void *arg
     79)
     80{
     81  Per_CPU_Control *cpu_self;
     82
     83  cpu_self = _Thread_Dispatch_disable();
     84  _SMP_Unicast_action(cpu_index, handler, arg);
     85  _Thread_Dispatch_enable(cpu_self);
     86}
     87
    6288static void multicast_action_irq_disabled(
    6389  const Processor_mask *targets,
     
    132158static void test_unicast(
    133159  test_context *ctx,
    134   void (*multicast_action)(const Processor_mask *, SMP_Action_handler, void *)
     160  void (*unicast_action)(uint32_t, SMP_Action_handler, void *)
    135161)
    136162{
     
    144170
    145171  for (i = 0; i < n; ++i) {
    146     Processor_mask cpus;
    147172    uint32_t j;
    148173
    149174    clear_ids_by_worker(ctx, 0);
    150175
    151     _Processor_mask_Zero(&cpus);
    152     _Processor_mask_Set(&cpus, i);
    153     (*multicast_action)(&cpus, action, &ctx->id[0][0]);
     176    (*unicast_action)(i, action, &ctx->id[0][0]);
    154177
    155178    for (j = 0; j < n; ++j) {
     
    170193}
    171194
     195static void test_multicast(
     196  test_context *ctx,
     197  void (*multicast_action)(const Processor_mask *, SMP_Action_handler, void *)
     198)
     199{
     200  uint32_t step;
     201  uint32_t i;
     202  uint32_t n;
     203
     204  T_plan(1);
     205  step = 0;
     206  n = rtems_scheduler_get_processor_maximum();
     207
     208  for (i = 0; i < n; ++i) {
     209    Processor_mask cpus;
     210    uint32_t j;
     211
     212    clear_ids_by_worker(ctx, 0);
     213
     214    _Processor_mask_Zero(&cpus);
     215    _Processor_mask_Set(&cpus, i);
     216    (*multicast_action)(&cpus, action, &ctx->id[0][0]);
     217
     218    for (j = 0; j < n; ++j) {
     219      unsigned id;
     220
     221      ++step;
     222      id = _Atomic_Load_uint(&ctx->id[0][j], ATOMIC_ORDER_RELAXED);
     223
     224      if (j == i) {
     225        T_quiet_eq_uint(j + 1, id);
     226      } else {
     227        T_quiet_eq_uint(0, id);
     228      }
     229    }
     230  }
     231
     232  T_step_eq_u32(0, step, n * n);
     233}
     234
    172235static void test_broadcast(
    173236  test_context *ctx,
     
    272335
    273336  T_case_begin("UnicastBeforeMultitasking", NULL);
    274   test_unicast(ctx, _SMP_Multicast_action);
     337  test_unicast(ctx, _SMP_Unicast_action);
    275338  T_case_end();
    276339
    277340  T_case_begin("UnicastBeforeMultitaskingIRQDisabled", NULL);
    278   test_unicast(ctx, multicast_action_irq_disabled);
     341  test_unicast(ctx, unicast_action_irq_disabled);
    279342  T_case_end();
    280343
    281344  T_case_begin("UnicastBeforeMultitaskingDispatchDisabled", NULL);
    282   test_unicast(ctx, multicast_action_dispatch_disabled);
     345  test_unicast(ctx, unicast_action_dispatch_disabled);
     346  T_case_end();
     347
     348  T_case_begin("MulticastBeforeMultitasking", NULL);
     349  test_multicast(ctx, _SMP_Multicast_action);
     350  T_case_end();
     351
     352  T_case_begin("MulticastBeforeMultitaskingIRQDisabled", NULL);
     353  test_multicast(ctx, multicast_action_irq_disabled);
     354  T_case_end();
     355
     356  T_case_begin("MulticastBeforeMultitaskingDispatchDisabled", NULL);
     357  test_multicast(ctx, multicast_action_dispatch_disabled);
    283358  T_case_end();
    284359
     
    438513T_TEST_CASE(UnicastDuringMultitaskingIRQDisabled)
    439514{
    440   test_unicast(&test_instance, multicast_action_irq_disabled);
     515  test_unicast(&test_instance, unicast_action_irq_disabled);
    441516}
    442517
    443518T_TEST_CASE(UnicastDuringMultitaskingDispatchDisabled)
    444519{
    445   test_unicast(&test_instance, multicast_action_dispatch_disabled);
     520  test_unicast(&test_instance, unicast_action_dispatch_disabled);
     521}
     522
     523T_TEST_CASE(MulticastDuringMultitaskingIRQDisabled)
     524{
     525  test_multicast(&test_instance, multicast_action_irq_disabled);
     526}
     527
     528T_TEST_CASE(MulticastDuringMultitaskingDispatchDisabled)
     529{
     530  test_multicast(&test_instance, multicast_action_dispatch_disabled);
    446531}
    447532
  • testsuites/smptests/smpmulticast01/smpmulticast01.scn

    r41cddcc r5fa893e  
    11*** BEGIN OF TEST SMPMULTICAST 1 ***
    2 *** TEST VERSION: 5.0.0.d9c9d1af7a885bc402c57e88919635b27b363111
     2*** TEST VERSION: 5.0.0.41cddcc6e194be27d1e4125b961acb94e278552b
    33*** TEST STATE: EXPECTED-PASS
    44*** TEST BUILD: RTEMS_POSIX_API RTEMS_SMP
    5 *** TEST TOOLS: 7.4.0 20181206 (RTEMS 5, RSB e0aec65182449a4e22b820e773087636edaf5b32, Newlib 1d35a003f)
     5*** TEST TOOLS: 7.4.1 20190514 (RTEMS 5, RSB 7a80d6ced664748e66904cd98250f6a9c727361b, Newlib 1d35a003f)
    66A:SMPMultiCast
    77S:Platform:RTEMS
    8 S:Compiler:7.4.0 20181206 (RTEMS 5, RSB e0aec65182449a4e22b820e773087636edaf5b32, Newlib 1d35a003f)
    9 S:Version:5.0.0.d9c9d1af7a885bc402c57e88919635b27b363111
    10 S:BSP:qoriq_e6500_32
    11 S:RTEMS_DEBUG:0
     8S:Compiler:7.4.1 20190514 (RTEMS 5, RSB 7a80d6ced664748e66904cd98250f6a9c727361b, Newlib 1d35a003f)
     9S:Version:5.0.0.39862d4adf604fb4dccf3a852d66fe5b71966c47-modified
     10S:BSP:leon3
     11S:RTEMS_DEBUG:1
    1212S:RTEMS_MULTIPROCESSING:0
    1313S:RTEMS_POSIX_API:1
     
    1515S:RTEMS_SMP:1
    1616B:UnicastBeforeMultitasking
    17 P:0:0:IDLE:init.c:142
    18 E:UnicastBeforeMultitasking:N:1:F:0:D:0.002206
     17P:0:0:IDLE:init.c:192
     18E:UnicastBeforeMultitasking:N:1:F:0:D:0.000118
    1919B:UnicastBeforeMultitaskingIRQDisabled
    20 P:0:0:IDLE:init.c:142
    21 E:UnicastBeforeMultitaskingIRQDisabled:N:1:F:0:D:0.002184
     20P:0:0:IDLE:init.c:192
     21E:UnicastBeforeMultitaskingIRQDisabled:N:1:F:0:D:0.000121
    2222B:UnicastBeforeMultitaskingDispatchDisabled
    23 P:0:0:IDLE:init.c:142
    24 E:UnicastBeforeMultitaskingDispatchDisabled:N:1:F:0:D:0.002198
     23P:0:0:IDLE:init.c:192
     24E:UnicastBeforeMultitaskingDispatchDisabled:N:1:F:0:D:0.000123
     25B:MulticastBeforeMultitasking
     26P:0:0:IDLE:init.c:232
     27E:MulticastBeforeMultitasking:N:1:F:0:D:0.000126
     28B:MulticastBeforeMultitaskingIRQDisabled
     29P:0:0:IDLE:init.c:232
     30E:MulticastBeforeMultitaskingIRQDisabled:N:1:F:0:D:0.000126
     31B:MulticastBeforeMultitaskingDispatchDisabled
     32P:0:0:IDLE:init.c:232
     33E:MulticastBeforeMultitaskingDispatchDisabled:N:1:F:0:D:0.000129
    2534B:BroadcastBeforeMultitasking
    26 P:0:0:IDLE:init.c:174
    27 E:BroadcastBeforeMultitasking:N:1:F:0:D:0.004153
     35P:0:0:IDLE:init.c:264
     36E:BroadcastBeforeMultitasking:N:1:F:0:D:0.000180
    2837B:BroadcastBeforeMultitaskingIRQDisabled
    29 P:0:0:IDLE:init.c:174
    30 E:BroadcastBeforeMultitaskingIRQDisabled:N:1:F:0:D:0.004135
     38P:0:0:IDLE:init.c:264
     39E:BroadcastBeforeMultitaskingIRQDisabled:N:1:F:0:D:0.000180
    3140B:BroadcastBeforeMultitaskingDispatchDisabled
    32 P:0:0:IDLE:init.c:174
    33 E:BroadcastBeforeMultitaskingDispatchDisabled:N:1:F:0:D:0.004123
    34 B:UnicastDuringMultitasking
    35 P:0:23:UI1:init.c:142
    36 E:UnicastDuringMultitasking:N:1:F:0:D:0.002270
     41P:0:0:IDLE:init.c:264
     42E:BroadcastBeforeMultitaskingDispatchDisabled:N:1:F:0:D:0.000187
    3743B:UnicastDuringMultitaskingIRQDisabled
    38 P:0:23:UI1:init.c:142
    39 E:UnicastDuringMultitaskingIRQDisabled:N:1:F:0:D:0.002272
     44P:0:3:UI1:init.c:192
     45E:UnicastDuringMultitaskingIRQDisabled:N:1:F:0:D:0.000150
    4046B:UnicastDuringMultitaskingDispatchDisabled
    41 P:0:23:UI1:init.c:142
    42 E:UnicastDuringMultitaskingDispatchDisabled:N:1:F:0:D:0.002271
    43 B:BroadcastDuringMultitasking
    44 P:0:23:UI1:init.c:174
    45 E:BroadcastDuringMultitasking:N:1:F:0:D:0.003904
     47P:0:3:UI1:init.c:192
     48E:UnicastDuringMultitaskingDispatchDisabled:N:1:F:0:D:0.000154
     49B:ParallelBroadcast
     50E:ParallelBroadcast:N:0:F:0:D:3.995722
     51B:MulticastDuringMultitaskingIRQDisabled
     52P:0:0:UI1:init.c:232
     53E:MulticastDuringMultitaskingIRQDisabled:N:1:F:0:D:0.000154
     54B:MulticastDuringMultitaskingDispatchDisabled
     55P:0:0:UI1:init.c:232
     56E:MulticastDuringMultitaskingDispatchDisabled:N:1:F:0:D:0.000157
     57B:JobOrder
     58P:0:0:UI1:init.c:467
     59P:1:0:ISR:init.c:435
     60P:2:0:ISR:init.c:440
     61P:3:0:ISR:init.c:445
     62E:JobOrder:N:4:F:0:D:0.000259
    4663B:BroadcastDuringMultitaskingIRQDisabled
    47 P:0:23:UI1:init.c:174
    48 E:BroadcastDuringMultitaskingIRQDisabled:N:1:F:0:D:0.003949
     64P:0:0:UI1:init.c:264
     65E:BroadcastDuringMultitaskingIRQDisabled:N:1:F:0:D:0.000228
    4966B:BroadcastDuringMultitaskingDispatchDisabled
    50 P:0:23:UI1:init.c:174
    51 E:BroadcastDuringMultitaskingDispatchDisabled:N:1:F:0:D:0.003914
     67P:0:0:UI1:init.c:264
     68E:BroadcastDuringMultitaskingDispatchDisabled:N:1:F:0:D:0.000244
     69B:AddJobInJob
     70P:0:0:UI1:init.c:506
     71P:1:0:ISR:init.c:478
     72P:2:0:UI1:init.c:508
     73P:3:0:ISR:init.c:484
     74E:AddJobInJob:N:4:F:0:D:0.000267
    5275B:WrongCPUStateToPerformJobs
    53 P:0:0:ISR:init.c:226
    54 P:1:23:UI1:init.c:310
    55 P:2:23:UI1:init.c:311
    56 P:3:23:UI1:init.c:312
    57 E:WrongCPUStateToPerformJobs:N:4:F:0:D:0.007911
    58 Z:SMPMultiCast:C:13:N:16:F:0:D:0.153651
     76P:0:1:ISR:init.c:391
     77P:1:0:UI1:init.c:564
     78P:2:0:UI1:init.c:565
     79P:3:0:UI1:init.c:566
     80E:WrongCPUStateToPerformJobs:N:4:F:0:D:0.000255
     81Z:SMPMultiCast:C:19:N:27:F:0:D:4.002547
    5982
    6083*** END OF TEST SMPMULTICAST 1 ***
Note: See TracChangeset for help on using the changeset viewer.