Search code examples
linux-kernelx86interrupthyperthreadingisr

disabling interrupts on hyperthreaded processor


Let say I have a hyper-threaded processor and OS sees them as two different virtual processors vp1 and vp2. Now in an LWP1 on vp1, I disable hardware interrupt interrupts. Does not it amounts to say that both of the virtual processors wont get any interrupts unless enabled? And if this is true it should also mean that enabling the interrupts back by another LWP2 on the other processor vp2 will enable interrupts on vp1 as well? I am assuming that disabling interrupts from kernel, only disables it on local processor.

Please explain how this works.


Solution

  • The two logical cores of a hyperthreaded processor have their own APIC IDs, so as far as interrupts are concerned they are separate CPUs. (In Knight's Landing / Xeon Phi, four logical cores)

    This makes it possible to disable interrupts on any one logical core independently of anything else, using cli / sti in kernel mode. Everything is exactly the same as on a non-SMT multi-core system, because that's how hyperthreading is designed to work.

    Anything else would be inconvenient and weird, and increase latency for the other logical core by sometimes disabling the interrupts it was waiting for, so it's pretty clear that this is the sane way for Intel to have designed it.