From owner-svn-src-head@freebsd.org Sun Nov 8 01:38:58 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A6B2A22F51; Sun, 8 Nov 2015 01:38:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C55D120E; Sun, 8 Nov 2015 01:38:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tA81cv8U062687; Sun, 8 Nov 2015 01:38:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA81cv4w062683; Sun, 8 Nov 2015 01:38:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201511080138.tA81cv4w062683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Nov 2015 01:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290530 - in head/sys: fs/procfs kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2015 01:38:58 -0000 Author: markj Date: Sun Nov 8 01:38:56 2015 New Revision: 290530 URL: https://svnweb.freebsd.org/changeset/base/290530 Log: - Consistently use PROC_ASSERT_HELD() to verify that a process' hold count is non-zero. - Include the process address in the PROC_ASSERT_HELD() and PROC_ASSERT_NOT_HELD() assertion messages so that the corresponding process can be found easily when debugging. MFC after: 1 week Modified: head/sys/fs/procfs/procfs_dbregs.c head/sys/fs/procfs/procfs_fpregs.c head/sys/kern/sys_process.c head/sys/sys/proc.h Modified: head/sys/fs/procfs/procfs_dbregs.c ============================================================================== --- head/sys/fs/procfs/procfs_dbregs.c Sun Nov 8 01:36:18 2015 (r290529) +++ head/sys/fs/procfs/procfs_dbregs.c Sun Nov 8 01:38:56 2015 (r290530) @@ -98,7 +98,7 @@ procfs_doprocdbregs(PFS_FILL_ARGS) return (0); PROC_LOCK(p); - KASSERT(p->p_lock > 0, ("proc not held")); + PROC_ASSERT_HELD(p); if (p_candebug(td, p) != 0) { PROC_UNLOCK(p); return (EPERM); Modified: head/sys/fs/procfs/procfs_fpregs.c ============================================================================== --- head/sys/fs/procfs/procfs_fpregs.c Sun Nov 8 01:36:18 2015 (r290529) +++ head/sys/fs/procfs/procfs_fpregs.c Sun Nov 8 01:38:56 2015 (r290530) @@ -92,7 +92,7 @@ procfs_doprocfpregs(PFS_FILL_ARGS) return (0); PROC_LOCK(p); - KASSERT(p->p_lock > 0, ("proc not held")); + PROC_ASSERT_HELD(p); if (p_candebug(td, p)) { PROC_UNLOCK(p); return (EPERM); Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Sun Nov 8 01:36:18 2015 (r290529) +++ head/sys/kern/sys_process.c Sun Nov 8 01:38:56 2015 (r290530) @@ -251,8 +251,7 @@ proc_rwmem(struct proc *p, struct uio *u * curthread but we can't assert that.) This keeps the process * from exiting out from under us until this operation completes. */ - KASSERT(p->p_lock >= 1, ("%s: process %p (pid %d) not held", __func__, - p, p->p_pid)); + PROC_ASSERT_HELD(p); /* * The map we want... Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sun Nov 8 01:36:18 2015 (r290529) +++ head/sys/sys/proc.h Sun Nov 8 01:38:56 2015 (r290530) @@ -824,13 +824,13 @@ extern pid_t pid_max; #define _PHOLD(p) do { \ PROC_LOCK_ASSERT((p), MA_OWNED); \ KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc, \ - ("PHOLD of exiting process")); \ + ("PHOLD of exiting process %p", p)); \ (p)->p_lock++; \ if (((p)->p_flag & P_INMEM) == 0) \ faultin((p)); \ } while (0) -#define PROC_ASSERT_HELD(p) do { \ - KASSERT((p)->p_lock > 0, ("process not held")); \ +#define PROC_ASSERT_HELD(p) do { \ + KASSERT((p)->p_lock > 0, ("process %p not held", p)); \ } while (0) #define PRELE(p) do { \ @@ -845,8 +845,8 @@ extern pid_t pid_max; if (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0) \ wakeup(&(p)->p_lock); \ } while (0) -#define PROC_ASSERT_NOT_HELD(p) do { \ - KASSERT((p)->p_lock == 0, ("process held")); \ +#define PROC_ASSERT_NOT_HELD(p) do { \ + KASSERT((p)->p_lock == 0, ("process %p held", p)); \ } while (0) #define PROC_UPDATE_COW(p) do { \