From nobody Thu Jul 14 20:15:34 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LkQj31T1Lz4T4J1; Thu, 14 Jul 2022 20:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LkQj30RX8z3T3Q; Thu, 14 Jul 2022 20:15:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657829735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wl65VUn4iDVshpwInYpgl807q77Ph40nUb6QCDImZHk=; b=s4lAveBk9+IeZ/kq2yJ0lhY7EO4o1c9dqisAzXPm24wzHNUg8MqoiA5OdGo5TO5mpjiJpO bi8GSHFdi4gu54lO9EYpywkPadvDTnEuUxcfQ3Jx1p0un4KOv8UEQwEuynL+aOBcWrtymO 9C8nrPz2i3IPC0SbdvRBUEA1renlXg/OKfARRen3YkZ7JmAx/8X/UVtfIMGk+dRAfdmrWg 591IgvmnbbyEXSV458FePMGKSsGqjHXrBZ9Qf3PoXf2yWjhKoEPRsHDbvV54QQ7WU9hZbo BZws8uTwByoPDjGC6d925zzqS2II6qOeufyfqD23yh8Lw4lpcE4MHeYZ26VsNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LkQj26bbVzGBD; Thu, 14 Jul 2022 20:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26EKFYue088251; Thu, 14 Jul 2022 20:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26EKFYAI088250; Thu, 14 Jul 2022 20:15:34 GMT (envelope-from git) Date: Thu, 14 Jul 2022 20:15:34 GMT Message-Id: <202207142015.26EKFYAI088250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: fea89a2804ad - main - Add sched_ithread_prio to set the base priority of an interrupt thread. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fea89a2804ad89f5342268a8546a3f9b515b5e6c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657829735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Wl65VUn4iDVshpwInYpgl807q77Ph40nUb6QCDImZHk=; b=PxG/UrvHKi6vGuITUpfEduZWl6QwxDYzf0GPN+cNZUIVApwe6v0hug6a6Wgis62SqpTuIT paFD/vFV9uRKkI0pkGvcPec2mGAhRLwzoVh6/g5sRhUKdfNg2kZczY6wIc+tB7zU17D26G TVqLyvR7bSvv1WIRYoagqo2LJp0dG+8HedPHOmsHtJnplP3+ZjqduljYsR63S36fv42khY RyyGtufjD2VMObGnq4bFZUoPoK7QFxMCsXw72y8ptGKQPOGV4AjMhjzmiRfy53VDCFSNWK mBfkAfSBOZbiIHm5Ii75C/lX4iG+R8TFpOsULN+MYQSJixamLnP8OSu0uGKb2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657829735; a=rsa-sha256; cv=none; b=wgIknaQlud/gfA84zhZcuXRQiug4Oq7B6BV/y6zZoWgKVqCv71JMvYTk7ER3L0BbZEaIFZ aSrETQf2HuWsQdZQX+9PrqOPWf6EMhhrFavDgVQisp8yGJ59rhkKh3ScAbYtWHMFqU6a8M I7Xju+5ePkqvy9nBXkcIyFURLyDKuKpCt1bJQvUhrkAq0a5/W45lLSJj3KSM18DC4zsN+I HZjHvyY932F+HmQx8O7HAs5OTU6BwRLRkVok89TQ6zzAOiVUIQ8rMIdfvJ5JPzOjvxHba/ 6QJzdNbVCwFMhEmlw0OkvX5w6tyh6nmO/z0pqLmux7Q3Afp6rMSkO7ieph8Tsg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fea89a2804ad89f5342268a8546a3f9b515b5e6c commit fea89a2804ad89f5342268a8546a3f9b515b5e6c Author: John Baldwin AuthorDate: 2022-07-14 20:13:10 +0000 Commit: John Baldwin CommitDate: 2022-07-14 20:13:10 +0000 Add sched_ithread_prio to set the base priority of an interrupt thread. Use it instead of sched_prio when setting the priority of an interrupt thread. Reviewed by: kib, markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D35642 --- sys/kern/kern_intr.c | 2 +- sys/kern/kern_timeout.c | 2 +- sys/kern/sched_4bsd.c | 9 +++++++++ sys/kern/sched_ule.c | 12 ++++++++++++ sys/kern/subr_busdma_bounce.c | 2 +- sys/sys/proc.h | 1 + sys/sys/sched.h | 1 + 7 files changed, 26 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 3637b556af5d..693c5595ba31 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -205,7 +205,7 @@ ithread_update(struct intr_thread *ithd) sched_clear_tdname(td); #endif thread_lock(td); - sched_prio(td, pri); + sched_ithread_prio(td, pri); thread_unlock(td); } diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 2f0705998158..621ea258f21c 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -391,7 +391,7 @@ start_softclock(void *dummy) cc->cc_thread = td; thread_lock(td); sched_class(td, PRI_ITHD); - sched_prio(td, PI_SOFTCLOCK); + sched_ithread_prio(td, PI_SOFTCLOCK); TD_SET_IWAIT(td); thread_lock_set(td, (struct mtx *)&cc->cc_lock); thread_unlock(td); diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 3715402854c7..779e1a7b4ef5 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -924,6 +924,15 @@ sched_prio(struct thread *td, u_char prio) turnstile_adjust(td, oldprio); } +void +sched_ithread_prio(struct thread *td, u_char prio) +{ + THREAD_LOCK_ASSERT(td, MA_OWNED); + MPASS(td->td_pri_class == PRI_ITHD); + td->td_base_ithread_pri = prio; + sched_prio(td, prio); +} + void sched_user_prio(struct thread *td, u_char prio) { diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 14d6e689081d..c4eb46944b43 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1962,6 +1962,18 @@ sched_prio(struct thread *td, u_char prio) turnstile_adjust(td, oldprio); } +/* + * Set the base interrupt thread priority. + */ +void +sched_ithread_prio(struct thread *td, u_char prio) +{ + THREAD_LOCK_ASSERT(td, MA_OWNED); + MPASS(td->td_pri_class == PRI_ITHD); + td->td_base_ithread_pri = prio; + sched_prio(td, prio); +} + /* * Set the base user priority, does not effect current running priority. */ diff --git a/sys/kern/subr_busdma_bounce.c b/sys/kern/subr_busdma_bounce.c index 81a8f1046485..d6c50d83bbe7 100644 --- a/sys/kern/subr_busdma_bounce.c +++ b/sys/kern/subr_busdma_bounce.c @@ -439,7 +439,7 @@ busdma_thread(void *dummy __unused) thread_lock(curthread); sched_class(curthread, PRI_ITHD); - sched_prio(curthread, PI_SWI(SWI_BUSDMA)); + sched_ithread_prio(curthread, PI_SWI(SWI_BUSDMA)); thread_unlock(curthread); for (;;) { mtx_lock(&bounce_lock); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 5521f8321e2b..bc2d90355b82 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -257,6 +257,7 @@ struct thread { #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. */ + u_char td_base_ithread_pri; /* (t) Base ithread pri */ struct kmsan_td *td_kmsan; /* (k) KMSAN state */ /* Cleared during fork1() */ diff --git a/sys/sys/sched.h b/sys/sys/sched.h index a9598767e4cb..e0556d29f0db 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -95,6 +95,7 @@ void sched_ap_entry(void); void sched_exit_thread(struct thread *td, struct thread *child); u_int sched_estcpu(struct thread *td); void sched_fork_thread(struct thread *td, struct thread *child); +void sched_ithread_prio(struct thread *td, u_char prio); void sched_lend_prio(struct thread *td, u_char prio); void sched_lend_user_prio(struct thread *td, u_char pri); void sched_lend_user_prio_cond(struct thread *td, u_char pri);