git: 1aa486218701 - main - kinst: rename t_kinst to t_kinst_tramp

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 13 Jun 2023 12:46:59 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=1aa48621870189d2865c3a4edf45267cc2d84aed

commit 1aa48621870189d2865c3a4edf45267cc2d84aed
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2023-06-13 12:46:45 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2023-06-13 12:46:45 +0000

    kinst: rename t_kinst to t_kinst_tramp
    
    The forthcoming RISC-V and ARM64 ports of kinst introduce a new field
    named "t_kinst_curprobe", so "t_kinst" (which points to a trampoline)
    becomes a misleading name.
    
    No functional change intended.
    
    Reviewed by:    markj
    Approved by:    markj (mentor)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D40507
---
 sys/cddl/dev/dtrace/dtrace_cddl.h    |  4 ++--
 sys/cddl/dev/kinst/amd64/kinst_isa.c |  2 +-
 sys/cddl/dev/kinst/trampoline.c      | 15 ++++++++-------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/sys/cddl/dev/dtrace/dtrace_cddl.h b/sys/cddl/dev/dtrace/dtrace_cddl.h
index b2397d621355..720c231bfca8 100644
--- a/sys/cddl/dev/dtrace/dtrace_cddl.h
+++ b/sys/cddl/dev/dtrace/dtrace_cddl.h
@@ -88,7 +88,7 @@ typedef struct kdtrace_thread {
 	void		*td_systrace_args; /* syscall probe arguments. */
 	uint64_t	td_fasttrap_tp_gen; /* Tracepoint hash table gen. */
 	struct trapframe *td_dtrace_trapframe; /* Trap frame from invop. */
-	void		*td_kinst;
+	void		*td_kinst_tramp;
 } kdtrace_thread_t;
 
 /*
@@ -118,7 +118,7 @@ typedef struct kdtrace_thread {
 #define	t_dtrace_systrace_args	td_dtrace->td_systrace_args
 #define	t_fasttrap_tp_gen	td_dtrace->td_fasttrap_tp_gen
 #define	t_dtrace_trapframe	td_dtrace->td_dtrace_trapframe
-#define	t_kinst		td_dtrace->td_kinst
+#define	t_kinst_tramp		td_dtrace->td_kinst_tramp
 #define	p_dtrace_helpers	p_dtrace->p_dtrace_helpers
 #define	p_dtrace_count	p_dtrace->p_dtrace_count
 #define	p_dtrace_probes	p_dtrace->p_dtrace_probes
diff --git a/sys/cddl/dev/kinst/amd64/kinst_isa.c b/sys/cddl/dev/kinst/amd64/kinst_isa.c
index f8bfad8fae60..76b590f271bf 100644
--- a/sys/cddl/dev/kinst/amd64/kinst_isa.c
+++ b/sys/cddl/dev/kinst/amd64/kinst_isa.c
@@ -197,7 +197,7 @@ kinst_invop(uintptr_t addr, struct trapframe *frame, uintptr_t scratch)
 		if ((frame->tf_rflags & PSL_I) == 0)
 			tramp = DPCPU_GET(intr_tramp);
 		else
-			tramp = curthread->t_kinst;
+			tramp = curthread->t_kinst_tramp;
 		if (tramp == NULL) {
 			/*
 			 * A trampoline allocation failed, so this probe is
diff --git a/sys/cddl/dev/kinst/trampoline.c b/sys/cddl/dev/kinst/trampoline.c
index 93eca6b7e6c8..babbf84f1d88 100644
--- a/sys/cddl/dev/kinst/trampoline.c
+++ b/sys/cddl/dev/kinst/trampoline.c
@@ -219,7 +219,7 @@ kinst_trampoline_dealloc(uint8_t *tramp)
 static void
 kinst_thread_ctor(void *arg __unused, struct thread *td)
 {
-	td->t_kinst = kinst_trampoline_alloc(M_WAITOK);
+	td->t_kinst_tramp = kinst_trampoline_alloc(M_WAITOK);
 }
 
 static void
@@ -227,8 +227,8 @@ kinst_thread_dtor(void *arg __unused, struct thread *td)
 {
 	void *tramp;
 
-	tramp = td->t_kinst;
-	td->t_kinst = NULL;
+	tramp = td->t_kinst_tramp;
+	td->t_kinst_tramp = NULL;
 
 	/*
 	 * This assumes that the thread_dtor event permits sleeping, which
@@ -259,7 +259,7 @@ kinst_trampoline_init(void)
 retry:
 		PROC_LOCK(p);
 		FOREACH_THREAD_IN_PROC(p, td) {
-			if (td->t_kinst != NULL)
+			if (td->t_kinst_tramp != NULL)
 				continue;
 			if (tramp == NULL) {
 				/*
@@ -284,7 +284,7 @@ retry:
 						goto retry;
 				}
 			}
-			td->t_kinst = tramp;
+			td->t_kinst_tramp = tramp;
 			tramp = NULL;
 		}
 		PROC_UNLOCK(p);
@@ -310,8 +310,9 @@ kinst_trampoline_deinit(void)
 	FOREACH_PROC_IN_SYSTEM(p) {
 		PROC_LOCK(p);
 		FOREACH_THREAD_IN_PROC(p, td) {
-			kinst_trampoline_dealloc_locked(td->t_kinst, false);
-			td->t_kinst = NULL;
+			kinst_trampoline_dealloc_locked(td->t_kinst_tramp,
+			    false);
+			td->t_kinst_tramp = NULL;
 		}
 		PROC_UNLOCK(p);
 	}