svn commit: r367961 - in head/sys: kern sys
Mateusz Guzik
mjg at FreeBSD.org
Mon Nov 23 18:26:48 UTC 2020
Author: mjg
Date: Mon Nov 23 18:26:47 2020
New Revision: 367961
URL: https://svnweb.freebsd.org/changeset/base/367961
Log:
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
Modified:
head/sys/kern/kern_thread.c
head/sys/sys/proc.h
Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c Mon Nov 23 18:18:16 2020 (r367960)
+++ head/sys/kern/kern_thread.c Mon Nov 23 18:26:47 2020 (r367961)
@@ -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;
Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h Mon Nov 23 18:18:16 2020 (r367960)
+++ head/sys/sys/proc.h Mon Nov 23 18:26:47 2020 (r367961)
@@ -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
More information about the svn-src-all
mailing list