Menu

#147 QXK: PendSV_error is triggered on special conditions

QP
closed
QXK (10)
9
2024-08-01
2016-11-09
Anonymous
No

QPC / v5.7.4

  1. Active object with priority 34 is running
  2. An interrupt triggers (having interrupt id=26)
  3. QXK_sched() is run, in whitch:
    • QXK_attr_.curr == (void *)0 -> current thread is a basic thread
    • next->thread != 0 "this is an extened-thread"
      -> "no activation needed"
      -> QXK_attr_.next = next
      -> context switch
  4. at the same time of QXK_sched processing, the same interrupt has been already triggered again (id=26), so instead of running PendSV, the interrupt handler is run again
  5. this time interrupt handler (id=26) posts an event to a lower priority AO (priority=33)
  6. QXK_sched() is run, in whitch:
    • QXK_attr_.curr == (void *)0 -> current thread is a basic thread
    • next->thread == (void *)0 -> next is a basic thread
    • if (p <= QXK_attr_.actPrio) { -> the priority is lower than current priority (33 vs 34)
    • QXK_attr_.next = (void )0, p= 0 / no activation needed */
  7. PendSv is triggered
    -> because QXK_attr_.next is now 0, the precondition fails and PendSV_error is triggered

Discussion

  • J. K. Paasikivi

    J. K. Paasikivi - 2016-11-17

    More info:
    At step (3) above, the
    QXK_attr.readySet.bits[0] = 0x10
    QXK_attr.readySet.bits[1] = 0x00

    At step (6) above, the
    QXK_attr.readySet.bits[0] = 0x10
    QXK_attr.readySet.bits[1] = 0x01

    So the QXK_attr.readySet.bits[1] & 0x02 (for AO with priority 34) has been already cleared before this.
    According to code, the only place to clear these seems to be QACTIVE_EQUEUE_ONEMPTY_() via QActive_get_() via QXK_activate_().

    So in summary:

    • Inside QXK_activate(), the interrupts are enabled QF_INT_ENABLE(); / unconditionally enable interrupts /
    • QActive_get_() gets called -> (readySet.bits[1] & 0x02) gets zeroed
    • interrupt (id=26) happens once, no posting of events this time
    • interrupt (id=26) happens second time, this time posting an event to AO with priority of 33
    • pendSV gets run -> PendSV_error
     
  • Quantum Leaps

    Quantum Leaps - 2016-11-17
    • status: open --> accepted
    • assigned_to: Quantum Leaps
    • Group: QM --> QP-C
    • Priority: 1 --> 9
     
  • Quantum Leaps

    Quantum Leaps - 2016-11-17

    Thank you for the information. The bug is now accepted and was assigned the highest priority. It will be fixed in the next QP/C/C++ release.

    --MMS

     
  • Quantum Leaps

    Quantum Leaps - 2016-12-02
    • status: accepted --> closed
     
  • Quantum Leaps

    Quantum Leaps - 2016-12-02

    This bug has been fixed in QP/C 5.8.0 and QP/C++ 5.8.0.

     
  • Quantum Leaps

    Quantum Leaps - 2017-09-07
    • labels: --> QXK
    • Group: QP-C --> QP-C-C++
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB