From owner-dev-commits-src-all@freebsd.org Wed Jun 2 12:25:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6BF8642299; Wed, 2 Jun 2021 12:25:02 +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 4Fw7Wy2VGYz3FsK; Wed, 2 Jun 2021 12:25:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2AC3316D96; Wed, 2 Jun 2021 12:25:02 +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 152CP2dk019367; Wed, 2 Jun 2021 12:25:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152CP2Eh019366; Wed, 2 Jun 2021 12:25:02 GMT (envelope-from git) Date: Wed, 2 Jun 2021 12:25:02 GMT Message-Id: <202106021225.152CP2Eh019366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: c64d1bd7145b - stable/13 - The old thread priority must be stored as part of the EPOCH(9) tracker. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c64d1bd7145b5d30c97d1cd99e584da529d95100 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 12:25:02 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c64d1bd7145b5d30c97d1cd99e584da529d95100 commit c64d1bd7145b5d30c97d1cd99e584da529d95100 Author: Hans Petter Selasky AuthorDate: 2021-05-21 08:27:20 +0000 Commit: Hans Petter Selasky CommitDate: 2021-06-02 12:03:21 +0000 The old thread priority must be stored as part of the EPOCH(9) tracker. Else recursive use of EPOCH(9) may cause the wrong priority to be restored. Bump the __FreeBSD_version due to adding new member to the epoch tracker structure. Differential Revision: https://reviews.freebsd.org/D30375 Reviewed by: markj@ Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit ef0f7ae934b04a4f90e051d701ba539dd04e7d5b) --- sys/kern/subr_epoch.c | 6 +++--- sys/sys/epoch.h | 1 + sys/sys/param.h | 2 +- sys/sys/proc.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/subr_epoch.c b/sys/kern/subr_epoch.c index 798dbdc4360e..651fd8b419f0 100644 --- a/sys/kern/subr_epoch.c +++ b/sys/kern/subr_epoch.c @@ -457,7 +457,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE) THREAD_NO_SLEEPING(); critical_enter(); sched_pin(); - td->td_pre_epoch_prio = td->td_priority; + et->et_old_priority = td->td_priority; er = epoch_currecord(epoch); /* Record-level tracking is reserved for non-preemptible epochs. */ MPASS(er->er_td == NULL); @@ -510,8 +510,8 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE) ck_epoch_end(&er->er_record, &et->et_section); TAILQ_REMOVE(&er->er_tdlist, et, et_link); er->er_gen++; - if (__predict_false(td->td_pre_epoch_prio != td->td_priority)) - epoch_adjust_prio(td, td->td_pre_epoch_prio); + if (__predict_false(et->et_old_priority != td->td_priority)) + epoch_adjust_prio(td, et->et_old_priority); critical_exit(); #ifdef EPOCH_TRACE epoch_trace_exit(td, epoch, et, file, line); diff --git a/sys/sys/epoch.h b/sys/sys/epoch.h index 25d2bb3dc6e3..85c791d3df6c 100644 --- a/sys/sys/epoch.h +++ b/sys/sys/epoch.h @@ -55,6 +55,7 @@ struct epoch_tracker { TAILQ_ENTRY(epoch_tracker) et_link; struct thread *et_td; ck_epoch_section_t et_section; + uint8_t et_old_priority; #ifdef EPOCH_TRACE struct epoch *et_epoch; SLIST_ENTRY(epoch_tracker) et_tlink; diff --git a/sys/sys/param.h b/sys/sys/param.h index 127c04becf58..f9b67ef94bc0 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300506 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300507 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 8e2a081eb027..05fdc83fd1e2 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -325,7 +325,7 @@ struct thread { u_char td_pri_class; /* (t) Scheduling class. */ u_char td_user_pri; /* (t) User pri from estcpu and nice. */ u_char td_base_user_pri; /* (t) Base user pri */ - u_char td_pre_epoch_prio; /* (k) User pri on entry to epoch */ + u_char td_unused_0; /* no longer used field */ uintptr_t td_rb_list; /* (k) Robust list head. */ uintptr_t td_rbp_list; /* (k) Robust priv list head. */ uintptr_t td_rb_inact; /* (k) Current in-action mutex loc. */