From owner-svn-src-head@freebsd.org Wed May 31 10:01:16 2017 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 8E519AFBD7C; Wed, 31 May 2017 10:01:16 +0000 (UTC) (envelope-from hselasky@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 5C9897191A; Wed, 31 May 2017 10:01:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4VA1Fk8057009; Wed, 31 May 2017 10:01:15 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4VA1FwI057008; Wed, 31 May 2017 10:01:15 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201705311001.v4VA1FwI057008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 31 May 2017 10:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319312 - head/sys/compat/linuxkpi/common/src 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.23 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: Wed, 31 May 2017 10:01:16 -0000 Author: hselasky Date: Wed May 31 10:01:15 2017 New Revision: 319312 URL: https://svnweb.freebsd.org/changeset/base/319312 Log: Make sure the thread's priority is restored for all three cases inside linux_synchronize_rcu_cb() in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_rcu.c Wed May 31 09:25:47 2017 (r319311) +++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Wed May 31 10:01:15 2017 (r319312) @@ -236,7 +236,6 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c if (record->cpuid == PCPU_GET(cpuid)) { bool is_sleeping = 0; u_char prio = 0; - u_char old_prio; /* * Find the lowest priority or sleeping thread which @@ -255,13 +254,10 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c pause("W", 1); thread_lock(td); } else { - old_prio = td->td_priority; /* set new thread priority */ sched_prio(td, prio); /* task switch */ mi_switch(SW_VOL | SWT_RELINQUISH, NULL); - /* restore thread priority */ - sched_prio(td, old_prio); } } else { /* @@ -282,6 +278,7 @@ linux_synchronize_rcu(void) int was_bound; int old_cpu; int old_pinned; + u_char old_prio; if (RCU_SKIP()) return; @@ -301,6 +298,7 @@ linux_synchronize_rcu(void) old_cpu = PCPU_GET(cpuid); old_pinned = td->td_pinned; + old_prio = td->td_priority; td->td_pinned = 0; was_bound = sched_is_bound(td); sched_bind(td, old_cpu); @@ -319,6 +317,9 @@ linux_synchronize_rcu(void) } /* restore pinned after bind */ td->td_pinned = old_pinned; + + /* restore thread priority */ + sched_prio(td, old_prio); thread_unlock(td); PICKUP_GIANT();