From owner-svn-src-head@freebsd.org Thu May 17 10:16:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5575AEE634D; Thu, 17 May 2018 10:16:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 094B377FF8; Thu, 17 May 2018 10:16:21 +0000 (UTC) (envelope-from avg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE55C27CDD; Thu, 17 May 2018 10:16:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4HAGKMw037617; Thu, 17 May 2018 10:16:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4HAGKre037616; Thu, 17 May 2018 10:16:20 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805171016.w4HAGKre037616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 17 May 2018 10:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333707 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 333707 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.26 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, 17 May 2018 10:16:21 -0000 Author: avg Date: Thu May 17 10:16:20 2018 New Revision: 333707 URL: https://svnweb.freebsd.org/changeset/base/333707 Log: fix a problem with bad performance after wakeup caused by r333321 This change reverts a "while here" part of r333321 that moved clearing of suspended_cpus to an earlier place. Apparently, there can be a problem when modifying (shared) memory before restoring proper cache attributes. So, to be safe, move the clearing to the old place. Many thanks to Johannes Lundberg for bisecting the changes to that particular commit and then bisecting the commit to the particular change. Reported by: many Debugged by: Johannes Lundberg MFC after: 1 week X-MFC with: r333321 Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu May 17 10:13:18 2018 (r333706) +++ head/sys/x86/x86/mp_x86.c Thu May 17 10:16:20 2018 (r333707) @@ -1457,8 +1457,6 @@ cpususpend_handler(void) */ wbinvd(); } else { - /* Indicate that we have restarted and restored the context. */ - CPU_CLR_ATOMIC(cpu, &suspended_cpus); #ifdef __amd64__ fpuresume(susppcbs[cpu]->sp_fpususpend); #else @@ -1468,6 +1466,9 @@ cpususpend_handler(void) initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); + + /* Indicate that we have restarted and restored the context. */ + CPU_CLR_ATOMIC(cpu, &suspended_cpus); } /* Wait for resume directive */