[PATCH 4/4] um: allow PM with suspend-to-idle

Johannes Berg johannes at sipsolutions.net
Sat Nov 21 04:42:03 EST 2020


On Sat, 2020-11-21 at 09:34 +0000, Anton Ivanov wrote:
> On 20/11/2020 21:33, Johannes Berg wrote:
> > On Fri, 2020-11-20 at 22:29 +0100, Johannes Berg wrote:
> > > From: Johannes Berg <johannes.berg at intel.com>
> > > 
> > > In order to be able to experiment with suspend in UML,
> > > add the minimal work to be able to suspend (s2idle) an
> > > instance of UML, and be able to wake it back up from
> > > that state with the USR1 signal sent to the main UML
> > > process.
> > 
> > So what I said about rtcwake ... maybe that's an argument for removing
> > the USR1 handling? I wasn't really too sure about it.
> > 
> > But on the other hand, typically real systems will have at least *some*
> > kind of wakeup source that you can manually use and that's always
> > enabled, perhaps the power button for example; the SIGUSR1 handling was
> > meant to simulate such a thing.
> 
> This usually translates to the IRQ controller being powered on even if 
> the rest of the machine is off and some lines being able to function 
> even in power down state.
> 
> Not that difficult actually. Going to sleep should just turn off all 
> relevant IRQs including de-registering fds. If you are not 
> de-registering the fds, the fact that it is turned off in the controller 
> will be of no use - it will be re-triggered.

Right. Now I have only s2idle where of course all this machinery is
still enabled, even if you had a real (say x86) system s2idle would
obviously not turn off any hardware.

> Waking up should restore the state.
> 
> Once that is in place, you can emulate the full PM sleep/wake up cycle.

Indeed. I'll continue work later. This was a one-day hack so far :-)

> Emulating suspend to disk is more interesting. I actually looked at it 
> many years ago and that looked nearly impossible to implement.

Hmmmm... That's going to be very tricky, if not impossible, due to you
being a new process when restoring, and then memory layout may differ, I
think?

Not a use case I care about for UML, TBH, though I did implement suspend
to disk for powerpc many years ago :-)

johannes




More information about the linux-um mailing list