Changeset dedc3e1d in rtems


Ignore:
Timestamp:
Nov 23, 2020, 3:34:26 PM (2 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5
Children:
21ed8d11
Parents:
1dbdf94e
git-author:
Sebastian Huber <sebastian.huber@…> (11/23/20 15:34:26)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/25/20 07:32:24)
Message:

rtems: Improve rtems_interrupt_server_create()

Also start interrupt server tasks on processors which do not have a
scheduler. Applications may dynamically manage processors using
rtems_scheduler_remove_processor() and rtems_scheduler_add_processor().

Close #4190.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/shared/irq/irq-server.c

    r1dbdf94e rdedc3e1d  
    507507#endif
    508508
    509   rtems_interrupt_lock_initialize(&s->lock, "Interrupt Server");
    510   rtems_chain_initialize_empty(&s->entries);
    511 
    512509  sc = rtems_task_create(
    513510    rtems_build_name('I', 'R', 'Q', 'S'),
     
    519516  );
    520517  if (sc != RTEMS_SUCCESSFUL) {
    521     return sc;
    522   }
     518    (*s->destroy)(s);
     519    return sc;
     520  }
     521
     522  rtems_interrupt_lock_initialize(&s->lock, "Interrupt Server");
     523  rtems_chain_initialize_empty(&s->entries);
    523524
    524525#if defined(RTEMS_SMP)
    525526  sc = rtems_scheduler_ident_by_processor(cpu_index, &scheduler);
    526   if (sc != RTEMS_SUCCESSFUL) {
    527     /* Do not start an interrupt server on a processor without a scheduler */
    528     return RTEMS_SUCCESSFUL;
    529   }
    530 
    531   sc = rtems_task_set_scheduler(s->server, scheduler, priority);
    532   _Assert(sc == RTEMS_SUCCESSFUL);
    533 
    534   /* Set the task to processor affinity on a best-effort basis */
    535   CPU_ZERO(&cpu);
    536   CPU_SET(cpu_index, &cpu);
    537   (void) rtems_task_set_affinity(s->server, sizeof(cpu), &cpu);
     527
     528  /*
     529   * If a scheduler exists for the processor, then move it to this scheduler
     530   * and try to set the affinity to the processor, otherwise keep the scheduler
     531   * of the executing thread.
     532   */
     533  if (sc == RTEMS_SUCCESSFUL) {
     534    sc = rtems_task_set_scheduler(s->server, scheduler, priority);
     535    _Assert(sc == RTEMS_SUCCESSFUL);
     536
     537    /* Set the task to processor affinity on a best-effort basis */
     538    CPU_ZERO(&cpu);
     539    CPU_SET(cpu_index, &cpu);
     540    (void) rtems_task_set_affinity(s->server, sizeof(cpu), &cpu);
     541  }
    538542#else
    539543  (void) cpu_index;
Note: See TracChangeset for help on using the changeset viewer.