Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2018 18:03:48 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334344 - in head/sys: dev/hwpmc kern sys
Message-ID:  <201805291803.w4TI3mXd073194@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Tue May 29 18:03:48 2018
New Revision: 334344
URL: https://svnweb.freebsd.org/changeset/base/334344

Log:
  hwpmc: don't enter epoch section across mmap hook

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/pmckern.h

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Tue May 29 18:03:43 2018	(r334343)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Tue May 29 18:03:48 2018	(r334344)
@@ -1717,7 +1717,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map
 	const struct pmc_process *pp;
 
 	freepath = fullpath = NULL;
-	epoch_exit_preempt(global_epoch_preempt);
+	MPASS(!in_epoch());
 	pmc_getfilename((struct vnode *) pkm->pm_file, &fullpath, &freepath);
 
 	pid = td->td_proc->p_pid;
@@ -1743,6 +1743,7 @@ pmc_process_mmap(struct thread *td, struct pmckern_map
   done:
 	if (freepath)
 		free(freepath, M_TEMP);
+	epoch_exit_preempt(global_epoch_preempt);
 }
 
 

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Tue May 29 18:03:43 2018	(r334343)
+++ head/sys/kern/vfs_vnops.c	Tue May 29 18:03:48 2018	(r334344)
@@ -2494,7 +2494,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *ad
 		if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) {
 			pkm.pm_file = vp;
 			pkm.pm_address = (uintptr_t) *addr;
-			PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm);
+			PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_MMAP, (void *) &pkm);
 		}
 	}
 #endif

Modified: head/sys/sys/pmckern.h
==============================================================================
--- head/sys/sys/pmckern.h	Tue May 29 18:03:43 2018	(r334343)
+++ head/sys/sys/pmckern.h	Tue May 29 18:03:48 2018	(r334344)
@@ -217,7 +217,8 @@ do {						\
  */
 #define	PMC_CALL_HOOK_UNLOCKED(t, cmd, arg)	\
 do {						\
-	if (pmc_hook != NULL)			\
+	MPASS(!in_epoch());					\
+	if (pmc_hook != NULL)				\
 		(pmc_hook)((t), (cmd), (arg));	\
 } while (0)
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805291803.w4TI3mXd073194>