From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752815AbdF0OqT (ORCPT ); Tue, 27 Jun 2017 10:46:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:46219 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752637AbdF0OpR (ORCPT ); Tue, 27 Jun 2017 10:45:17 -0400 Date: Tue, 27 Jun 2017 16:45:13 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Sergey Senozhatsky , Steven Rostedt , Jan Kara , Andrew Morton , Peter Zijlstra , "Rafael J . Wysocki" , Eric Biederman , Greg Kroah-Hartman , Jiri Slaby , Pavel Machek , Andreas Mohr , Tetsuo Handa , linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCHv3 5/5] printk: register PM notifier Message-ID: <20170627144513.GM1538@pathway.suse.cz> References: <20170509082859.854-1-sergey.senozhatsky@gmail.com> <20170509082859.854-6-sergey.senozhatsky@gmail.com> <20170530095521.GC30903@pathway.suse.cz> <20170531064224.GB7672@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170531064224.GB7672@jagdpanzerIV.localdomain> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2017-05-31 15:42:24, Sergey Senozhatsky wrote: > On (05/30/17 11:55), Petr Mladek wrote: > > BTW: Do you know about some locations that would need to be > > patched explicitly, for example, kexec? > > a tricky question and I need to think more. I'm a bit overloaded > with some other stuff now, sorry for long replies. Same here. > in case of kexec_image->preserve_context my assumption was that > PM would send out PM notifications. but it seems that I need to have > a second look. quite possible we will have to register yet another > PM notifier - add syscore_ops to syscore_ops_list via > register_syscore_ops() - the one that would be called from > syscore_suspend(). syscore_suspend() is called also in many other locations. Also it might be too late. For example, in the chain: hybernate() power_down() hibernation_platform_enter() syscore_suspend() PM_HIBERNATION_PREPARE notifiers are called much earlier in hybernate(). > the other branch invokes kernel_restart_prepare(), which updates > `system_statem' variable and we test it in console_offload_printing(). Sounds promissing. > some other cases also update `system_statem'. the exception is maybe > sysrq emergency restart. but I'm a bit uncertain here. on one hand the > expected emergency restart behavior is "just reboot the system, OK?", > on the other hand there are people who expect kernel log messages to > be flushed before that "just reboot the system" thing. > > > Some old versions of this patch touched console_suspend(). > > This brought me to snapshot_ioctl(). It looks like an > > API that allows to create snapshots from user space. > > I wonder if we should switch to the emergency mode > > there are well, probably in the SNAPSHOT_FREEZE > > stage. > > my assumption was that PM ioctl sends out PM notifications. > see snapshot_open()/snapshot_release(). Great catch! I have missed this. It seems that the open() funtion really has to be called before any ioctl() stuff and we are on the safe side. Best Regards, Petr