thread: stash domain id to work around vtophys problems on ppc64

Adding to zombie list can be perfomed by idle threads, which on ppc64 leads to
panics as it requires a sleepable lock.

Reported by:	alfredo
Reviewed by:	kib, markj
Fixes:	r367842 ("thread: numa-aware zombie reaping")
Differential Revision:	https://reviews.freebsd.org/D27288
This commit is contained in:
mjg 2020-11-23 18:26:47 +00:00
parent 00f1b600b3
commit 0f4de3e9cc
2 changed files with 3 additions and 1 deletions

View File

@ -346,6 +346,7 @@ thread_ctor(void *mem, int size, void *arg, int flags)
td = (struct thread *)mem;
td->td_state = TDS_INACTIVE;
td->td_lastcpu = td->td_oncpu = NOCPU;
td->td_allocdomain = vm_phys_domain(vtophys(td));
/*
* Note that td_critnest begins life as 1 because the thread is not
@ -544,7 +545,7 @@ thread_zombie(struct thread *td)
struct thread_domain_data *tdd;
struct thread *ztd;
tdd = &thread_domain_data[vm_phys_domain(vtophys(td))];
tdd = &thread_domain_data[td->td_allocdomain];
ztd = atomic_load_ptr(&tdd->tdd_zombies);
for (;;) {
td->td_zombie = ztd;

View File

@ -246,6 +246,7 @@ struct thread {
sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */
#define td_siglist td_sigqueue.sq_signals
u_char td_lend_user_pri; /* (t) Lend user pri. */
u_char td_allocdomain; /* (b) NUMA domain backing this struct thread. */
/* Cleared during fork1() */
#define td_startzero td_flags