svn commit: r365711 - in head/sys: geom kern

Edward Tomasz Napierala trasz at FreeBSD.org
Mon Sep 14 10:14:04 UTC 2020


Author: trasz
Date: Mon Sep 14 10:14:03 2020
New Revision: 365711
URL: https://svnweb.freebsd.org/changeset/base/365711

Log:
  Move TDP_GEOM check from userret() to ast(); this code path is quite
  infrequent.
  
  Reviewed by:	kib
  No objections:	mav
  Tested by:	pho
  MFC after:	2 weeks
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D26374

Modified:
  head/sys/geom/geom_event.c
  head/sys/kern/subr_trap.c

Modified: head/sys/geom/geom_event.c
==============================================================================
--- head/sys/geom/geom_event.c	Mon Sep 14 09:44:24 2020	(r365710)
+++ head/sys/geom/geom_event.c	Mon Sep 14 10:14:03 2020	(r365711)
@@ -374,6 +374,9 @@ g_post_event_x(g_event_t *func, void *arg, int flag, i
 	if (epp != NULL)
 		*epp = ep;
 	curthread->td_pflags |= TDP_GEOM;
+	thread_lock(curthread);
+	curthread->td_flags |= TDF_ASTPENDING;
+	thread_unlock(curthread);
 	return (0);
 }
 

Modified: head/sys/kern/subr_trap.c
==============================================================================
--- head/sys/kern/subr_trap.c	Mon Sep 14 09:44:24 2020	(r365710)
+++ head/sys/kern/subr_trap.c	Mon Sep 14 10:14:03 2020	(r365711)
@@ -138,13 +138,6 @@ userret(struct thread *td, struct trapframe *frame)
 	MPASS(td->td_su == NULL);
 
 	/*
-	 * If this thread tickled GEOM, we need to wait for the giggling to
-	 * stop before we return to userland
-	 */
-	if (__predict_false(td->td_pflags & TDP_GEOM))
-		g_waitidle();
-
-	/*
 	 * Charge system time if profiling.
 	 */
 	if (__predict_false(p->p_flag & P_PROFIL))
@@ -285,6 +278,13 @@ ast(struct trapframe *framep)
 			ktrcsw(0, 1, __func__);
 #endif
 	}
+
+	/*
+	 * If this thread tickled GEOM, we need to wait for the giggling to
+	 * stop before we return to userland
+	 */
+	if (__predict_false(td->td_pflags & TDP_GEOM))
+		g_waitidle();
 
 #ifdef DIAGNOSTIC
 	if (p->p_numthreads == 1 && (flags & TDF_NEEDSIGCHK) == 0) {


More information about the svn-src-head mailing list