cpu_auxmsr: assert caller is preventing CPU migration.

Submitted by:	Adam Fenn (adam at fenn dot io)
Requested by:	kib
Reviewed by:	kib, grehan
Approved by:	kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D26166
This commit is contained in:
grehan 2020-08-24 11:49:49 +00:00
parent 001cb21aac
commit af396b3a28
2 changed files with 10 additions and 2 deletions

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/psl.h>
#include <machine/specialreg.h>
#include <vm/vm.h>
@ -218,11 +219,14 @@ init_via(void)
}
/*
* The value for the TSC_AUX MSR and rdtscp/rdpid.
* The value for the TSC_AUX MSR and rdtscp/rdpid on the invoking CPU.
*
* Caller should prevent CPU migration.
*/
u_int
cpu_auxmsr(void)
{
KASSERT((read_rflags() & PSL_I) == 0, ("context switch possible"));
return (PCPU_GET(cpuid));
}

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/psl.h>
#include <machine/specialreg.h>
#include <vm/vm.h>
@ -628,11 +629,14 @@ init_transmeta(void)
#endif
/*
* The value for the TSC_AUX MSR and rdtscp/rdpid.
* The value for the TSC_AUX MSR and rdtscp/rdpid on the invoking CPU.
*
* Caller should prevent CPU migration.
*/
u_int
cpu_auxmsr(void)
{
KASSERT((read_eflags() & PSL_I) == 0, ("context switch possible"));
return (PCPU_GET(cpuid));
}