Skip to content

Race condition in PIC model #21

@parthy

Description

@parthy

During MP safety tests I stumbled across spurious interrupts which I think are caused by a race condition between triggering and EOI. The scenario leading to an error is the following:

    Trigger Thread                Receiver Thread
    ------------------------------------------------------
    Set IRR
    Prioritize -> yes
    INTR
                                  INTA
                                  DEASS
                                  EOI: Clear ISR
    Set IRR
    Prioritize -> yes
                                  EOI: Prioritize -> yes
                                  INTR
                                  INTA
                                  DEASS
                                  EOI
    INTR
                                  INTA -> spurious!

This effect can be emphasized by adding some artificial delay between the trigger thread's prioritize function and the actual INTR message. In a very basic standalone PIC model I created to simplify hunting this issue, I found that the optimization setting is also important (with -O0 I have to add the delay to see anything at all).

Now I have basically two questions:

  1. Does the above scenario make sense or am I missing something?
  2. What is an appropriate solution to it? I don't think this is a MP-related problem, because the same course of events could occur between different threads on the same CPU. It is just highly unlikely to happen.

@vmmon, @blitz, @udosteinberg, any suggestions as to how this can be solved elegantly are very much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions