From owner-svn-src-all@freebsd.org Mon May 2 18:23:49 2016 Return-Path: Delivered-To: svn-src-all@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 ECDDDB2AD0A; Mon, 2 May 2016 18:23:49 +0000 (UTC) (envelope-from royger@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 A53C412DE; Mon, 2 May 2016 18:23:49 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u42INmvF092880; Mon, 2 May 2016 18:23:48 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u42INmKr092879; Mon, 2 May 2016 18:23:48 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201605021823.u42INmKr092879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Mon, 2 May 2016 18:23:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298934 - head/sys/dev/xen/control X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 May 2016 18:23:50 -0000 Author: royger Date: Mon May 2 18:23:48 2016 New Revision: 298934 URL: https://svnweb.freebsd.org/changeset/base/298934 Log: xen/control: improve suspend/resume Implement several small improvements to the suspend/resume Xen sequence: - Call the power_suspend_early event before stopping all processes. - Stop all processes. This was done implicitly previously by putting all the CPUs in a known IPI handler. - Warm up the timecounter. - Re-initialize the time of day register. Sponsored by: Citrix Systems R&D Modified: head/sys/dev/xen/control/control.c Modified: head/sys/dev/xen/control/control.c ============================================================================== --- head/sys/dev/xen/control/control.c Mon May 2 18:00:38 2016 (r298933) +++ head/sys/dev/xen/control/control.c Mon May 2 18:23:48 2016 (r298934) @@ -122,6 +122,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -197,6 +198,8 @@ xctrl_suspend() #endif int suspend_cancelled; + EVENTHANDLER_INVOKE(power_suspend_early); + stop_all_proc(); EVENTHANDLER_INVOKE(power_suspend); if (smp_started) { @@ -222,7 +225,6 @@ xctrl_suspend() printf("%s: device_suspend failed\n", __func__); return; } - mtx_unlock(&Giant); #ifdef SMP CPU_ZERO(&cpu_suspend_map); /* silence gcc */ @@ -273,16 +275,24 @@ xctrl_suspend() * FreeBSD really needs to add DEVICE_SUSPEND_CANCEL or * similar. */ - mtx_lock(&Giant); DEVICE_RESUME(root_bus); mtx_unlock(&Giant); + /* + * Warm up timecounter again and reset system clock. + */ + timecounter->tc_get_timecount(timecounter); + timecounter->tc_get_timecount(timecounter); + inittodr(time_second); + if (smp_started) { thread_lock(curthread); sched_unbind(curthread); thread_unlock(curthread); } + resume_all_proc(); + EVENTHANDLER_INVOKE(power_resume); if (bootverbose)