Re: [PATCH 2/2] Fix console handling during suspend/resume

Linus Torvalds
2006-06-15T22:41:01Z

On Fri, 16 Jun 2006, Pavel Machek wrote:
>
> ? No, I do not think we have any problems with temporary
> pointers. Memory snapshot is atomic (done on single CPU, with disabled
> interrupts, no DMAs).

The problem I'm trying to point out is that it's _not_ atomic wrt "save
the device state".

You've actually worked very hard to make "save device state" and "snapshot
memory" to be as atomic as possible - by having the device state save also
basically try to freeze the state.

And I'm trying to change that.

And that means that the resume must not restore any "temporary pointers".

Now, a lot of hardware doesn't _have_ temporary pointers, but if it has
things like a DMA ring with pointers to buffers (network drivers do this,
for example), then you need to realize that if the that ring is _not_
atomic wrt the memory snapshotting if packets were still coming in
(packets that you didn't even care about).

That's what I was trying to explain by talking about the memory management
issues. Things that you've tried to avoid by making "save and shut down"
be atomic.

And don't get me wrong - I don't think it's a fundamental problem per se.
It's an inconvenience that needs a strategy, and the strategy can range
from "refuse to do networking during suspend if we're suspendign to disk"
to "various MM things to make it easier to handle" to "if you use
networking during the suspend, you migth possibly leak some memory".

Linus