From owner-svn-src-head@freebsd.org Thu May 26 21:25:43 2016 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 80060B4BFB9; Thu, 26 May 2016 21:25:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DCF2186B; Thu, 26 May 2016 21:25:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id u4QLPglV009394 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 26 May 2016 14:25:42 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id u4QLPfow009393; Thu, 26 May 2016 14:25:41 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 26 May 2016 14:25:41 -0700 From: Gleb Smirnoff To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300671 - in head/sys/compat/linuxkpi/common: include/linux src Message-ID: <20160526212541.GI58287@FreeBSD.org> References: <201605250904.u4P946CY055112@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201605250904.u4P946CY055112@repo.freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 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: Thu, 26 May 2016 21:25:43 -0000 Hi! The SCHEDULER_STOPPED() already has __predict_false() in it, so unlikely() is superfluous. On Wed, May 25, 2016 at 09:04:06AM +0000, Hans Petter Selasky wrote: H> Author: hselasky H> Date: Wed May 25 09:04:06 2016 H> New Revision: 300671 H> URL: https://svnweb.freebsd.org/changeset/base/300671 H> H> Log: H> Add checks for SCHEDULER_STOPPED() so that code using the LinuxKPI can H> run after a panic(). This for example allows a LinuxKPI based graphics H> stack to receive prints during a panic. H> H> Obtained from: kmacy @ H> MFC after: 1 week H> Sponsored by: Mellanox Technologies H> H> Modified: H> head/sys/compat/linuxkpi/common/include/linux/sched.h H> head/sys/compat/linuxkpi/common/include/linux/wait.h H> head/sys/compat/linuxkpi/common/src/linux_compat.c H> H> Modified: head/sys/compat/linuxkpi/common/include/linux/sched.h H> ============================================================================== H> --- head/sys/compat/linuxkpi/common/include/linux/sched.h Wed May 25 09:00:05 2016 (r300670) H> +++ head/sys/compat/linuxkpi/common/include/linux/sched.h Wed May 25 09:04:06 2016 (r300671) H> @@ -91,7 +91,7 @@ CTASSERT(sizeof(((struct thread *)0)->td H> do { \ H> void *c; \ H> \ H> - if (cold) \ H> + if (cold || SCHEDULER_STOPPED()) \ H> break; \ H> c = curthread; \ H> sleepq_lock(c); \ H> H> Modified: head/sys/compat/linuxkpi/common/include/linux/wait.h H> ============================================================================== H> --- head/sys/compat/linuxkpi/common/include/linux/wait.h Wed May 25 09:00:05 2016 (r300670) H> +++ head/sys/compat/linuxkpi/common/include/linux/wait.h Wed May 25 09:04:06 2016 (r300671) H> @@ -31,6 +31,7 @@ H> #ifndef _LINUX_WAIT_H_ H> #define _LINUX_WAIT_H_ H> H> +#include H> #include H> #include H> #include H> @@ -81,6 +82,8 @@ do { \ H> void *c = &(q).wchan; \ H> if (!(cond)) { \ H> for (;;) { \ H> + if (unlikely(SCHEDULER_STOPPED())) \ H> + break; \ H> sleepq_lock(c); \ H> if (cond) { \ H> sleepq_release(c); \ H> @@ -100,6 +103,8 @@ do { \ H> _error = 0; \ H> if (!(cond)) { \ H> for (; _error == 0;) { \ H> + if (unlikely(SCHEDULER_STOPPED())) \ H> + break; \ H> sleepq_lock(c); \ H> if (cond) { \ H> sleepq_release(c); \ H> @@ -123,6 +128,8 @@ do { \ H> \ H> if (!(cond)) { \ H> for (; __rc == 0;) { \ H> + if (unlikely(SCHEDULER_STOPPED())) \ H> + break; \ H> sleepq_lock(c); \ H> if (cond) { \ H> sleepq_release(c); \ H> H> Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c H> ============================================================================== H> --- head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 09:00:05 2016 (r300670) H> +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Wed May 25 09:04:06 2016 (r300671) H> @@ -1093,6 +1093,8 @@ linux_complete_common(struct completion H> long H> linux_wait_for_common(struct completion *c, int flags) H> { H> + if (unlikely(SCHEDULER_STOPPED())) H> + return (0); H> H> if (flags != 0) H> flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; H> @@ -1123,6 +1125,9 @@ linux_wait_for_timeout_common(struct com H> { H> long end = jiffies + timeout; H> H> + if (unlikely(SCHEDULER_STOPPED())) H> + return (0); H> + H> if (flags != 0) H> flags = SLEEPQ_INTERRUPTIBLE | SLEEPQ_SLEEP; H> else H> _______________________________________________ H> svn-src-all@freebsd.org mailing list H> https://lists.freebsd.org/mailman/listinfo/svn-src-all H> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" -- Totus tuus, Glebius.