Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 2015 19:47:42 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r277796 - in head/sys: dev/acpica dev/syscons dev/vt sys
Message-ID:  <20150127174742.GI42409@kib.kiev.ua>
In-Reply-To: <201501271733.t0RHXJ3M058422@svn.freebsd.org>
References:  <201501271733.t0RHXJ3M058422@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150127174742.GI42409>