From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 17:47:49 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3224FD4E; Tue, 27 Jan 2015 17:47:49 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0E48C95; Tue, 27 Jan 2015 17:47:48 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t0RHlhe0089801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Jan 2015 19:47:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t0RHlhe0089801 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t0RHlhbN089800; Tue, 27 Jan 2015 19:47:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 27 Jan 2015 19:47:42 +0200 From: Konstantin Belousov To: Andriy Gapon Subject: Re: svn commit: r277796 - in head/sys: dev/acpica dev/syscons dev/vt sys Message-ID: <20150127174742.GI42409@kib.kiev.ua> References: <201501271733.t0RHXJ3M058422@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201501271733.t0RHXJ3M058422@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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: Tue, 27 Jan 2015 17:47:49 -0000 On Tue, Jan 27, 2015 at 05:33:19PM +0000, Andriy Gapon wrote: > Author: avg > Date: Tue Jan 27 17:33:18 2015 > New Revision: 277796 > URL: https://svnweb.freebsd.org/changeset/base/277796 > > Log: > hook userland threads suspend + resume into acpi suspend code > > Also, split power_suspend into power_suspend and power_suspend_early. > > power_suspend_early is called before the userland is frozen. > power_suspend is called after the userland is frozen. > > Currently only VT switching is hooked to power_suspend_early. > This is needed because switching away from X server requires its > cooperation, so obviously X server must not be frozen when that happens. > > Freezing userland during ACPI suspend is useful because not all drivers > correctly handle suspension concurrent with other activity. This is > especially applicable to drivers ported from other operating systems > that suspend all software activity between placing drivers and hardware > into suspended state. > In particular drm2/radeon (radeonkms) depends on the described > procedure. The driver does not have any internal synchronization > between suspension activities and processing of userland requests. > > Many thanks to kib for the code that allows to freeze and thaw all > userland threads. > > Note that ideally we also need to park / inhibit (non-special) kernel > threads as well to ensure that they do not call into drivers. > > MFC after: 17 days > > Modified: > head/sys/dev/acpica/acpi.c > head/sys/dev/syscons/syscons.c > head/sys/dev/vt/vt_core.c > head/sys/sys/eventhandler.h Thank you for fixing this. > > Modified: head/sys/dev/acpica/acpi.c > ============================================================================== > --- head/sys/dev/acpica/acpi.c Tue Jan 27 15:28:46 2015 (r277795) > +++ head/sys/dev/acpica/acpi.c Tue Jan 27 17:33:18 2015 (r277796) > @@ -2749,6 +2749,8 @@ acpi_EnterSleepState(struct acpi_softc * > return_ACPI_STATUS (AE_OK); > } > > + EVENTHANDLER_INVOKE(power_suspend_early); > + stop_all_proc(); It also makes sense to call syncer_suspend() after stop_all_proc(), I suppose. It would ensure that a failed resume still ends with the consistent filesystem metadata.