Add the function md_assert_nopreempt(), which is a very consistent
function on the possibility of a thread to not preempt. As this function is very tied to x86 (interrupts disabled checkings) it is not intended to be used in MI code.
This commit is contained in:
parent
9734077245
commit
f1edea81ac
@ -1428,6 +1428,22 @@ cpususpend_handler(void)
|
||||
intr_restore(rf);
|
||||
}
|
||||
|
||||
void
|
||||
md_assert_nopreempt(void)
|
||||
{
|
||||
#ifdef INVARIANTS
|
||||
struct thread *td;
|
||||
register_t rflags;
|
||||
|
||||
td = curthread;
|
||||
rflags = read_rflags();
|
||||
|
||||
if ((rflags & PSL_I) != 0 && td->td_critnest <= 0)
|
||||
panic("Preemption still allowed, thread %s\n",
|
||||
(td->td_pinned <= 0) ? "not pinned" : "pinned");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called once the rest of the system is up and running and we're
|
||||
* ready to let the AP's out of the pen.
|
||||
|
@ -64,6 +64,7 @@ void ipi_bitmap_handler(struct trapframe frame);
|
||||
void ipi_cpu(int cpu, u_int ipi);
|
||||
int ipi_nmi_handler(void);
|
||||
void ipi_selected(cpumask_t cpus, u_int ipi);
|
||||
void md_assert_nopreempt(void);
|
||||
u_int mp_bootaddress(u_int);
|
||||
int mp_grab_cpu_hlt(void);
|
||||
void smp_cache_flush(void);
|
||||
|
@ -1486,6 +1486,22 @@ cpustop_handler(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
md_assert_nopreempt(void)
|
||||
{
|
||||
#ifdef INVARIANTS
|
||||
struct thread *td;
|
||||
register_t rflags;
|
||||
|
||||
td = curthread;
|
||||
rflags = read_rflags();
|
||||
|
||||
if ((rflags & PSL_I) != 0 && td->td_critnest <= 0)
|
||||
panic("Preemption still allowed, thread %s\n",
|
||||
(td->td_pinned <= 0) ? "not pinned" : "pinned");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called once the rest of the system is up and running and we're
|
||||
* ready to let the AP's out of the pen.
|
||||
|
@ -65,6 +65,7 @@ void ipi_bitmap_handler(struct trapframe frame);
|
||||
void ipi_cpu(int cpu, u_int ipi);
|
||||
int ipi_nmi_handler(void);
|
||||
void ipi_selected(cpumask_t cpus, u_int ipi);
|
||||
void md_assert_nopreempt(void);
|
||||
u_int mp_bootaddress(u_int);
|
||||
int mp_grab_cpu_hlt(void);
|
||||
void smp_cache_flush(void);
|
||||
|
@ -1241,6 +1241,22 @@ cpustop_handler(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
md_assert_nopreempt(void)
|
||||
{
|
||||
#ifdef INVARIANTS
|
||||
struct thread *td;
|
||||
register_t rflags;
|
||||
|
||||
td = curthread;
|
||||
rflags = read_rflags();
|
||||
|
||||
if ((rflags & PSL_I) != 0 && td->td_critnest <= 0)
|
||||
panic("Preemption still allowed, thread %s\n",
|
||||
(td->td_pinned <= 0) ? "not pinned" : "pinned");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called once the rest of the system is up and running and we're
|
||||
* ready to let the AP's out of the pen.
|
||||
|
Loading…
Reference in New Issue
Block a user