From owner-svn-src-head@freebsd.org Fri Jul 7 13:15:01 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 8FB9BDA32D0; Fri, 7 Jul 2017 13:15:01 +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 553EE79F99; Fri, 7 Jul 2017 13:15:01 +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 v67DF0Jq012117; Fri, 7 Jul 2017 13:15:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v67DF0lG012116; Fri, 7 Jul 2017 13:15:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201707071315.v67DF0lG012116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 7 Jul 2017 13:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320774 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 320774 X-SVN-Commit-Repository: base 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: Fri, 07 Jul 2017 13:15:01 -0000 Author: hselasky Date: Fri Jul 7 13:15:00 2017 New Revision: 320774 URL: https://svnweb.freebsd.org/changeset/base/320774 Log: Fix a bug in synchronize RCU when the calling thread is bound to a CPU. Set "td_pinned" to zero after "sched_unbind()" to prevent "td_pinned" from temporarily becoming negative during "sched_bind()". This can happen if "sched_bind()" uses "sched_pin()" and "sched_unpin()". 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 Fri Jul 7 12:03:58 2017 (r320773) +++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Fri Jul 7 13:15:00 2017 (r320774) @@ -299,8 +299,9 @@ 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_unbind(td); + td->td_pinned = 0; sched_bind(td, old_cpu); ck_epoch_synchronize_wait(&linux_epoch,