Changeset c63e8bb in rtems


Ignore:
Timestamp:
Apr 19, 2019, 9:02:02 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
7cb881f
Parents:
85d6e845
git-author:
Sebastian Huber <sebastian.huber@…> (04/19/19 09:02:02)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/20/19 06:54:27)
Message:

score: Modify _Per_CPU_Perform_jobs()

Process only the jobs initially registered on the processing list. This
makes it possible to add jobs for the current processor in a job
handler. These jobs are processed with the next
SMP_MESSAGE_PERFORM_JOBS message. The lock is only acquired and
released once.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/smpmulticastaction.c

    r85d6e845 rc63e8bb  
    4545
    4646  _Per_CPU_Jobs_ISR_disable_and_acquire( cpu, &lock_context );
    47 
    48   while ( ( job = cpu->Jobs.head ) != NULL ) {
     47  job = cpu->Jobs.head;
     48  cpu->Jobs.head = NULL;
     49  _Per_CPU_Jobs_release_and_ISR_enable( cpu, &lock_context );
     50
     51  while ( job != NULL ) {
    4952    const Per_CPU_Job_context *context;
    50 
    51     cpu->Jobs.head = job->next;
    52     _Per_CPU_Jobs_release_and_ISR_enable( cpu, &lock_context );
     53    Per_CPU_Job               *next;
    5354
    5455    context = job->context;
     56    next = job->next;
    5557    ( *context->handler )( context->arg );
    5658    _Atomic_Store_ulong( &job->done, PER_CPU_JOB_DONE, ATOMIC_ORDER_RELEASE );
    5759
    58     _Per_CPU_Jobs_ISR_disable_and_acquire( cpu, &lock_context );
     60    job = next;
    5961  }
    6062}
  • testsuites/smptests/smpmulticast01/init.c

    r85d6e845 rc63e8bb  
    395395}
    396396
     397#define TEST_ADD_JOB_IN_JOB_JOBS 3
     398
     399static Per_CPU_Job add_job_in_job_jobs[TEST_ADD_JOB_IN_JOB_JOBS];
     400
     401static void add_job_in_job_handler_0(void *arg)
     402{
     403  T_step(1, "invalid job order");
     404  _Per_CPU_Add_job(_Per_CPU_Get(), &add_job_in_job_jobs[1]);
     405}
     406
     407static void add_job_in_job_handler_1(void *arg)
     408{
     409  T_step(3, "invalid job order");
     410}
     411
     412static const Per_CPU_Job_context
     413add_job_in_job_contexts[TEST_ADD_JOB_IN_JOB_JOBS] = {
     414  { .handler = add_job_in_job_handler_0 },
     415  { .handler = add_job_in_job_handler_1 }
     416};
     417
     418T_TEST_CASE(AddJobInJob)
     419{
     420  Per_CPU_Control *cpu_self;
     421  size_t i;
     422
     423  T_plan(4);
     424  cpu_self = _Thread_Dispatch_disable();
     425
     426  for (i = 0; i < TEST_ADD_JOB_IN_JOB_JOBS; ++i) {
     427    add_job_in_job_jobs[i].context = &add_job_in_job_contexts[i];
     428  }
     429
     430  _Per_CPU_Add_job(cpu_self, &add_job_in_job_jobs[0]);
     431  T_step(0, "wrong job processing time");
     432  _SMP_Send_message(_Per_CPU_Get_index(cpu_self), SMP_MESSAGE_PERFORM_JOBS);
     433  T_step(2, "wrong job processing time");
     434  _SMP_Send_message(_Per_CPU_Get_index(cpu_self), SMP_MESSAGE_PERFORM_JOBS);
     435  _Thread_Dispatch_enable(cpu_self);
     436}
     437
    397438T_TEST_CASE(UnicastDuringMultitaskingIRQDisabled)
    398439{
Note: See TracChangeset for help on using the changeset viewer.