From owner-svn-src-projects@FreeBSD.ORG Sat Apr 30 23:12:38 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 685B11065678; Sat, 30 Apr 2011 23:12:38 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47AF38FC0A; Sat, 30 Apr 2011 23:12:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p3UNCcDQ066601; Sat, 30 Apr 2011 23:12:38 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3UNCc1Y066595; Sat, 30 Apr 2011 23:12:38 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201104302312.p3UNCc1Y066595@svn.freebsd.org> From: Attilio Rao Date: Sat, 30 Apr 2011 23:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221284 - in projects/largeSMP/sys: amd64/amd64 amd64/include i386/i386 i386/include i386/xen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2011 23:12:38 -0000 Author: attilio Date: Sat Apr 30 23:12:37 2011 New Revision: 221284 URL: http://svn.freebsd.org/changeset/base/221284 Log: Add the function md_assert_nopreempt(), which is a very consistent function on the possibility of a thread to not preempt. As this function is very tied to x86 (interrupts disabled checkings) it is not intended to be used in MI code. Modified: projects/largeSMP/sys/amd64/amd64/mp_machdep.c projects/largeSMP/sys/amd64/include/smp.h projects/largeSMP/sys/i386/i386/mp_machdep.c projects/largeSMP/sys/i386/include/smp.h projects/largeSMP/sys/i386/xen/mp_machdep.c Modified: projects/largeSMP/sys/amd64/amd64/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/amd64/amd64/mp_machdep.c Sat Apr 30 23:02:17 2011 (r221283) +++ projects/largeSMP/sys/amd64/amd64/mp_machdep.c Sat Apr 30 23:12:37 2011 (r221284) @@ -1428,6 +1428,22 @@ cpususpend_handler(void) intr_restore(rf); } +void +md_assert_nopreempt(void) +{ +#ifdef INVARIANTS + struct thread *td; + register_t rflags; + + td = curthread; + rflags = read_rflags(); + + if ((rflags & PSL_I) != 0 && td->td_critnest <= 0) + panic("Preemption still allowed, thread %s\n", + (td->td_pinned <= 0) ? "not pinned" : "pinned"); +#endif +} + /* * This is called once the rest of the system is up and running and we're * ready to let the AP's out of the pen. Modified: projects/largeSMP/sys/amd64/include/smp.h ============================================================================== --- projects/largeSMP/sys/amd64/include/smp.h Sat Apr 30 23:02:17 2011 (r221283) +++ projects/largeSMP/sys/amd64/include/smp.h Sat Apr 30 23:12:37 2011 (r221284) @@ -64,6 +64,7 @@ void ipi_bitmap_handler(struct trapfram void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); void ipi_selected(cpumask_t cpus, u_int ipi); +void md_assert_nopreempt(void); u_int mp_bootaddress(u_int); int mp_grab_cpu_hlt(void); void smp_cache_flush(void); Modified: projects/largeSMP/sys/i386/i386/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/i386/i386/mp_machdep.c Sat Apr 30 23:02:17 2011 (r221283) +++ projects/largeSMP/sys/i386/i386/mp_machdep.c Sat Apr 30 23:12:37 2011 (r221284) @@ -1486,6 +1486,22 @@ cpustop_handler(void) } } +void +md_assert_nopreempt(void) +{ +#ifdef INVARIANTS + struct thread *td; + register_t rflags; + + td = curthread; + rflags = read_rflags(); + + if ((rflags & PSL_I) != 0 && td->td_critnest <= 0) + panic("Preemption still allowed, thread %s\n", + (td->td_pinned <= 0) ? "not pinned" : "pinned"); +#endif +} + /* * This is called once the rest of the system is up and running and we're * ready to let the AP's out of the pen. Modified: projects/largeSMP/sys/i386/include/smp.h ============================================================================== --- projects/largeSMP/sys/i386/include/smp.h Sat Apr 30 23:02:17 2011 (r221283) +++ projects/largeSMP/sys/i386/include/smp.h Sat Apr 30 23:12:37 2011 (r221284) @@ -65,6 +65,7 @@ void ipi_bitmap_handler(struct trapfram void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); void ipi_selected(cpumask_t cpus, u_int ipi); +void md_assert_nopreempt(void); u_int mp_bootaddress(u_int); int mp_grab_cpu_hlt(void); void smp_cache_flush(void); Modified: projects/largeSMP/sys/i386/xen/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/i386/xen/mp_machdep.c Sat Apr 30 23:02:17 2011 (r221283) +++ projects/largeSMP/sys/i386/xen/mp_machdep.c Sat Apr 30 23:12:37 2011 (r221284) @@ -1241,6 +1241,22 @@ cpustop_handler(void) } } +void +md_assert_nopreempt(void) +{ +#ifdef INVARIANTS + struct thread *td; + register_t rflags; + + td = curthread; + rflags = read_rflags(); + + if ((rflags & PSL_I) != 0 && td->td_critnest <= 0) + panic("Preemption still allowed, thread %s\n", + (td->td_pinned <= 0) ? "not pinned" : "pinned"); +#endif +} + /* * This is called once the rest of the system is up and running and we're * ready to let the AP's out of the pen.