Are MSRs saved and restored on context switches?

Josué Feliu jofepre at
Fri Jul 12 11:58:01 EDT 2019

Hi all,

I was curious about whether a context switch in Linux saves and restores 
the MSR registers of the tasks involved in the context switch. I 
searched in the source code and could not find this functionality. I'm 
not sure if all MSRs need or can be associated to tasks but I understand 
that, for example, MSRs related to performance counters should be saved 
and restored on context switches to correctly monitor events on a per 
PID basis.

Thanks a lot,

More information about the Kernelnewbies mailing list