pcm icon indicating copy to clipboard operation
pcm copied to clipboard

macOS: readMSR should only execute on requested CPU

Open nealsid opened this issue 2 years ago • 0 comments

Right now readMSR executes code on all CPUs to read an MSR, and filters out results that do not match the requested cpu inside PcmMsr::readMSR():

        mp_rendezvous_no_intrs(cpuReadMSR, (void*)idatas);

We can change this to something like this:

        mp_cpus_call(cpu_to_cpumask(idatas->cpu_num),
                     ASYNC,
                     cpuReadMsr,
                     (void*)idatas);

One thing I am not sure of is mp_rendezvous has a comment indicating it is exported for use by KEXTs, but this is not the case for mp_cpus_call. mp_cpus_call will also disable interrupts while the requested function is being executed, which is the same as the behavior today, but may not be necessary for reading an MSR.

nealsid avatar Sep 17 '22 00:09 nealsid