Changeset fe24820e in rtems


Ignore:
Timestamp:
Apr 27, 2019, 10:39:25 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bf867c55
Parents:
21e691b
git-author:
Sebastian Huber <sebastian.huber@…> (04/27/19 10:39:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/20/19 06:54:31)
Message:

smpipi01: Use per-CPU jobs for IPI flood test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/smptests/smpipi01/init.c

    r21e691b rfe24820e  
    4141  SMP_barrier_State main_barrier_state;
    4242  SMP_barrier_State worker_barrier_state;
    43   Per_CPU_Job jobs[2];
     43  Per_CPU_Job jobs[CPU_COUNT][2];
    4444} test_context;
    4545
     
    9292  barrier(ctx, bs);
    9393
    94   ctx->jobs[1].context = &barrier_1_job_context;
    95   _Per_CPU_Add_job(_Per_CPU_Get(), &ctx->jobs[1]);
     94  ctx->jobs[0][1].context = &barrier_1_job_context;
     95  _Per_CPU_Add_job(_Per_CPU_Get(), &ctx->jobs[0][1]);
    9696}
    9797
     
    120120  for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
    121121    if (cpu_index != cpu_index_self) {
    122       ctx->jobs[0].context = &barrier_0_job_context;
    123       _Per_CPU_Add_job(_Per_CPU_Get_by_index(cpu_index), &ctx->jobs[0]);
     122      ctx->jobs[0][0].context = &barrier_0_job_context;
     123      _Per_CPU_Add_job(_Per_CPU_Get_by_index(cpu_index), &ctx->jobs[0][0]);
    124124      _SMP_Send_message(cpu_index, SMP_MESSAGE_PERFORM_JOBS);
    125125
     
    148148}
    149149
    150 static void counter_handler(Per_CPU_Control *cpu_self)
    151 {
    152   test_context *ctx = &test_instance;
     150static void counter_handler(void *arg, size_t next_job)
     151{
     152  test_context *ctx = arg;
     153  Per_CPU_Control *cpu_self = _Per_CPU_Get();
    153154  uint32_t cpu_index_self = _Per_CPU_Get_index(cpu_self);
    154155
    155156  ++ctx->counters[cpu_index_self].value;
    156 }
     157  _Per_CPU_Add_job(cpu_self, &ctx->jobs[cpu_index_self][next_job]);
     158}
     159
     160static void counter_0_handler(void *arg)
     161{
     162  counter_handler(arg, 1);
     163}
     164
     165static const Per_CPU_Job_context counter_0_job_context = {
     166  .handler = counter_0_handler,
     167  .arg = &test_instance
     168};
     169
     170static void counter_1_handler(void *arg)
     171{
     172  counter_handler(arg, 0);
     173}
     174
     175static const Per_CPU_Job_context counter_1_job_context = {
     176  .handler = counter_1_handler,
     177  .arg = &test_instance
     178};
    157179
    158180static void test_send_message_flood(
     
    164186  uint32_t cpu_index;
    165187
    166   _SMP_Set_test_message_handler(counter_handler);
     188  for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
     189    Per_CPU_Control *cpu = _Per_CPU_Get_by_index(cpu_index);
     190
     191    ctx->jobs[cpu_index][0].context = &counter_0_job_context;
     192    ctx->jobs[cpu_index][1].context = &counter_1_job_context;
     193    _Per_CPU_Add_job(cpu, &ctx->jobs[cpu_index][0]);
     194    _SMP_Send_message(cpu_index, SMP_MESSAGE_PERFORM_JOBS);
     195  }
    167196
    168197  for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
     
    179208
    180209    for (i = 0; i < 100000; ++i) {
    181       _SMP_Send_message(cpu_index, SMP_MESSAGE_TEST);
     210      _SMP_Send_message(cpu_index, SMP_MESSAGE_PERFORM_JOBS);
    182211    }
    183212
Note: See TracChangeset for help on using the changeset viewer.