Remove process freezer from suspend to RAM pathway
Subsystems (3)
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines
And teach VFS to block suspension, while waiting on a mutex held by another process performing a fuse operation.
I can already hear the beautiful praise from Al Viro at the sight of that ;)
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
And flag every other process, that the flagged process is communicating with? How are you proposing to do that?
Quoted 6 lines
Quoting Paul:
"1. The freezer cannot be guaranteed deadlock-free without constructing
a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable."
A deadlock requires that the circular wait is uninterruptible. Normal IPC isn't.
What are you doing in the userland portions of fuse? Some kind of IPC with other tasks? There is a limit to which you can push kernel functionality into user space.
Regards
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines
And teach VFS to block suspension, while waiting on a mutex held by another process performing a fuse operation.
I can already hear the beautiful praise from Al Viro at the sight of that ;)
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
And flag every other process, that the flagged process is communicating with? How are you proposing to do that?
Quoted 6 lines
Quoting Paul:
"1. The freezer cannot be guaranteed deadlock-free without constructing
a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable."
A deadlock requires that the circular wait is uninterruptible. Normal IPC isn't.
What are you doing in the userland portions of fuse? Some kind of IPC with other tasks? There is a limit to which you can push kernel functionality into user space.
Regards
Oliver
Quoted 22 lines
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines
And teach VFS to block suspension, while waiting on a mutex held by another process performing a fuse operation.
I can already hear the beautiful praise from Al Viro at the sight of that ;)
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
And flag every other process, that the flagged process is communicating with? How are you proposing to do that?
Quoted 6 lines
Quoting Paul:
"1. The freezer cannot be guaranteed deadlock-free without constructing
a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable."
Quoted 5 lines
A deadlock requires that the circular wait is uninterruptible. Normal IPC isn't.
What are you doing in the userland portions of fuse? Some kind of IPC with other tasks?
Anything, writing to a file, writing to shared memory, sending things over the network. There's no limit to what a filesystem daemon may do. It's a perfectly ordinary unprivileged userspace process. And this is a feature not a bug.
Quoted 2 lines
There is a limit to which you can push kernel functionality into user space.
Limiting what a userspace filesystem can do would defeat the whole purpose of the bloody thing. This is not negotiable ;)
Miklos
Re: The big suspend mess
In reply to Pavel MachekQuoted 8 lines · Pavel Machek
Quoted 6 lines · Paul Mackerras
Quoted 3 lines · Pavel Machek
0. Get someone to sign up as a maintainer for suspend, so we have someone to blame for the mess? :-)
Quoted 7 lines
Quoted 2 lines
I thought that was Rafael?
Rafael is good job trying to fix suspend when he can, but we do not actually have "SUSPEND" entry in
MAINTAINERSfile.
Pavel
Huch ?;)
We do :p
...
SOFTWARE SUSPEND:
P: Pavel Machek
M: [email protected]
L: [email protected]
S: Maintained
...
Re: The big suspend mess
Hi.
Quoted 21 lines · Gabriel C
Quoted 8 lines · Pavel Machek
Quoted 6 lines · Paul Mackerras
Quoted 3 lines · Pavel Machek
0. Get someone to sign up as a maintainer for suspend, so we have someone to blame for the mess? :-)
Quoted 7 lines
Quoted 2 lines
I thought that was Rafael?
Rafael is good job trying to fix suspend when he can, but we do not actually have "SUSPEND" entry in
MAINTAINERSfile.
PavelHuch ?;)
We do :p
Quoted 8 lines
...
SOFTWARE SUSPEND:
P: Pavel Machek
M: [email protected]
L: [email protected]
S: Maintained
I think he means SUSPEND (aka suspend-to-ram) not "SOFTWARE SUSPEND" (aka suspend-to-disk)
Re: The big suspend mess
In reply to Gabriel CHi.
Quoted 21 lines · Gabriel C
Quoted 8 lines · Pavel Machek
Quoted 6 lines · Paul Mackerras
Quoted 3 lines · Pavel Machek
0. Get someone to sign up as a maintainer for suspend, so we have someone to blame for the mess? :-)
Quoted 7 lines
Quoted 2 lines
I thought that was Rafael?
Rafael is good job trying to fix suspend when he can, but we do not actually have "SUSPEND" entry in
MAINTAINERSfile.
PavelHuch ?;)
We do :p
Quoted 8 lines
...
SOFTWARE SUSPEND:
P: Pavel Machek
M: [email protected]
L: [email protected]
S: Maintained
I think he means SUSPEND (aka suspend-to-ram) not "SOFTWARE SUSPEND" (aka suspend-to-disk)
Quoted 15 lines · Miklos Szeredi
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines
And teach VFS to block suspension, while waiting on a mutex held by another process performing a fuse operation.
I can already hear the beautiful praise from Al Viro at the sight of that ;)
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
And flag every other process, that the flagged process is communicating with? How are you proposing to do that?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoting Paul:
"1. The freezer cannot be guaranteed deadlock-free without constructing
a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable."
This statement is ganarally false.
There is the limitation in the freezer that it cannot handle uninterruptible tasks and that's all.
Now, this is not usual for user space tasks to make other user space tasks become uninterruptible. I'd say this is a little strange.
Quoted 11 lines
Quoted 5 lines
A deadlock requires that the circular wait is uninterruptible. Normal IPC isn't.
What are you doing in the userland portions of fuse? Some kind of IPC with other tasks?
Anything, writing to a file, writing to shared memory, sending things over the network. There's no limit to what a filesystem daemon may do. It's a perfectly ordinary unprivileged userspace process. And this is a feature not a bug.
Quoted 5 lines
Quoted 2 lines
There is a limit to which you can push kernel functionality into user space.
Limiting what a userspace filesystem can do would defeat the whole purpose of the bloody thing. This is not negotiable ;)
Which doesn't change the fact that FUSE _is_ special, because it adds dependencies between processed that were not present before.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 15 lines · Miklos Szeredi
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines
Quoted 5 lines
And teach VFS to block suspension, while waiting on a mutex held by another process performing a fuse operation.
I can already hear the beautiful praise from Al Viro at the sight of that ;)
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
And flag every other process, that the flagged process is communicating with? How are you proposing to do that?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoting Paul:
"1. The freezer cannot be guaranteed deadlock-free without constructing
a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable."
This statement is ganarally false.
There is the limitation in the freezer that it cannot handle uninterruptible tasks and that's all.
Now, this is not usual for user space tasks to make other user space tasks become uninterruptible. I'd say this is a little strange.
Quoted 11 lines
Quoted 5 lines
A deadlock requires that the circular wait is uninterruptible. Normal IPC isn't.
What are you doing in the userland portions of fuse? Some kind of IPC with other tasks?
Anything, writing to a file, writing to shared memory, sending things over the network. There's no limit to what a filesystem daemon may do. It's a perfectly ordinary unprivileged userspace process. And this is a feature not a bug.
Quoted 5 lines
Quoted 2 lines
There is a limit to which you can push kernel functionality into user space.
Limiting what a userspace filesystem can do would defeat the whole purpose of the bloody thing. This is not negotiable ;)
Which doesn't change the fact that FUSE _is_ special, because it adds dependencies between processed that were not present before.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines · Paul Mackerras
Quoted 4 lines · Rafael J. Wysocki
This is incompatible with the code in
kernel/power/main.c, since we only disable the nonboot CPUs after devices have been suspended. Do you think that your framework can be modified to work without disabling the nonboot CPUs by the user space?
Quoted 6 lines
Sure. It was a "if it can be done in userspace, do it in userspace" kind of decision, but I'm not wedded to it.
I actually do want to converge to using the generic suspend-to-ram code on powerbooks. I just want to avoid causing regressions for powerbook users, including myself. :)
Okay, but my question is this: Would that be possible, within your framework, to disable the nonboot CPUs _after_ suspending devices?
Can you please point me to your high-level suspend code?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 35 lines · Miklos Szeredi
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
I have discussed the benefits elsewhere. As for the deadlocks -- do you still observe them if you use the version of the freezer which doesn't freeze kernel threads?
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyQuoted 8 lines
Quoted 2 lines
Now process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Quoted 6 lines
Quoted 1 line
So no, you can't claim "FUSE is just IPC". It is very special IPC.
I did say it's special. Sure, it has some "interesting" properties, and with a bit of malice you can do very ugly things with it. If you are interested, read
Documentation/filesystems/fuse.txt, especially the "Tricky deadlock" section ;)
Very well.
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Hi!
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyNow process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.
Quoted 8 lines
Quoted 5 lines
Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick try_to_freeze() at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.
Plus, it would be nice to find out where suspend/hibernation is triggering fuse activity. We can then decide where to fix it -- in fuse or in suspend parts. You said sys_sync is not implemented... so where is the problem?
Quoted 6 lines
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Well, unix is not plan9, and maybe userland filesystems are impossible in unix. But that is hardly a bug in unix :-).
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 5 lines
Quoted 2 lines
Limiting what a userspace filesystem can do would defeat the whole purpose of the bloody thing. This is not negotiable ;)
Which doesn't change the fact that FUSE _is_ special, because it adds dependencies between processed that were not present before.
OK, fuse is special. So is the userspace driver framework (UIO) proposed by Greg KH and co. Now what can be done about these?
- making them not-special is not an option due to the established interfaces, which don't allow restartability.
- fixing the freezer is pretty much impossible because the dependencies between the tasks cannot be known.
- removing the freezer and fixing the drivers seems workable, we already have a prototype in the form of the powermac architecture.
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Miklos
Hi!
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyNow process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.
Quoted 8 lines
Quoted 5 lines
Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick try_to_freeze() at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.
Plus, it would be nice to find out where suspend/hibernation is triggering fuse activity. We can then decide where to fix it -- in fuse or in suspend parts. You said sys_sync is not implemented... so where is the problem?
Quoted 6 lines
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Well, unix is not plan9, and maybe userland filesystems are impossible in unix. But that is hardly a bug in unix :-).
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Paul Mackerras
Quoted 4 lines · Rafael J. Wysocki
This is incompatible with the code in
kernel/power/main.c, since we only disable the nonboot CPUs after devices have been suspended. Do you think that your framework can be modified to work without disabling the nonboot CPUs by the user space?
Quoted 6 lines
Sure. It was a "if it can be done in userspace, do it in userspace" kind of decision, but I'm not wedded to it.
I actually do want to converge to using the generic suspend-to-ram code on powerbooks. I just want to avoid causing regressions for powerbook users, including myself. :)
Okay, but my question is this: Would that be possible, within your framework, to disable the nonboot CPUs _after_ suspending devices?
Can you please point me to your high-level suspend code?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 35 lines · Miklos Szeredi
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
I have discussed the benefits elsewhere. As for the deadlocks -- do you still observe them if you use the version of the freezer which doesn't freeze kernel threads?
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyQuoted 8 lines
Quoted 2 lines
Now process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Quoted 6 lines
Quoted 1 line
So no, you can't claim "FUSE is just IPC". It is very special IPC.
I did say it's special. Sure, it has some "interesting" properties, and with a bit of malice you can do very ugly things with it. If you are interested, read
Documentation/filesystems/fuse.txt, especially the "Tricky deadlock" section ;)
Very well.
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.
I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
And even if the ordering were solved, the freezer would still not work if the filesystem is not responding due to external events, such as a lost network (this affects NFS, CIFS, whatever just the same as fuse).
Quoted 4 lines
Plus, it would be nice to find out where suspend/hibernation is triggering fuse activity. We can then decide where to fix it -- in fuse or in suspend parts. You said
sys_syncis not implemented... so where is the problem?
I cannot say without having a sysrq-t of the situation.
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Well, unix is not plan9, and maybe userland filesystems are impossible in unix. But that is hardly a bug in unix :-).
I'd rather say, reliable suspend to ram is impossible in the presense of userspace filesystems, iff people are too lazy to fix the suspend framework and the drivers to work without the freezer.
This has nothing to do with unix, if plan9 would need to support STR or hibernate, it would face exactly the same problems.
Miklos
Re: The big suspend mess
In reply to Adrian BunkQuoted 16 lines · Adrian Bunk
Quoted 8 lines · Pavel Machek
Quoted 5 lines
IMHO the suspend code is currently way too much of a moving target which results in this mess.
The correct order seems to be:
0. Get someone to sign up as a maintainer for suspend, so we have someone to blame for the mess? :-)
The "SOFTWARE SUSPEND" entry in
MAINTAINERSalready contains a victim... ;-)My impression is that suspend is an area of the kernel that does not lack maintainers - you and Rafael are doing a good job, and there's e.g. also the maintained code formerly known as suspend2.
Quoted 7 lines
But some basic questions like e.g.
- What should be done in the kernel and what in userspace?
- How should this be implemented?
- What must subsystems and drivers do?
- What must subsystems and drivers not do?
seem to be in a constant flux because the big picture everyone agrees upon seems to be missing.
Well, to some extent I agree, but that's because it's difficult to reach such an agreement and if we have one, new poeple come with new ideas and we need to start all over again. :-)
In the meantime, problems are reported that need to be fixed and the fixes often break other systems and we learn about that too late ect.
As far as the big picture is concerned, we have already agreed, or at least this is my impression, that we need to separate the drivers' suspend callbacks (as they exist today) from their hibernation callbacks (not present yet).
This seems to be needed for a couple of reasons, the first of them being that the desired functionality of the hibernation code may be substantially different from the desired functionality of the suspend code. For instance, it generally is not necessary to put devices into low power states, or to power them off, in order to create the hibernation image, while it is necessary to do that for a suspend.
It will require us to redesign the core quite a bit and I've already started to prepare for that. I really would like to do that in the first place and _then_ to think of improving both the suspend and hibernation code paths _separately_. This way, we can do things more easily and in a much more clean way.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 15 lines · Pavel Machek
Quoted 6 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 5 lines
Quoted 2 lines
And a further question. The freezer is not atomic. What do you do if a task not yet frozen calls
sys_sync(), but fuse is already frozen?What do you do if a task not yet frozen writes to a pipe, on the other end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 4 lines
Quoted 3 lines
It doesn't matter. The only thing that should matter during suspend (not hibernate) is saving the state of devices to ram, and putting the devices to sleep.
Quoted 5 lines
Quoted 2 lines
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.
In fact, I'd like to remove the sys_sync() from the freezer entirely, because it just doesn't belong in there.
The only advantege of having sys_sync() in freeze_processes() is that we have a chance to write out everything when applications cannot produce more data to write, but there are filesystems which don't do that anyway (eg. XFS), so generally there's no reason to bother.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: The big suspend mess
In reply to Adrian BunkQuoted 16 lines · Adrian Bunk
Quoted 8 lines · Pavel Machek
Quoted 5 lines
IMHO the suspend code is currently way too much of a moving target which results in this mess.
The correct order seems to be:
0. Get someone to sign up as a maintainer for suspend, so we have someone to blame for the mess? :-)
The "SOFTWARE SUSPEND" entry in
MAINTAINERSalready contains a victim... ;-)My impression is that suspend is an area of the kernel that does not lack maintainers - you and Rafael are doing a good job, and there's e.g. also the maintained code formerly known as suspend2.
Quoted 7 lines
But some basic questions like e.g.
- What should be done in the kernel and what in userspace?
- How should this be implemented?
- What must subsystems and drivers do?
- What must subsystems and drivers not do?
seem to be in a constant flux because the big picture everyone agrees upon seems to be missing.
Well, to some extent I agree, but that's because it's difficult to reach such an agreement and if we have one, new poeple come with new ideas and we need to start all over again. :-)
In the meantime, problems are reported that need to be fixed and the fixes often break other systems and we learn about that too late ect.
As far as the big picture is concerned, we have already agreed, or at least this is my impression, that we need to separate the drivers' suspend callbacks (as they exist today) from their hibernation callbacks (not present yet).
This seems to be needed for a couple of reasons, the first of them being that the desired functionality of the hibernation code may be substantially different from the desired functionality of the suspend code. For instance, it generally is not necessary to put devices into low power states, or to power them off, in order to create the hibernation image, while it is necessary to do that for a suspend.
It will require us to redesign the core quite a bit and I've already started to prepare for that. I really would like to do that in the first place and _then_ to think of improving both the suspend and hibernation code paths _separately_. This way, we can do things more easily and in a much more clean way.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 9 lines · Paul Mackerras
Quoted 4 lines · Rafael J. Wysocki
They will not trigger 100% of the time, but sporadically and generally at random.
At least the freezer problems are reproducible. ;-)
Our experience with powermacs has been that it isn't actually all that hard to get it right for the drivers you care about.
Well, I'm a bit suspicious about that. ;-)
Namely, if you run your suspend code on one CPU and (do I remeber correctly that?) with kernel preemption disabled, then you practically prevent user land processes from being scheduled when your suspend code is running.
If that is the case (of which I'm not sure), the freezer is obviously unnecessary, because you've taken processes out of the equation in a different way ...
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
Miklos
Quoted 15 lines · Pavel Machek
Quoted 6 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 5 lines
Quoted 2 lines
And a further question. The freezer is not atomic. What do you do if a task not yet frozen calls
sys_sync(), but fuse is already frozen?What do you do if a task not yet frozen writes to a pipe, on the other end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 4 lines
Quoted 3 lines
It doesn't matter. The only thing that should matter during suspend (not hibernate) is saving the state of devices to ram, and putting the devices to sleep.
Quoted 5 lines
Quoted 2 lines
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.
In fact, I'd like to remove the sys_sync() from the freezer entirely, because it just doesn't belong in there.
The only advantege of having sys_sync() in freeze_processes() is that we have a chance to write out everything when applications cannot produce more data to write, but there are filesystems which don't do that anyway (eg. XFS), so generally there's no reason to bother.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 5 lines · Miklos Szeredi
Quoted 5 lines
Quoted 4 lines
Pro-freezers say:
- don't remove the freezer, otherwise we'll have to deal with numerous problems in drivers
Quoted 7 lines
Quoted 2 lines
And these problems will generally be difficult to reproduce reliably and debug.
I see exactly the opposite.
With the freezer I can have very rarely occuring failures, due to freeze ordering effects.
The "freezer ordering effects" only affect uninterruptible tasks.
Quoted 4 lines
And without the freezer I have a 100% reproducable problem, that is not hard to fix according to Alan Stern. OK, I don't know what the next problem would be, but the powermac experience shows, that it's not nearly as bad as you and Oliver try to make it out.
The powermac need not be a good example due to the different code ordering (it's run on one CPU only, which makes the probability of triggering a race be quite low).
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Can this be fixed?
It seems to be a fundamental problem with the freezer: while it does make sure that user processes are not calling into drivers during suspend, it also disallows perfectly harmless non-driver calls as well.
The problem is that when the freezer was designed (I didn't do that, BTW), there was no FUSE and similar things, so it's not prepared to cope with such interdependencies between user space tasks.
Quoted 6 lines
Quoted 2 lines
We had an analogous problem with
vfork()and it was solved by using thePF_FREEZER_SKIPflag. Perhaps we can do similar thing with FUSE.It cannot be just worked around in fuse, as a task might be sleeping on a number of VFS mutexes as well (
i_mutex,s_vfs_rename_mutex, etc). It would be a gigantic hack, possible at all.
Well, obviously FUSE and the freezer don't play well together, but that's FUSE who's late in the game (the freezer was here before). ;-)
If you give me some time, I'll see what can be done.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Hi.
Quoted 5 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 4 lines · Pavel Machek
Quoted 3 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 2 lines
Quoted 2 lines
And a further question. The freezer is not atomic. What do you do if a task not yet frozen calls
sys_sync(), but fuse is already
frozen?
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
What do you do if a task not yet frozen writes to a pipe, on the other end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 4 lines
Quoted 3 lines
It doesn't matter. The only thing that should matter during suspend (not hibernate) is saving the state of devices to ram, and putting the devices to sleep.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.In fact, I'd like to remove the
sys_sync()from the freezer entirely,
because
Quoted 5 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot produce more data to write, but there are filesystems which don't do that anyway (eg.
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync data and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse processes can be made to sync if they do have any pending I/O, and by which they can be frozen later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably invoke sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Hi.
Quoted 5 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 4 lines · Pavel Machek
Quoted 3 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 2 lines
Quoted 2 lines
And a further question. The freezer is not atomic. What do you do if a task not yet frozen calls
sys_sync(), but fuse is already
frozen?
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
What do you do if a task not yet frozen writes to a pipe, on the other end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 4 lines
Quoted 3 lines
It doesn't matter. The only thing that should matter during suspend (not hibernate) is saving the state of devices to ram, and putting the devices to sleep.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.In fact, I'd like to remove the
sys_sync()from the freezer entirely,
because
Quoted 5 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot produce more data to write, but there are filesystems which don't do that anyway (eg.
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync data and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse processes can be made to sync if they do have any pending I/O, and by which they can be frozen later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably invoke sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Quoted 5 lines · Miklos Szeredi
Quoted 5 lines
Quoted 4 lines
Pro-freezers say:
- don't remove the freezer, otherwise we'll have to deal with numerous problems in drivers
Quoted 7 lines
Quoted 2 lines
And these problems will generally be difficult to reproduce reliably and debug.
I see exactly the opposite.
With the freezer I can have very rarely occuring failures, due to freeze ordering effects.
The "freezer ordering effects" only affect uninterruptible tasks.
Quoted 4 lines
And without the freezer I have a 100% reproducable problem, that is not hard to fix according to Alan Stern. OK, I don't know what the next problem would be, but the powermac experience shows, that it's not nearly as bad as you and Oliver try to make it out.
The powermac need not be a good example due to the different code ordering (it's run on one CPU only, which makes the probability of triggering a race be quite low).
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Can this be fixed?
It seems to be a fundamental problem with the freezer: while it does make sure that user processes are not calling into drivers during suspend, it also disallows perfectly harmless non-driver calls as well.
The problem is that when the freezer was designed (I didn't do that, BTW), there was no FUSE and similar things, so it's not prepared to cope with such interdependencies between user space tasks.
Quoted 6 lines
Quoted 2 lines
We had an analogous problem with
vfork()and it was solved by using thePF_FREEZER_SKIPflag. Perhaps we can do similar thing with FUSE.It cannot be just worked around in fuse, as a task might be sleeping on a number of VFS mutexes as well (
i_mutex,s_vfs_rename_mutex, etc). It would be a gigantic hack, possible at all.
Well, obviously FUSE and the freezer don't play well together, but that's FUSE who's late in the game (the freezer was here before). ;-)
If you give me some time, I'll see what can be done.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
PF_FREEZER_SKIPflag. Perhaps we can do similar thing with FUSE.It cannot be just worked around in fuse, as a task might be sleeping on a number of VFS mutexes as well (
i_mutex,s_vfs_rename_mutex, etc). It would be a gigantic hack, possible at all.Well, obviously FUSE and the freezer don't play well together, but that's FUSE who's late in the game (the freezer was here before). ;-)
Umm, and CODA which is _very_ similar to fuse was there long before fuse or the freezer ;)
Quoted 1 line
If you give me some time, I'll see what can be done.
I give you all the time in the world. I'd also be willing to help with drivers for which I have the hardware.
Miklos
Quoted 14 lines · Paul Mackerras
Quoted 12 lines · Miklos Szeredi
OK, let me summarize the situation as I see it now: there are two camps, the pro-freezers and the anti-freezers.
Pro-freezers say:
- don't remove the freezer, otherwise we'll have to deal with numerous problems in drivers
Anti-freezers say:
- let's remove the freezer, which causes numerous problems
Quoted 7 lines
Quoted 2 lines
Alan summerized the pro-freezer arguments well I think. What are the anti-freezer arguments then?
1. The freezer cannot be guaranteed deadlock-free without constructing a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable.
I don't agree with that.
The freezer only fails to handle uninterruptible tasks, so we need to take the situations in which an uninterruptible task waits for a frozen task into consideration. Now, if both tasks are from the user land, this is highly unusual.
Quoted 3 lines
2. As a consequence of (1), we try to make a crude approximation of the graph by saying "only kernel threads that want to be frozen will be frozen" or some other similar statement.
No. The rule is that kernel threads should not be freezable, but there are some for which that is useful.
Quoted 3 lines
3. However, (2) means that we can no longer guarantee that drivers will not get any I/O requests after their suspend method has been called, and therefore the freezer fails in its main objective.
This is a very general statement. Can you please give some examples?
Quoted 2 lines
4. We have an existence proof that reliable suspend can be achieved without the freezer.
No. We only know that it might work if the nonboot CPUs are disabled before suspending devices, which is not the case in the generic suspend code.
Quoted 2 lines
To summarize, the argument is that the freezer is deadlock-prone and ineffective.
I remain unconvinced. ;-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines · Paul Mackerras
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
Because you have only one CPU running while your suspend code is being executed?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
Because you have only one CPU running while your suspend code is being executed?
If that's really all the problem then what's wrong with just unplugging the other CPUs earlier? Sure, that makes suspend no longer perfectly transparent since userspace might notice the CPUs being unplugged, but it has to cope with that anyway since a user can do it manually...
johannes
Quoted 14 lines · Paul Mackerras
Quoted 12 lines · Miklos Szeredi
OK, let me summarize the situation as I see it now: there are two camps, the pro-freezers and the anti-freezers.
Pro-freezers say:
- don't remove the freezer, otherwise we'll have to deal with numerous problems in drivers
Anti-freezers say:
- let's remove the freezer, which causes numerous problems
Quoted 7 lines
Quoted 2 lines
Alan summerized the pro-freezer arguments well I think. What are the anti-freezer arguments then?
1. The freezer cannot be guaranteed deadlock-free without constructing a dependency graph between tasks (both user and kernel), which is virtually impossible since the dependencies are not externally observable.
I don't agree with that.
The freezer only fails to handle uninterruptible tasks, so we need to take the situations in which an uninterruptible task waits for a frozen task into consideration. Now, if both tasks are from the user land, this is highly unusual.
Quoted 3 lines
2. As a consequence of (1), we try to make a crude approximation of the graph by saying "only kernel threads that want to be frozen will be frozen" or some other similar statement.
No. The rule is that kernel threads should not be freezable, but there are some for which that is useful.
Quoted 3 lines
3. However, (2) means that we can no longer guarantee that drivers will not get any I/O requests after their suspend method has been called, and therefore the freezer fails in its main objective.
This is a very general statement. Can you please give some examples?
Quoted 2 lines
4. We have an existence proof that reliable suspend can be achieved without the freezer.
No. We only know that it might work if the nonboot CPUs are disabled before suspending devices, which is not the case in the generic suspend code.
Quoted 2 lines
To summarize, the argument is that the freezer is deadlock-prone and ineffective.
I remain unconvinced. ;-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
Because you have only one CPU running while your suspend code is being executed?
If that's really all the problem then what's wrong with just unplugging the other CPUs earlier? Sure, that makes suspend no longer perfectly transparent since userspace might notice the CPUs being unplugged, but it has to cope with that anyway since a user can do it manually...
johannes
Quoted 7 lines · Paul Mackerras
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
Because you have only one CPU running while your suspend code is being executed?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 12 lines · Miklos Szeredi
Quoted 5 lines
Quoted 2 lines
Limiting what a userspace filesystem can do would defeat the whole purpose of the bloody thing. This is not negotiable ;)
Which doesn't change the fact that FUSE _is_ special, because it adds dependencies between processed that were not present before.
OK, fuse is special. So is the userspace driver framework (UIO) proposed by Greg KH and co. Now what can be done about these?
- making them not-special is not an option due to the established interfaces, which don't allow restartability.
Quoted 8 lines
- fixing the freezer is pretty much impossible because the dependencies between the tasks cannot be known.
- removing the freezer and fixing the drivers seems workable, we already have a prototype in the form of the powermac architecture.
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Yes, that's pretty clear cut, but we should start from fixing the drivers. :-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 29 lines · Miklos Szeredi
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
And even if the ordering were solved, the freezer would still not work if the filesystem is not responding due to external events, such as a lost network (this affects NFS, CIFS, whatever just the same as fuse).
Quoted 4 lines
Plus, it would be nice to find out where suspend/hibernation is triggering fuse activity. We can then decide where to fix it -- in fuse or in suspend parts. You said
sys_syncis not implemented... so where is the problem?I cannot say without having a sysrq-t of the situation.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Quoted 6 lines
Quoted 2 lines
Well, unix is not plan9, and maybe userland filesystems are impossible in unix. But that is hardly a bug in unix :-).
I'd rather say, reliable suspend to ram is impossible in the presense of userspace filesystems, iff people are too lazy to fix the suspend framework and the drivers to work without the freezer.
Well, I don't think it has anything to do with laziness or things like that. Rather, people have limited time and this requires some knowledge about drivers you're modifying, so not many people really can do that.
Also, you've already assumed that there's no other solution, but I'm not convinced about that yet.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 12 lines · Miklos Szeredi
Quoted 5 lines
Quoted 2 lines
Limiting what a userspace filesystem can do would defeat the whole purpose of the bloody thing. This is not negotiable ;)
Which doesn't change the fact that FUSE _is_ special, because it adds dependencies between processed that were not present before.
OK, fuse is special. So is the userspace driver framework (UIO) proposed by Greg KH and co. Now what can be done about these?
- making them not-special is not an option due to the established interfaces, which don't allow restartability.
Quoted 8 lines
- fixing the freezer is pretty much impossible because the dependencies between the tasks cannot be known.
- removing the freezer and fixing the drivers seems workable, we already have a prototype in the form of the powermac architecture.
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Yes, that's pretty clear cut, but we should start from fixing the drivers. :-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 6 lines · Miklos Szeredi
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
So, how about eliminating them?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 29 lines · Miklos Szeredi
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
And even if the ordering were solved, the freezer would still not work if the filesystem is not responding due to external events, such as a lost network (this affects NFS, CIFS, whatever just the same as fuse).
Quoted 4 lines
Plus, it would be nice to find out where suspend/hibernation is triggering fuse activity. We can then decide where to fix it -- in fuse or in suspend parts. You said
sys_syncis not implemented... so where is the problem?I cannot say without having a sysrq-t of the situation.
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
That's very special, and maybe even a FUSE bug. And that is also what makes FUSE special w.r.t. s2ram.
What makes fuse special is that some file operations are synchronous and non-restartable. That's just how the UNIX filesystem API works and is hardly a bug in fuse.
Quoted 6 lines
Quoted 2 lines
Well, unix is not plan9, and maybe userland filesystems are impossible in unix. But that is hardly a bug in unix :-).
I'd rather say, reliable suspend to ram is impossible in the presense of userspace filesystems, iff people are too lazy to fix the suspend framework and the drivers to work without the freezer.
Well, I don't think it has anything to do with laziness or things like that. Rather, people have limited time and this requires some knowledge about drivers you're modifying, so not many people really can do that.
Also, you've already assumed that there's no other solution, but I'm not convinced about that yet.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 39 lines · Nigel Cunningham
Hi.
Quoted 5 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 4 lines · Pavel Machek
Quoted 3 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 2 lines
Quoted 2 lines
And a further question. The freezer is not atomic. What do you do if a task not yet frozen calls
sys_sync(), but fuse is alreadyfrozen?
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
What do you do if a task not yet frozen writes to a pipe, on the other end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 4 lines
Quoted 3 lines
It doesn't matter. The only thing that should matter during suspend (not hibernate) is saving the state of devices to ram, and putting the devices to sleep.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.In fact, I'd like to remove the
sys_sync()from the freezer entirely,because
Quoted 5 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot produce more data to write, but there are filesystems which don't do that anyway (eg.XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync data and if XFS isn't doing that, it's wrong.
Quoted 8 lines
In the case of fuse, we should have a mechanism by which fuse processes can be made to sync if they do have any pending I/O, and by which they can be frozen later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably invoke sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error = freeze_processes();
etc.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Am Donnerstag, 5. Juli 2007 schrieb Rafael J. Wysocki:
Quoted 4 lines
Quoted 2 lines
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Yes, that's pretty clear cut, but we should start from fixing the drivers. :-)
If, at a minimum, we can determine that we can STD without a freezer. It makes no sense to invest a lot of work to face the same problem again with STD.
Regards
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Rafael J. Wysocki:
Quoted 4 lines
Quoted 2 lines
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Yes, that's pretty clear cut, but we should start from fixing the drivers. :-)
If, at a minimum, we can determine that we can STD without a freezer. It makes no sense to invest a lot of work to face the same problem again with STD.
Regards
Oliver
Quoted 6 lines · Miklos Szeredi
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
So, how about eliminating them?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 39 lines · Nigel Cunningham
Hi.
Quoted 5 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 4 lines · Pavel Machek
Quoted 3 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 2 lines
Quoted 2 lines
And a further question. The freezer is not atomic. What do you do if a task not yet frozen calls
sys_sync(), but fuse is alreadyfrozen?
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Quoted 3 lines
What do you do if a task not yet frozen writes to a pipe, on the other end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 4 lines
Quoted 3 lines
It doesn't matter. The only thing that should matter during suspend (not hibernate) is saving the state of devices to ram, and putting the devices to sleep.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.In fact, I'd like to remove the
sys_sync()from the freezer entirely,because
Quoted 5 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot produce more data to write, but there are filesystems which don't do that anyway (eg.XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync data and if XFS isn't doing that, it's wrong.
Quoted 8 lines
In the case of fuse, we should have a mechanism by which fuse processes can be made to sync if they do have any pending I/O, and by which they can be frozen later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably invoke sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error = freeze_processes();
etc.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Hi.
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do you
do
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse is alreadyfrozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on the
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and putting
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
In fact, I'd like to remove the
sys_sync()from the freezer entirely,because
Quoted 4 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot produce
more
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
data to write, but there are filesystems which don't do that anyway (eg.
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse processes
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 4 lines
Quoted 4 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 8 lines
Quoted 2 lines
sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();
Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never a problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll be more unsynced data when you sys_sync call finishes). Stopping userspace before syncing removes that race.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Hi.
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do you
do
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse is alreadyfrozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on the
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and putting
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
In fact, I'd like to remove the
sys_sync()from the freezer entirely,because
Quoted 4 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot produce
more
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
data to write, but there are filesystems which don't do that anyway (eg.
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse processes
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 4 lines
Quoted 4 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 8 lines
Quoted 2 lines
sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();
Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never a problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll be more unsynced data when you sys_sync call finishes). Stopping userspace before syncing removes that race.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Quoted 8 lines · Johannes Berg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
Quoted 7 lines
Quoted 2 lines
Because you have only one CPU running while your suspend code is being executed?
If that's really all the problem then what's wrong with just unplugging the other CPUs earlier? Sure, that makes suspend no longer perfectly transparent since userspace might notice the CPUs being unplugged, but it has to cope with that anyway since a user can do it manually...
This is a bit complicated, but I'll try to explain.
We used to disable the nonboot CPUs before suspending devices and enable them after resuming devices, but that turned out to lead to resume problems on some ACPI systems. Namely, it turned out that this code ordering was not in line with the ACPI spec that assumed specific ordering of events during a suspend. For this reason, we changed the code ordering and now it is more or less in agreement with ACPI (for the first time, AFAICS). I don't think that anyone would like to revert that change right now.
Moreover, in the meantime we learned that the CPU hotplug code that we use for disabling the nonboot CPUs, is generally problematic on x86 and only works for us because we have the majority of interrupt sources disabled when it's invoked.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 3 lines · Oliver Neukum
If, at a minimum, we can determine that we can STD without a freezer. It makes no sense to invest a lot of work to face the same problem again with STD.
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Johannes Berg
Quoted 6 lines · Rafael J. Wysocki
Quoted 5 lines
Quoted 3 lines
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
Quoted 7 lines
Quoted 2 lines
Because you have only one CPU running while your suspend code is being executed?
If that's really all the problem then what's wrong with just unplugging the other CPUs earlier? Sure, that makes suspend no longer perfectly transparent since userspace might notice the CPUs being unplugged, but it has to cope with that anyway since a user can do it manually...
This is a bit complicated, but I'll try to explain.
We used to disable the nonboot CPUs before suspending devices and enable them after resuming devices, but that turned out to lead to resume problems on some ACPI systems. Namely, it turned out that this code ordering was not in line with the ACPI spec that assumed specific ordering of events during a suspend. For this reason, we changed the code ordering and now it is more or less in agreement with ACPI (for the first time, AFAICS). I don't think that anyone would like to revert that change right now.
Moreover, in the meantime we learned that the CPU hotplug code that we use for disabling the nonboot CPUs, is generally problematic on x86 and only works for us because we have the majority of interrupt sources disabled when it's invoked.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 3 lines · Oliver Neukum
If, at a minimum, we can determine that we can STD without a freezer. It makes no sense to invest a lot of work to face the same problem again with STD.
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
So, how about eliminating them?
That can't be done just within fuse, a process might be sleeping on a VFS mutex. Do we want to hack VFS as well?
I guess I know your answer. But it ain't gonna work. Suspend code really doesn't belong in VFS, and I'm pretty sure the maintainers of that little piece of code would agree with me on this.
Miklos
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
So, how about eliminating them?
That can't be done just within fuse, a process might be sleeping on a VFS mutex. Do we want to hack VFS as well?
I guess I know your answer. But it ain't gonna work. Suspend code really doesn't belong in VFS, and I'm pretty sure the maintainers of that little piece of code would agree with me on this.
Miklos
Hi,
Quoted 65 lines · Nigel Cunningham
Hi.
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do you
do
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse is alreadyfrozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on the
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and putting
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.Quoted 6 lines
Quoted 6 lines
Quoted 1 line
In fact, I'd like to remove the
sys_sync()from the freezer entirely,because
Quoted 4 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot producemore
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
data to write, but there are filesystems which don't do that anyway (eg.
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse processes
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 4 lines
Quoted 4 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 8 lines
Quoted 2 lines
sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();
Quoted 8 lines
Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never a problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll be more unsynced data when you
sys_synccall finishes). Stopping userspace before syncing removes that race.
Yes, that will make the suspend/hibernation less reliable in case the resume fails (some data, written after the sync, may be lost). However, the sync done from within the freezer doesn't guarantee that there are no data lost anyway, so we don't lose much by not doing it.
Now, there's a question how much data may be lost, potentially, if we do the sync before the freezer and I don't think that's a lot.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines · Oliver Neukum
Am Donnerstag, 5. Juli 2007 schrieb Rafael J. Wysocki:
Quoted 4 lines
Quoted 2 lines
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Yes, that's pretty clear cut, but we should start from fixing the drivers. :-)
If, at a minimum, we can determine that we can STD without a freezer.
No, we can't.
Quoted 2 lines
It makes no sense to invest a lot of work to face the same problem again with STD.
Arguably, it does make sense, because for many platforms the hibernation is irrelevant and we're going to separate the suspend and hibernation frameworks anyway.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Pavel MachekQuoted 5 lines · Pavel Machek
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Pavel MachekQuoted 5 lines · Pavel Machek
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
Signature · 1 line
Matthew Garrett | [email protected]
Hi,
Quoted 65 lines · Nigel Cunningham
Hi.
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do you
do
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse is alreadyfrozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on the
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and putting
the
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It is just user un-friendly.Quoted 6 lines
Quoted 6 lines
Quoted 1 line
In fact, I'd like to remove the
sys_sync()from the freezer entirely,because
Quoted 4 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is that we have a chance to write out everything when applications cannot producemore
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
data to write, but there are filesystems which don't do that anyway (eg.
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should sync
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse processes
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 4 lines
Quoted 4 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and data integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 8 lines
Quoted 2 lines
sync themselves if they don't already, but that's racy. As it is at the moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();
Quoted 8 lines
Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never a problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll be more unsynced data when you
sys_synccall finishes). Stopping userspace before syncing removes that race.
Yes, that will make the suspend/hibernation less reliable in case the resume fails (some data, written after the sync, may be lost). However, the sync done from within the freezer doesn't guarantee that there are no data lost anyway, so we don't lose much by not doing it.
Now, there's a question how much data may be lost, potentially, if we do the sync before the freezer and I don't think that's a lot.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 8 lines · Matthew Garrett
Quoted 3 lines · Oliver Neukum
If, at a minimum, we can determine that we can STD without a freezer. It makes no sense to invest a lot of work to face the same problem again with STD.
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines · Oliver Neukum
Am Donnerstag, 5. Juli 2007 schrieb Rafael J. Wysocki:
Quoted 4 lines
Quoted 2 lines
It seems pretty clear cut. Whining about how much problems this will cause won't get us nearer to a solution.
Yes, that's pretty clear cut, but we should start from fixing the drivers. :-)
If, at a minimum, we can determine that we can STD without a freezer.
No, we can't.
Quoted 2 lines
It makes no sense to invest a lot of work to face the same problem again with STD.
Arguably, it does make sense, because for many platforms the hibernation is irrelevant and we're going to separate the suspend and hibernation frameworks anyway.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 11 lines · Miklos Szeredi
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
So, how about eliminating them?
That can't be done just within fuse, a process might be sleeping on a VFS mutex. Do we want to hack VFS as well?
No.
Quoted 3 lines
I guess I know your answer. But it ain't gonna work. Suspend code really doesn't belong in VFS, and I'm pretty sure the maintainers of that little piece of code would agree with me on this.
Surprise, surprise. Not that I'm scared of the VFS maintainers, though. ;-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 8 lines · Matthew Garrett
Quoted 3 lines · Oliver Neukum
If, at a minimum, we can determine that we can STD without a freezer. It makes no sense to invest a lot of work to face the same problem again with STD.
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: [linux-pm] The big suspend mess
In reply to Adrian BunkQuoted 12 lines · Adrian Bunk
IMHO the suspend code is currently way too much of a moving target which results in this mess.
The correct order seems to be:
1. agree on what the suspend code as a whole should look like
2. implement this
3. fix ALL drivers to work at least as good as they do today
4. get it tested in -mm
5. fix all bugs people run into
6. submit it for inclusion in Linus' tree
7. quickly work on the most likely big amount of bug reports
Quoted 3 lines
Step 1 is the most important one - evolving code is often something good, but in this case with different people trying to evolve the suspend code in different directions it simply results in a big mess.
Isn't Step 1 exactly what we are in the midst of right now?
Alan Stern
Quoted 11 lines · Miklos Szeredi
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Don't you think, however, that it can be modified a little to play well, for example, with the freezer?
I could stick a couple of try_to_freeze()s into fuse, and that would make suspend failure less likely. But making problems less easy to reproduce is not a good thing.
So, how about eliminating them?
That can't be done just within fuse, a process might be sleeping on a VFS mutex. Do we want to hack VFS as well?
No.
Quoted 3 lines
I guess I know your answer. But it ain't gonna work. Suspend code really doesn't belong in VFS, and I'm pretty sure the maintainers of that little piece of code would agree with me on this.
Surprise, surprise. Not that I'm scared of the VFS maintainers, though. ;-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 6 lines
Quoted 4 lines
I guess I know your answer. But it ain't gonna work. Suspend code really doesn't belong in VFS, and I'm pretty sure the maintainers of that little piece of code would agree with me on this.
Surprise, surprise. Not that I'm scared of the VFS maintainers, though. ;-)
Probably you haven't had a close encounter with them yet. They are pretty much the _most_ dangerous people in kernel land ;)
Miklos
Quoted 6 lines
Quoted 4 lines
I guess I know your answer. But it ain't gonna work. Suspend code really doesn't belong in VFS, and I'm pretty sure the maintainers of that little piece of code would agree with me on this.
Surprise, surprise. Not that I'm scared of the VFS maintainers, though. ;-)
Probably you haven't had a close encounter with them yet. They are pretty much the _most_ dangerous people in kernel land ;)
Miklos
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 10 lines · Matthew Garrett
Quoted 5 lines · Pavel Machek
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state. So, arguably, what we want isn't to save the entire kernel state and application state in one go because we can reconstruct a huge amount of that afterwards.
This isn't too much of a problem. All we actually need to be able to do is to atomically dump process state (which requires the freezer, but doesn't require freezing the entire system), shut down, get the system back into approximately the correct state (remount filesystems, start X, whatever) and then restore the processes.
Now, obviously, there's actually quite a lot of complexity here that I'm neatly eliding :) The biggest issue is restoring hardware state. We'd require quite a different model to the existing one, but I think there are arguments there for it being helpful anywy. Keeping state in the midlevels rather than the low-level drivers would give us much more ability to deal with hardware issues, and potentially allow the replacement of faulty hardware without userspace caring (freeze your mission-critical application, hotplug the network card, let the kernel restore state and resume it)
There's other advantages to this. As long as the kernel hasn't changed too much it would be possible to restore userspace across kernel security upgrades. You end up saving less to disk so performance should be better. Touching filesystems between suspend and resume doesn't result in the entire world ending.
I've mocked up a basic implementation using cryopid, but it's somewhat limited by the lack of support for sockets. I'd like to move more of the smarts into the kernel (Hurray, checkpointing!) and then see how much hardware support ends up horifically broken.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 7 lines · Paul Mackerras
Quoted 1 line · Alan Stern
Let's agree the kernel threads and the freezer are a separate issue.
No, I don't think they are a separate issue, because I think the distinction the freezer makes between kernel threads and user threads is a false and misleading distinction.
That's a little strong. "Misleading" I could understand, but "false"? Isn't the distinction between a kernel thread and a user task pretty clear-cut (except for a few borderline cases which aren't at issue just now)?
Quoted 9 lines
Quoted 6 lines
I agree the kernel threads which try to do I/O during a suspend will need extra attention. However if these threads are necessary for the suspend procedure, then blocking them (which is how people on this thread have been saying driver should treat I/O requests during a suspend) will cause additional problems. There's no way around it; these threads _will_ require more work.
There is a way around it; do the request blocking in the drivers, where it belongs.
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Quoted 9 lines
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
The "don't freeze kernel threads" thing is an attempt to make a crude approximation to the dependency graph (by saying kernel threads only depend on other kernel threads), but the approximation breaks down when you have FUSE or user-level device drivers.
I disagree with your analysis -- not that it's completely wrong, but it points out an existing basic problem in the kernel. The kernel should never depend on userspace! More correctly, a task executing in the kernel should never block with any sort of mutex or other lock held (in a way that would preclude it from being frozen, let's say) while waiting for a response from userspace.
Then the dependency graph would be easy to construct: User tasks can depend on whatever they want, and kernel threads never depend on a user task.
If this contradicts the existing implementations and APIs for userspace filesystems, then so be it. My conclusion would be that the implementations and APIs should be changed.
Quoted 8 lines
Quoted 6 lines
There remains the problem of user tasks whose assistance is required to carry out some I/O (as with FUSE). If the I/O can be deferred until after the resume, then there's no problem. If the I/O can be carried out before the suspend, then it should be. And finally, if the I/O must be done during the suspend, you're in real trouble -- how do you do I/O to a suspended device?
So why doesn't that argument apply to kernel threads? :)
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Alan Stern
Quoted 7 lines · Paul Mackerras
Quoted 1 line · Alan Stern
Let's agree the kernel threads and the freezer are a separate issue.
No, I don't think they are a separate issue, because I think the distinction the freezer makes between kernel threads and user threads is a false and misleading distinction.
That's a little strong. "Misleading" I could understand, but "false"? Isn't the distinction between a kernel thread and a user task pretty clear-cut (except for a few borderline cases which aren't at issue just now)?
Quoted 9 lines
Quoted 6 lines
I agree the kernel threads which try to do I/O during a suspend will need extra attention. However if these threads are necessary for the suspend procedure, then blocking them (which is how people on this thread have been saying driver should treat I/O requests during a suspend) will cause additional problems. There's no way around it; these threads _will_ require more work.
There is a way around it; do the request blocking in the drivers, where it belongs.
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Quoted 9 lines
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
The "don't freeze kernel threads" thing is an attempt to make a crude approximation to the dependency graph (by saying kernel threads only depend on other kernel threads), but the approximation breaks down when you have FUSE or user-level device drivers.
I disagree with your analysis -- not that it's completely wrong, but it points out an existing basic problem in the kernel. The kernel should never depend on userspace! More correctly, a task executing in the kernel should never block with any sort of mutex or other lock held (in a way that would preclude it from being frozen, let's say) while waiting for a response from userspace.
Then the dependency graph would be easy to construct: User tasks can depend on whatever they want, and kernel threads never depend on a user task.
If this contradicts the existing implementations and APIs for userspace filesystems, then so be it. My conclusion would be that the implementations and APIs should be changed.
Quoted 8 lines
Quoted 6 lines
There remains the problem of user tasks whose assistance is required to carry out some I/O (as with FUSE). If the I/O can be deferred until after the resume, then there's no problem. If the I/O can be carried out before the suspend, then it should be. And finally, if the I/O must be done during the suspend, you're in real trouble -- how do you do I/O to a suspended device?
So why doesn't that argument apply to kernel threads? :)
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Alan Stern
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state. So, arguably, what we want isn't to save the entire kernel state and application state in one go because we can reconstruct a huge amount of that afterwards.
This isn't too much of a problem. All we actually need to be able to do is to atomically dump process state (which requires the freezer, but doesn't require freezing the entire system), shut down, get the system back into approximately the correct state (remount filesystems, start X, whatever) and then restore the processes.
Now, obviously, there's actually quite a lot of complexity here that I'm neatly eliding :) The biggest issue is restoring hardware state. We'd require quite a different model to the existing one, but I think there are arguments there for it being helpful anywy. Keeping state in the midlevels rather than the low-level drivers would give us much more ability to deal with hardware issues, and potentially allow the replacement of faulty hardware without userspace caring (freeze your mission-critical application, hotplug the network card, let the kernel restore state and resume it)
There's other advantages to this. As long as the kernel hasn't changed too much it would be possible to restore userspace across kernel security upgrades. You end up saving less to disk so performance should be better. Touching filesystems between suspend and resume doesn't result in the entire world ending.
I've mocked up a basic implementation using cryopid, but it's somewhat limited by the lack of support for sockets. I'd like to move more of the smarts into the kernel (Hurray, checkpointing!) and then see how much hardware support ends up horifically broken.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 7 lines · Paul Mackerras
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
That's a good question. Miklos, can you please reproduce the suspend error using a kernel built with CONFIG_USB_DEBUG turned on?
Alan Stern
Quoted 7 lines · Paul Mackerras
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
That's a good question. Miklos, can you please reproduce the suspend error using a kernel built with CONFIG_USB_DEBUG turned on?
Alan Stern
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 10 lines · Matthew Garrett
Quoted 5 lines · Pavel Machek
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 5 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
Quoted 7 lines
Quoted 4 lines
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
But this is a problem by itself, regardless of the freezer etc., no?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Matthew Garrett
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
But this is a problem by itself, regardless of the freezer etc., no?
Why?
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Matthew Garrett
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
But this is a problem by itself, regardless of the freezer etc., no?
Why?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 6 lines · Paul Mackerras
Quoted 4 lines · Alan Stern
Quoted 4 lines
Quoted 3 lines
Yes, the code could be changed to keep track of the reason for a device suspend. But that just raises the old problem of what to do when there's an I/O request for a suspended device during STR.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Is this actually a real problem? I would think the policy would be "block" for block devices (pun not intended :), "drop" for network devices, etc.
It is indeed a real problem, or at least, it can be.
How so? Can you give me an example?
The example I quoted earlier about binding during a suspend will do. I agree that we can and should try to prevent it from ever occurring.
Read and write are a problem only in that fixing them would potentially involve changing lots of drivers; I don't think they pose a serious theoretical obstacle. (Lord knows what will happen with async I/O!)
Any other entry points to drivers are also potential problems, but it's hard to say anything definite about them since they are so varied.
Quoted 4 lines
Quoted 1 line
Bus subsystems can suspend devices with no drivers.
Interesting. I assume this is for buses for which there is a bus-specific but device-independent suspend procedure defined.
Yes.
Quoted 6 lines
It would seem sensible to me that the PM core should get the bus to resume such a device before calling a driver probe routine. The resume should be blocked or deferred while a system suspend is underway. In fact I think that all driver bind/unbind and probe operations should be deferred while the system is suspending (i.e. put on a list to be done after the system resumes).
Getting the PM core to resume a device before probing could be difficult; in general it doesn't know enough about specific device behaviors to do something like that. But the subsystem certainly ought to take care of it. USB does.
Yes, bind/unbind/etc. should be deferred during a system suspend. But it has to be done carefully, because these operations generally involve locks that can't be released. They need to be prevented at their source, not in the driver core. That's one reason why khubd needs to be frozen (being part of the USB hub driver, it is the task responsible for binding and unbinding drivers to USB devices).
Another thing to look out for is registration and unregistration of drivers. These activities also cause bind/unbind operations. Note that if userspace is frozen then neither insmod nor rmmod can run. :-)
Quoted 6 lines
Quoted 3 lines
It would help. It would help even more if the sysfs core also blocked all I/O while suspend is under way. (Although this might be tricky, considering that the suspend is initiated by a sysfs write...)
I didn't think sysfs got involved at all in normal read and write requests, so I don't know how it would block them...
All I/O to sysfs attributes passes through the routines in fs/sysfs/*. It could be blocked there. (But if userspace is frozen it won't need to be.)
Quoted 1 line
Normally devices have some sort of queue of pending operations.
That's certainly true of block devices, whose drivers use the block subsystem. It's not true for lots of other devices, though.
Quoted 4 lines
So
all that is required on suspend is to stop processing the queue and wait for any currently-underway operations to complete. The blocking then happens naturally using the normal I/O wait mechanisms.
In my experience, most non-block drivers do not have any queue of pending I/O operations. They simply carry out requests as they arrive.
Alan Stern
Quoted 6 lines · Paul Mackerras
Quoted 4 lines · Alan Stern
Quoted 4 lines
Quoted 3 lines
Yes, the code could be changed to keep track of the reason for a device suspend. But that just raises the old problem of what to do when there's an I/O request for a suspended device during STR.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Is this actually a real problem? I would think the policy would be "block" for block devices (pun not intended :), "drop" for network devices, etc.
It is indeed a real problem, or at least, it can be.
How so? Can you give me an example?
The example I quoted earlier about binding during a suspend will do. I agree that we can and should try to prevent it from ever occurring.
Read and write are a problem only in that fixing them would potentially involve changing lots of drivers; I don't think they pose a serious theoretical obstacle. (Lord knows what will happen with async I/O!)
Any other entry points to drivers are also potential problems, but it's hard to say anything definite about them since they are so varied.
Quoted 4 lines
Quoted 1 line
Bus subsystems can suspend devices with no drivers.
Interesting. I assume this is for buses for which there is a bus-specific but device-independent suspend procedure defined.
Yes.
Quoted 6 lines
It would seem sensible to me that the PM core should get the bus to resume such a device before calling a driver probe routine. The resume should be blocked or deferred while a system suspend is underway. In fact I think that all driver bind/unbind and probe operations should be deferred while the system is suspending (i.e. put on a list to be done after the system resumes).
Getting the PM core to resume a device before probing could be difficult; in general it doesn't know enough about specific device behaviors to do something like that. But the subsystem certainly ought to take care of it. USB does.
Yes, bind/unbind/etc. should be deferred during a system suspend. But it has to be done carefully, because these operations generally involve locks that can't be released. They need to be prevented at their source, not in the driver core. That's one reason why khubd needs to be frozen (being part of the USB hub driver, it is the task responsible for binding and unbinding drivers to USB devices).
Another thing to look out for is registration and unregistration of drivers. These activities also cause bind/unbind operations. Note that if userspace is frozen then neither insmod nor rmmod can run. :-)
Quoted 6 lines
Quoted 3 lines
It would help. It would help even more if the sysfs core also blocked all I/O while suspend is under way. (Although this might be tricky, considering that the suspend is initiated by a sysfs write...)
I didn't think sysfs got involved at all in normal read and write requests, so I don't know how it would block them...
All I/O to sysfs attributes passes through the routines in fs/sysfs/*. It could be blocked there. (But if userspace is frozen it won't need to be.)
Quoted 1 line
Normally devices have some sort of queue of pending operations.
That's certainly true of block devices, whose drivers use the block subsystem. It's not true for lots of other devices, though.
Quoted 4 lines
So
all that is required on suspend is to stop processing the queue and wait for any currently-underway operations to complete. The blocking then happens naturally using the normal I/O wait mechanisms.
In my experience, most non-block drivers do not have any queue of pending I/O operations. They simply carry out requests as they arrive.
Alan Stern
Quoted 10 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state.
Hmm, careful. There are a bunch of people who use suspend2 exactly because it saves and restores the page cache, leaving the system in a usable state without waiting for the universe to swap back in from disk. It makes a big difference on older laptops with slow drives. While the other advantages you list for process cryogenics are pretty neat, let's remember that the 99% use case for STD is laptops.
Quoted 10 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state.
Hmm, careful. There are a bunch of people who use suspend2 exactly because it saves and restores the page cache, leaving the system in a usable state without waiting for the universe to swap back in from disk. It makes a big difference on older laptops with slow drives. While the other advantages you list for process cryogenics are pretty neat, let's remember that the 99% use case for STD is laptops.
Quoted 5 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
Quoted 7 lines
Quoted 1 line
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state. So, arguably, what we want isn't to save the entire kernel state and application state in one go because we can reconstruct a huge amount of that afterwards.
Hmm, I think that will take more time than just restoring the entire system state.
Quoted 3 lines
This isn't too much of a problem. All we actually need to be able to do is to atomically dump process state (which requires the freezer, but doesn't require freezing the entire system),
Once you've frozen processes, the freezing of the rest of the system is pretty straightforward. Currently, we do a bit too much for that, because we suspend devices instead of just quiescing them before creating the image, bu that's going to change (I hope).
Quoted 12 lines
shut down, get the system back into approximately the correct state (remount filesystems, start X, whatever) and then restore the processes.
Now, obviously, there's actually quite a lot of complexity here that I'm neatly eliding :) The biggest issue is restoring hardware state. We'd require quite a different model to the existing one, but I think there are arguments there for it being helpful anywy. Keeping state in the midlevels rather than the low-level drivers would give us much more ability to deal with hardware issues, and potentially allow the replacement of faulty hardware without userspace caring (freeze your mission-critical application, hotplug the network card, let the kernel restore state and resume it)
Sounds neat, but what about the processes that depend on the hardware (like hal)?
Quoted 4 lines
There's other advantages to this. As long as the kernel hasn't changed too much it would be possible to restore userspace across kernel security upgrades. You end up saving less to disk so performance should be better.
Well, not that much less. :-)
Quoted 2 lines
Touching filesystems between suspend and resume doesn't result in the entire world ending.
Yes, that would be an advantege.
Quoted 4 lines
I've mocked up a basic implementation using cryopid, but it's somewhat limited by the lack of support for sockets. I'd like to move more of the smarts into the kernel (Hurray, checkpointing!) and then see how much hardware support ends up horifically broken.
There's one more thing, I'm not sure if that's possible to separate the kernel state from the processes state entirely (think shared memory, LRU lists, situations in which the application has been frozen while waiting for an event in the kernel space etc.).
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 12 lines · Matthew Garrett
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Matthew Garrett
Quoted 8 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
But this is a problem by itself, regardless of the freezer etc., no?
Why?
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 5 lines · Matthew Garrett
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
Quoted 7 lines
Quoted 1 line
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state. So, arguably, what we want isn't to save the entire kernel state and application state in one go because we can reconstruct a huge amount of that afterwards.
Hmm, I think that will take more time than just restoring the entire system state.
Quoted 3 lines
This isn't too much of a problem. All we actually need to be able to do is to atomically dump process state (which requires the freezer, but doesn't require freezing the entire system),
Once you've frozen processes, the freezing of the rest of the system is pretty straightforward. Currently, we do a bit too much for that, because we suspend devices instead of just quiescing them before creating the image, bu that's going to change (I hope).
Quoted 12 lines
shut down, get the system back into approximately the correct state (remount filesystems, start X, whatever) and then restore the processes.
Now, obviously, there's actually quite a lot of complexity here that I'm neatly eliding :) The biggest issue is restoring hardware state. We'd require quite a different model to the existing one, but I think there are arguments there for it being helpful anywy. Keeping state in the midlevels rather than the low-level drivers would give us much more ability to deal with hardware issues, and potentially allow the replacement of faulty hardware without userspace caring (freeze your mission-critical application, hotplug the network card, let the kernel restore state and resume it)
Sounds neat, but what about the processes that depend on the hardware (like hal)?
Quoted 4 lines
There's other advantages to this. As long as the kernel hasn't changed too much it would be possible to restore userspace across kernel security upgrades. You end up saving less to disk so performance should be better.
Well, not that much less. :-)
Quoted 2 lines
Touching filesystems between suspend and resume doesn't result in the entire world ending.
Yes, that would be an advantege.
Quoted 4 lines
I've mocked up a basic implementation using cryopid, but it's somewhat limited by the lack of support for sockets. I'd like to move more of the smarts into the kernel (Hurray, checkpointing!) and then see how much hardware support ends up horifically broken.
There's one more thing, I'm not sure if that's possible to separate the kernel state from the processes state entirely (think shared memory, LRU lists, situations in which the application has been frozen while waiting for an event in the kernel space etc.).
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 6 lines · Ray Lee
Hmm, careful. There are a bunch of people who use suspend2 exactly because it saves and restores the page cache, leaving the system in a usable state without waiting for the universe to swap back in from disk. It makes a big difference on older laptops with slow drives. While the other advantages you list for process cryogenics are pretty neat, let's remember that the 99% use case for STD is laptops.
Saving the processes means that you're implicitly saving the interesting chunks of the page cache. Removing the need for the atomic copy saves you from pushing a pile of stuff out to swap in the first place.
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 6 lines · Ray Lee
Hmm, careful. There are a bunch of people who use suspend2 exactly because it saves and restores the page cache, leaving the system in a usable state without waiting for the universe to swap back in from disk. It makes a big difference on older laptops with slow drives. While the other advantages you list for process cryogenics are pretty neat, let's remember that the 99% use case for STD is laptops.
Saving the processes means that you're implicitly saving the interesting chunks of the page cache. Removing the need for the atomic copy saves you from pushing a pile of stuff out to swap in the first place.
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 5 lines · Rafael J. Wysocki
Quoted 1 line · Matthew Garrett
Why?
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 5 lines · Rafael J. Wysocki
Quoted 1 line · Matthew Garrett
Why?
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
Signature · 1 line
Matthew Garrett | [email protected]
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 12 lines · Matthew Garrett
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Matthew Garrett
Quoted 8 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
But this is a problem by itself, regardless of the freezer etc., no?
Why?
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 10 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 1 line · Matthew Garrett
Why?
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
I think there's a difference between a userland task playing the role of a resource and a "real" external resource the kernel doesn't control.
IMO, userland tasks should not have the power to affect each other as though they were parts of the kernel.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettQuoted 10 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 1 line · Matthew Garrett
Why?
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
I think there's a difference between a userland task playing the role of a resource and a "real" external resource the kernel doesn't control.
IMO, userland tasks should not have the power to affect each other as though they were parts of the kernel.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 8 lines
Quoted 7 lines
Quoted 3 lines
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
Quoted 5 lines
I think there's a difference between a userland task playing the role of a resource and a "real" external resource the kernel doesn't control.
IMO, userland tasks should not have the power to affect each other as though they were parts of the kernel.
One task doing ptrace() can basically do whatever it wants with the task being traced. This is not an exact analogy to what fuse does, but close.
And for this reason the security model for allowing access to a fuse filesystem is similar to that for allowing tracing.
The gory details can be found in Documentation/filesystems/fuse.txt.
Miklos
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Rafael J. WysockiQuoted 8 lines
Quoted 7 lines
Quoted 3 lines
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
Quoted 5 lines
I think there's a difference between a userland task playing the role of a resource and a "real" external resource the kernel doesn't control.
IMO, userland tasks should not have the power to affect each other as though they were parts of the kernel.
One task doing ptrace() can basically do whatever it wants with the task being traced. This is not an exact analogy to what fuse does, but close.
And for this reason the security model for allowing access to a fuse filesystem is similar to that for allowing tracing.
The gory details can be found in Documentation/filesystems/fuse.txt.
Miklos
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
[snip: new hibernate idea]
I think my kexec-based hibernate idea is simpler and more feasible than this approach, and also avoids the freezer.
Signature · 1 line
Jeremy Maitin-Shepard
Quoted 6 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
[snip: new hibernate idea]
I think my kexec-based hibernate idea is simpler and more feasible than this approach, and also avoids the freezer.
Signature · 1 line
Jeremy Maitin-Shepard
Quoted 3 lines · Miklos Szeredi
Umm, and CODA which is _very_ similar to fuse was there long before fuse or the freezer ;)
I did userfs around 1994-5.
J
Quoted 3 lines · Miklos Szeredi
Umm, and CODA which is _very_ similar to fuse was there long before fuse or the freezer ;)
I did userfs around 1994-5.
J
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.So, I wonder why I don't see that error on my powerbook?
That's a good question. Miklos, can you please reproduce the suspend error using a kernel built with
CONFIG_USB_DEBUGturned on?
Here's the full dmesg. First there was a successful suspend/resume, then a couple of unsuccessful ones:
Linux version 2.6.22-rc6 (mszeredi@tucsk) (gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)) #19 SMP Thu Jul 5 18:07:34 CEST 2007 Command line: vga=775 root=/dev/sda2
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000d2000 - 00000000000d4000 (reserved)
BIOS-e820: 00000000000dc000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000003fed0000 (usable)
BIOS-e820: 000000003fed0000 - 000000003fedf000 (ACPI data)
BIOS-e820: 000000003fedf000 - 000000003ff00000 (ACPI NVS)
BIOS-e820: 000000003ff00000 - 0000000040000000 (reserved)
BIOS-e820: 00000000f0000000 - 00000000f4000000 (reserved)
BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)
BIOS-e820: 00000000fed00000 - 00000000fed00400 (reserved)
BIOS-e820: 00000000fed14000 - 00000000fed1a000 (reserved)
BIOS-e820: 00000000fed1c000 - 00000000fed90000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ff800000 - 0000000100000000 (reserved)
Entering add_active_range(0, 0, 159) 0 entries of 256 used
Entering add_active_range(0, 256, 261840) 1 entries of 256 usedend_pfn_map = 1048576
DMI present.
ACPI: RSDP 000F67D0, 0024 (r2 LENOVO)
ACPI: XSDT 3FED1308, 008C (r1 LENOVO TP-79 2110 LTP 0)
ACPI: FACP 3FED1400, 00F4 (r3 LENOVO TP-79 2110 LNVO 1)
ACPI Warning (tbfadt-0434): Optional field "Gpe1Block" has zero address or length: 000000000000102C/0 [20070126]
ACPI: DSDT 3FED175E, D481 (r1 LENOVO TP-79 2110 MSFT 100000E)
ACPI: FACS 3FEF4000, 0040
ACPI: SSDT 3FED15B4, 01AA (r1 LENOVO TP-79 2110 MSFT 100000E)
ACPI: ECDT 3FEDEBDF, 0052 (r1 LENOVO TP-79 2110 LNVO 1)
ACPI: TCPA 3FEDEC31, 0032 (r2 LENOVO TP-79 2110 LNVO 1)
ACPI: APIC 3FEDEC63, 0068 (r1 LENOVO TP-79 2110 LNVO 1)
ACPI: MCFG 3FEDECCB, 003C (r1 LENOVO TP-79 2110 LNVO 1)
ACPI: HPET 3FEDED07, 0038 (r1 LENOVO TP-79 2110 LNVO 1)
ACPI: SLIC 3FEDEE62, 0176 (r1 LENOVO TP-79 2110 LTP 0)
ACPI: BOOT 3FEDEFD8, 0028 (r1 LENOVO TP-79 2110 LTP 1)
ACPI: SSDT 3FEF2655, 025F (r1 LENOVO TP-79 2110 INTL 20050513)
ACPI: SSDT 3FEF28B4, 00A6 (r1 LENOVO TP-79 2110 INTL 20050513)
ACPI: SSDT 3FEF295A, 04F7 (r1 LENOVO TP-79 2110 INTL 20050513)
ACPI: SSDT 3FEF2E51, 01D8 (r1 LENOVO TP-79 2110 INTL 20050513)
Entering add_active_range(0, 0, 159) 0 entries of 256 used
Entering add_active_range(0, 256, 261840) 1 entries of 256 used
Zone PFN ranges:
DMA 0 -> 4096
DMA32 4096 -> 1048576
Normal 1048576 -> 1048576
early_node_map[2] active PFN ranges
0: 0 -> 159
0: 256 -> 261840On node 0 totalpages: 261743
DMA zone: 56 pages used for memmap
DMA zone: 1144 pages reserved
DMA zone: 2799 pages, LIFO batch:0
DMA32 zone: 3523 pages used for memmap
DMA32 zone: 254221 pages, LIFO batch:31
Normal zone: 0 pages used for memmap
ACPI: PM-Timer IO Port: 0x1008
ACPI: Local APIC address 0xfee00000
ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
Processor #0 (Bootup-CPU)
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
Processor #1
ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 1, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: IRQ0 used by override.
ACPI: IRQ2 used by override.
ACPI: IRQ9 used by override.
Setting APIC routing to flat
ACPI: HPET id: 0x8086a201 base: 0xfed00000
Using ACPI (MADT) for SMP configuration information
swsusp: Registered nosave memory region: 000000000009f000 - 00000000000a0000
swsusp: Registered nosave memory region: 00000000000a0000 - 00000000000d2000
swsusp: Registered nosave memory region: 00000000000d2000 - 00000000000d4000
swsusp: Registered nosave memory region: 00000000000d4000 - 00000000000dc000
swsusp: Registered nosave memory region: 00000000000dc000 - 0000000000100000 Allocating PCI resources starting at 50000000 (gap: 40000000:b0000000)
SMP: Allowing 2 CPUs, 0 hotplug CPUs
PERCPU: Allocating 32616 bytes of per cpu data
Built 1 zonelists. Total pages: 257020
Kernel command line: vga=775 root=/dev/sda2
Initializing CPU#0
PID hash table entries: 4096 (order: 12, 32768 bytes)
Extended CMOS year: 2000
Marking TSC unstable due to TSCs unsynchronizedtime.c: Detected 1828.744 MHz processor.
Console: colour dummy device 80x25
Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
Checking aperture...
Memory: 1026200k/1047360k available (2316k kernel code, 20600k reserved, 1434k data, 188k init) Calibrating delay using timer specific routine.. 3661.49 BogoMIPS (lpj=7322983) Mount-cache hash table entries: 256
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
using mwait in idle threads.
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 0
CPU0: Thermal monitoring enabled (TM2)
SMP alternatives: switching to UP code
ACPI: Core revision 20070126
Using local APIC timer interrupts.
result 10390586
Detected 10.390 MHz APIC timer.
SMP alternatives: switching to SMP code
Booting processor 1/2 APIC 0x1
Initializing CPU#1
Calibrating delay using timer specific routine.. 3657.60 BogoMIPS (lpj=7315219)
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 1
CPU1: Thermal monitoring enabled (TM2)
Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz stepping 06
Brought up 2 CPUs
migration_cost=39
NET: Registered protocol family 16
ACPI: bus type pci registered
PCI: Using configuration type 1
ACPI: Interpreter enabled
ACPI: (supports S0 S3 S4 S5)
ACPI: Using IOAPIC for interrupt routing
ACPI: PCI Root Bridge [PCI0] (0000:00)
PCI: Probing PCI hardware (bus 00)
PCI quirk: region 1000-107f claimed by ICH6 ACPI/GPIO/TCO
PCI quirk: region 1180-11bf claimed by ICH6 GPIO
PCI: Transparent bridge - 0000:00:1e.0
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.AGP_._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP0._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP1._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP2._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.EXP3._PRT]
ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PCI1._PRT]
ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 9 10 *11)
ACPI: Power Resource [PUBS] (on)
Linux Plug and Play Support v0.97 (c) Adam Belay
pnp: PnP ACPI init
ACPI: bus type pnp registered
pnp: PnP ACPI: found 12 devices
ACPI: ACPI bus type pnp unregistered
SCSI subsystem initialized
libata version 2.21 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
PCI: Using ACPI for IRQ routing
PCI: If a device doesn't work, try "pci=routeirq". If it helps, post a report
PCI-GART: No AMD northbridge found.
hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
hpet0: 3 64-bit timers, 14318180 Hz
pnp: 00:00: iomem range 0x0-0x9ffff could not be reserved
pnp: 00:00: iomem range 0xc0000-0xc3fff has been reserved
pnp: 00:00: iomem range 0xc4000-0xc7fff has been reserved
pnp: 00:00: iomem range 0xc8000-0xcbfff has been reserved
pnp: 00:02: iomem range 0xf0000000-0xf3ffffff could not be reserved
pnp: 00:02: iomem range 0xfed1c000-0xfed1ffff could not be reserved
pnp: 00:02: iomem range 0xfed14000-0xfed17fff could not be reserved
pnp: 00:02: iomem range 0xfed18000-0xfed18fff could not be reserved
PCI: Bridge: 0000:00:01.0
IO window: 2000-2fff
MEM window: ee100000-ee1fffff
PREFETCH window: d8000000-dfffffff
PCI: Bridge: 0000:00:1c.0
IO window: 3000-3fff
MEM window: ee000000-ee0fffff
PREFETCH window: disabled.
PCI: Bridge: 0000:00:1c.1
IO window: 4000-5fff
MEM window: ec000000-edffffff
PREFETCH window: e4000000-e40fffff
PCI: Bridge: 0000:00:1c.2
IO window: 6000-7fff
MEM window: e8000000-e9ffffff
PREFETCH window: e4100000-e41fffff
PCI: Bridge: 0000:00:1c.3
IO window: 8000-9fff
MEM window: ea000000-ebffffff
PREFETCH window: e4200000-e42fffff
PCI: Bus 22, cardbus bridge: 0000:15:00.0
IO window: 0000a000-0000a0ff
IO window: 0000a400-0000a4ff
PREFETCH window: e0000000-e3ffffff
MEM window: 50000000-53ffffff
PCI: Bridge: 0000:00:1e.0
IO window: a000-dfff
MEM window: e4300000-e7ffffff
PREFETCH window: e0000000-e3ffffff
ACPI: PCI Interrupt 0000:00:01.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:00:01.0 to 64
ACPI: PCI Interrupt 0000:00:1c.0[A] -> GSI 20 (level, low) -> IRQ 20
PCI: Setting latency timer of device 0000:00:1c.0 to 64
ACPI: PCI Interrupt 0000:00:1c.1[B] -> GSI 21 (level, low) -> IRQ 21
PCI: Setting latency timer of device 0000:00:1c.1 to 64
ACPI: PCI Interrupt 0000:00:1c.2[C] -> GSI 22 (level, low) -> IRQ 22
PCI: Setting latency timer of device 0000:00:1c.2 to 64
ACPI: PCI Interrupt 0000:00:1c.3[D] -> GSI 23 (level, low) -> IRQ 23
PCI: Setting latency timer of device 0000:00:1c.3 to 64
PCI: Enabling device 0000:00:1e.0 (0005 -> 0007)
PCI: Setting latency timer of device 0000:00:1e.0 to 64
ACPI: PCI Interrupt 0000:15:00.0[A] -> GSI 16 (level, low) -> IRQ 16
NET: Registered protocol family 2
Time: hpet clocksource has been installed.
IP route cache hash table entries: 32768 (order: 6, 262144 bytes)
TCP established hash table entries: 131072 (order: 9, 3145728 bytes)
TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
TCP: Hash tables configured (established 131072 bind 65536)
TCP reno registered
Simple Boot Flag at 0x35 set to 0x1
io scheduler noop registered
io scheduler cfq registered (default)
pci 0000:00:1d.0: uhci_check_and_reset_hc: legsup = 0x2000
pci 0000:00:1d.0: Performing full reset
pci 0000:00:1d.1: uhci_check_and_reset_hc: legsup = 0x2000
pci 0000:00:1d.1: Performing full reset
pci 0000:00:1d.2: uhci_check_and_reset_hc: legsup = 0x2000
pci 0000:00:1d.2: Performing full reset
pci 0000:00:1d.3: uhci_check_and_reset_hc: legsup = 0x2000
pci 0000:00:1d.3: Performing full reset
Boot video device is 0000:01:00.0
PCI: Setting latency timer of device 0000:00:01.0 to 64assign_interrupt_mode Found MSI capability
Allocate Port Service[0000:00:01.0:pcie00]
PCI: Setting latency timer of device 0000:00:1c.0 to 64assign_interrupt_mode Found MSI capability
Allocate Port Service[0000:00:1c.0:pcie00]
Allocate Port Service[0000:00:1c.0:pcie02]
PCI: Setting latency timer of device 0000:00:1c.1 to 64assign_interrupt_mode Found MSI capability
Allocate Port Service[0000:00:1c.1:pcie00]
Allocate Port Service[0000:00:1c.1:pcie02]
PCI: Setting latency timer of device 0000:00:1c.2 to 64assign_interrupt_mode Found MSI capability
Allocate Port Service[0000:00:1c.2:pcie00]
Allocate Port Service[0000:00:1c.2:pcie02]
PCI: Setting latency timer of device 0000:00:1c.3 to 64assign_interrupt_mode Found MSI capability
Allocate Port Service[0000:00:1c.3:pcie00]
Allocate Port Service[0000:00:1c.3:pcie02]
vesafb: framebuffer at 0xd8000000, mapped to 0xffffc20000080000, using 2560k, total 16384k
vesafb: mode is 1280x1024x8, linelength=1280, pages=11
vesafb: scrolling: redraw
vesafb: Pseudocolor: size=8:8:8:8, shift=0:0:0:0
Console: switching to colour frame buffer device 160x64
fb0: VESA VGA frame buffer device
ACPI: AC Adapter [AC] (on-line)
ACPI: Battery Slot [BAT0] (battery absent)
input: Power Button (FF) as /class/input/input0
ACPI: Power Button (FF) [PWRF]
input: Lid Switch as /class/input/input1
ACPI: Lid Switch [LID]
input: Sleep Button (CM) as /class/input/input2
ACPI: Sleep Button (CM) [SLPB]
ACPI: SSDT 3FEF1D36, 0240 (r1 PmRef Cpu0Ist 100 INTL 20050513)
ACPI: SSDT 3FEF1FFB, 065A (r1 PmRef Cpu0Cst 100 INTL 20050513)
Monitor-Mwait will be used to enter C-1 state
Monitor-Mwait will be used to enter C-2 state
Monitor-Mwait will be used to enter C-3 state
ACPI: CPU0 (power states: C1[C1] C2[C2] C3[C3])
ACPI: Processor [CPU0] (supports 8 throttling states)
ACPI: SSDT 3FEF1C6E, 00C8 (r1 PmRef Cpu1Ist 100 INTL 20050513)
ACPI: SSDT 3FEF1F76, 0085 (r1 PmRef Cpu1Cst 100 INTL 20050513)
ACPI: CPU1 (power states: C1[C1] C2[C2] C3[C3])
ACPI: Processor [CPU1] (supports 8 throttling states)
ACPI: Thermal Zone [THM0] (40 C)
ACPI: Thermal Zone [THM1] (41 C)
Real Time Clock Driver v1.12achpet_resources: 0xfed00000 is busy
Linux agpgart interface v0.102 (c) Dave Jones
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
loop: module loadedthinkpad_acpi: ThinkPad ACPI Extras v0.14thinkpad_acpi: http://ibm-acpi.sf.net/thinkpad_acpi: ThinkPad EC firmware 79HT50WW-1.07
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <[email protected]>
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
ICH7: IDE controller at PCI slot 0000:00:1f.1
ACPI: PCI Interrupt 0000:00:1f.1[C] -> GSI 16 (level, low) -> IRQ 16
ICH7: chipset revision 2
ICH7: not 100% native mode: will probe irqs later
ide0: BM-DMA at 0x1880-0x1887, BIOS settings: hda:DMA, hdb:pio
Probing IDE interface ide0...
hda: MATSHITADVD-RAM UJ-842, ATAPI CD/DVD-ROM drive
hda: selected mode 0x42
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1...
hda: ATAPI 24X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33)
Uniform CD-ROM driver Revision: 3.20
ahci 0000:00:1f.2: version 2.2
ACPI: PCI Interrupt 0000:00:1f.2[B] -> GSI 16 (level, low) -> IRQ 16
ahci 0000:00:1f.2: AHCI 0001.0100 32 slots 4 ports 1.5 Gbps 0xf impl SATA mode
ahci 0000:00:1f.2: flags: 64bit ncq pm led clo pio slum part
PCI: Setting latency timer of device 0000:00:1f.2 to 64
scsi0 : ahci
scsi1 : ahci
scsi2 : ahci
scsi3 : ahci
ata1: SATA max UDMA/133 cmd 0xffffc2000003a500 ctl 0x0000000000000000 bmdma 0x0000000000000000 irq 0
ata2: SATA max UDMA/133 cmd 0xffffc2000003a580 ctl 0x0000000000000000 bmdma 0x0000000000000000 irq 0
ata3: SATA max UDMA/133 cmd 0xffffc2000003a600 ctl 0x0000000000000000 bmdma 0x0000000000000000 irq 0
ata4: SATA max UDMA/133 cmd 0xffffc2000003a680 ctl 0x0000000000000000 bmdma 0x0000000000000000 irq 0
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
ata1.00: ata_hpa_resize 1: sectors = 156301488, hpa_sectors = 156301488
ata1.00: ATA-7: HTS541080G9SA00, MB4IC60R, max UDMA/100
ata1.00: 156301488 sectors, multi 16: LBA48
ata1.00: ata_hpa_resize 1: sectors = 156301488, hpa_sectors = 156301488
ata1.00: configured for UDMA/100
ata2: SATA link down (SStatus 0 SControl 0)
ata3: SATA link down (SStatus 0 SControl 0)
ata4: SATA link down (SStatus 0 SControl 0)
scsi 0:0:0:0: Direct-Access ATA HTS541080G9SA00 MB4I PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 156301488 512-byte hardware sectors (80026 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA sd 0:0:0:0: [sda] 156301488 512-byte hardware sectors (80026 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1 sda2 sda3 < sda5 >
sd 0:0:0:0: [sda] Attached SCSI disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
usbmon: debugfs is not availableehci_hcd: block sizes: qh 160 qtd 96 itd 192 sitd 96
ACPI: PCI Interrupt 0000:00:1d.7[D] -> GSI 19 (level, low) -> IRQ 19
PCI: Setting latency timer of device 0000:00:1d.7 to 64ehci_hcd 0000:00:1d.7: EHCI Host Controllerehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1ehci_hcd 0000:00:1d.7: reset hcs_params 0x104208 dbg=1 cc=4 pcc=2 ordered !ppc ports=8 ehci_hcd 0000:00:1d.7: reset hcc_params 6871 thresh 7 uframes 1024 64 bit addr ehci_hcd 0000:00:1d.7: debug port 1
PCI: cache line size of 32 is not supported by device 0000:00:1d.7ehci_hcd 0000:00:1d.7: supports USB remote wakeupehci_hcd 0000:00:1d.7: irq 19, io mem 0xee404000ehci_hcd 0000:00:1d.7: reset command 080022 (park)=0 ithresh=8 Async period=1024 Reset HALT ehci_hcd 0000:00:1d.7: init command 010001 (park)=0 ithresh=1 period=1024 RUN ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: default language 0x0409
usb usb1: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.22-rc6 ehci_hcd
usb usb1: SerialNumber: 0000:00:1d.7
usb usb1: uevent
usb usb1: usb_probe_device
usb usb1: configuration #1 chosen from 1 choice
usb usb1: adding 1-0:1.0 (config #1, interface 0)
usb 1-0:1.0: uevent
usb 1-0:1.0: uevent
hub 1-0:1.0: usb_probe_interface
hub 1-0:1.0: usb_probe_interface - got id
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 8 ports detected
hub 1-0:1.0: standalone hub
hub 1-0:1.0: no power switching (usb 1.0)
hub 1-0:1.0: individual port over-current protection
hub 1-0:1.0: Single TT
hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
hub 1-0:1.0: power on to power good time: 20ms
hub 1-0:1.0: local power source is good
hub 1-0:1.0: trying to enable port power on non-switchable hub
hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0000ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001403 POWER sig=k CSC CONNECT
USB Universal Host Controller Interface driver v3.0
hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
ACPI: PCI Interrupt 0000:00:1d.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:00:1d.0 to 64uhci_hcd 0000:00:1d.0: UHCI Host Controlleruhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2uhci_hcd 0000:00:1d.0: detected 2 portsuhci_hcd 0000:00:1d.0: uhci_check_and_reset_hc: cmd = 0x0000uhci_hcd 0000:00:1d.0: Performing full resetuhci_hcd 0000:00:1d.0: irq 16, io base 0x00001800
usb usb2: default language 0x0409
usb usb2: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: UHCI Host Controller
usb usb2: Manufacturer: Linux 2.6.22-rc6 uhci_hcd
usb usb2: SerialNumber: 0000:00:1d.0
usb usb2: uevent
usb usb2: usb_probe_device
usb usb2: configuration #1 chosen from 1 choice
usb usb2: adding 2-0:1.0 (config #1, interface 0)
usb 2-0:1.0: uevent
usb 2-0:1.0: uevent
hub 2-0:1.0: usb_probe_interface
hub 2-0:1.0: usb_probe_interface - got id
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
hub 2-0:1.0: standalone hub
hub 2-0:1.0: no power switching (usb 1.0)
hub 2-0:1.0: individual port over-current protection
hub 2-0:1.0: power on to power good time: 2ms
hub 2-0:1.0: local power source is good
hub 2-0:1.0: trying to enable port power on non-switchable hub
hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501ehci_hcd 0000:00:1d.7: port 1 low speed --> companion
ACPI: PCI Interrupt 0000:00:1d.1[B] -> GSI 17 (level, low) -> IRQ 17
PCI: Setting latency timer of device 0000:00:1d.1 to 64uhci_hcd 0000:00:1d.1: UHCI Host Controlleruhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3uhci_hcd 0000:00:1d.1: detected 2 portsuhci_hcd 0000:00:1d.1: uhci_check_and_reset_hc: cmd = 0x0000uhci_hcd 0000:00:1d.1: Performing full resetuhci_hcd 0000:00:1d.1: irq 17, io base 0x00001820
usb usb3: default language 0x0409
usb usb3: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb3: Product: UHCI Host Controller
usb usb3: Manufacturer: Linux 2.6.22-rc6 uhci_hcd
usb usb3: SerialNumber: 0000:00:1d.1
usb usb3: uevent
usb usb3: usb_probe_device
usb usb3: configuration #1 chosen from 1 choice
usb usb3: adding 3-0:1.0 (config #1, interface 0)ehci_hcd 0000:00:1d.7: GetStatus port 1 status 003002 POWER OWNER sig=se0 CSC
usb 3-0:1.0: uevent
usb 3-0:1.0: ueventehci_hcd 0000:00:1d.7: GetStatus port 8 status 001803 POWER sig=j CSC CONNECT
hub 1-0:1.0: port 8, status 0501, change 0001, 480 Mb/s
hub 3-0:1.0: usb_probe_interface
hub 3-0:1.0: usb_probe_interface - got id
hub 3-0:1.0: USB hub found
hub 3-0:1.0: 2 ports detected
hub 3-0:1.0: standalone hub
hub 3-0:1.0: no power switching (usb 1.0)
hub 3-0:1.0: individual port over-current protection
hub 3-0:1.0: power on to power good time: 2ms
hub 3-0:1.0: local power source is good
hub 3-0:1.0: trying to enable port power on non-switchable hub
ACPI: PCI Interrupt 0000:00:1d.2[C] -> GSI 18 (level, low) -> IRQ 18
PCI: Setting latency timer of device 0000:00:1d.2 to 64uhci_hcd 0000:00:1d.2: UHCI Host Controlleruhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4uhci_hcd 0000:00:1d.2: detected 2 portsuhci_hcd 0000:00:1d.2: uhci_check_and_reset_hc: cmd = 0x0000uhci_hcd 0000:00:1d.2: Performing full resetuhci_hcd 0000:00:1d.2: irq 18, io base 0x00001840
usb usb4: default language 0x0409
usb usb4: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb4: Product: UHCI Host Controller
usb usb4: Manufacturer: Linux 2.6.22-rc6 uhci_hcd
usb usb4: SerialNumber: 0000:00:1d.2
usb usb4: uevent
usb usb4: usb_probe_device
usb usb4: configuration #1 chosen from 1 choice
usb usb4: adding 4-0:1.0 (config #1, interface 0)
usb 4-0:1.0: uevent
usb 4-0:1.0: uevent
hub 4-0:1.0: usb_probe_interface
hub 4-0:1.0: usb_probe_interface - got id
hub 4-0:1.0: USB hub found
hub 4-0:1.0: 2 ports detected
hub 1-0:1.0: debounce: port 8: total 100ms stable 100ms status 0x501
hub 4-0:1.0: standalone hub
hub 4-0:1.0: no power switching (usb 1.0)
hub 4-0:1.0: individual port over-current protection
hub 4-0:1.0: power on to power good time: 2ms
hub 4-0:1.0: local power source is good
hub 4-0:1.0: trying to enable port power on non-switchable hubehci_hcd 0000:00:1d.7: port 8 full speed --> companionehci_hcd 0000:00:1d.7: GetStatus port 8 status 003801 POWER OWNER sig=j CONNECT
hub 1-0:1.0: port 8 not reset yet, waiting 50ms
ACPI: PCI Interrupt 0000:00:1d.3[D] -> GSI 19 (level, low) -> IRQ 19
PCI: Setting latency timer of device 0000:00:1d.3 to 64uhci_hcd 0000:00:1d.3: UHCI Host Controllerehci_hcd 0000:00:1d.7: GetStatus port 8 status 003002 POWER OWNER sig=se0 CSC
hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0100
hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0002uhci_hcd 0000:00:1d.0: port 1 portsc 01ab,00
hub 2-0:1.0: port 1, status 0301, change 0003, 1.5 Mb/suhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 5uhci_hcd 0000:00:1d.3: detected 2 portsuhci_hcd 0000:00:1d.3: uhci_check_and_reset_hc: cmd = 0x0000uhci_hcd 0000:00:1d.3: Performing full resetuhci_hcd 0000:00:1d.3: irq 19, io base 0x00001860
usb usb5: default language 0x0409
usb usb5: new device strings: Mfr=3, Product=2, SerialNumber=1
usb usb5: Product: UHCI Host Controller
usb usb5: Manufacturer: Linux 2.6.22-rc6 uhci_hcd
usb usb5: SerialNumber: 0000:00:1d.3
usb usb5: uevent
usb usb5: usb_probe_device
usb usb5: configuration #1 chosen from 1 choice
usb usb5: adding 5-0:1.0 (config #1, interface 0)
usb 5-0:1.0: uevent
usb 5-0:1.0: uevent
hub 5-0:1.0: usb_probe_interface
hub 5-0:1.0: usb_probe_interface - got id
hub 5-0:1.0: USB hub found
hub 5-0:1.0: 2 ports detected
hub 5-0:1.0: standalone hub
hub 5-0:1.0: no power switching (usb 1.0)
hub 5-0:1.0: individual port over-current protection
hub 5-0:1.0: power on to power good time: 2ms
hub 5-0:1.0: local power source is good
hub 5-0:1.0: trying to enable port power on non-switchable hub
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301
PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
input: AT Translated Set 2 keyboard as /class/input/input3
usb 2-1: new low speed USB device using uhci_hcd and address 2
usb 2-1: skipped 1 descriptor after interface
usb 2-1: default language 0x0409
usb 2-1: new device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1: Product: Basic Optical Mouse
usb 2-1: Manufacturer: Microsoft
usb 2-1: uevent
usb 2-1: usb_probe_device
usb 2-1: configuration #1 chosen from 1 choice
usb 2-1: adding 2-1:1.0 (config #1, interface 0)
usb 2-1:1.0: uevent
usb 2-1:1.0: uevent
hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0000
hub 4-0:1.0: state 7 ports 2 chg 0000 evt 0000
hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004uhci_hcd 0000:00:1d.3: port 2 portsc 009b,00
hub 5-0:1.0: port 2, status 0101, change 0003, 12 Mb/s
hub 5-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
usb 5-2: new full speed USB device using uhci_hcd and address 2
Synaptics Touchpad, model: 1, fw: 6.2, id: 0x81a0b1, caps: 0xa04793/0x300000
serio: Synaptics pass-through port at isa0060/serio1/input0
usb 5-2: ep0 maxpacket = 8
input: SynPS/2 Synaptics TouchPad as /class/input/input4
usb 5-2: default language 0x0409
usb 5-2: new device strings: Mfr=1, Product=2, SerialNumber=0
usb 5-2: Product: Biometric Coprocessor
usb 5-2: Manufacturer: STMicroelectronics
usb usb3: suspend_rh (auto-stop)
usb 5-2: uevent
usb 5-2: usb_probe_device
usb 5-2: configuration #1 chosen from 1 choice
usb 5-2: adding 5-2:1.0 (config #1, interface 0)
usb 5-2:1.0: uevent
usb 5-2:1.0: uevent
usbhid 2-1:1.0: usb_probe_interface
usbhid 2-1:1.0: usb_probe_interface - got id
input: Microsoft Basic Optical Mouse as /class/input/input5
input: USB HID v1.10 Mouse [Microsoft Basic Optical Mouse] on usb-0000:00:1d.0-1
usbcore: registered new interface driver usbhiddrivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
ACPI: PCI Interrupt 0000:00:1b.0[B] -> GSI 17 (level, low) -> IRQ 17
PCI: Setting latency timer of device 0000:00:1b.0 to 64
usb usb4: suspend_rh (auto-stop)
ALSA device list:
#0: HDA Intel at 0xee400000 irq 17
Netfilter messages via NETLINK v0.30.nf_conntrack version 0.5.0 (4091 buckets, 32728 max)ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
IBM TrackPoint firmware: 0x0e, buttons: 3/3
input: TPPS/2 IBM TrackPoint as /class/input/input6
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 188k freed
usb usb2: uevent
usb 2-0:1.0: uevent
usb 2-0:1.0: uevent
usb 2-1: uevent
usb 2-1:1.0: uevent
usb 2-1:1.0: uevent
usb usb3: uevent
usb 3-0:1.0: uevent
usb 3-0:1.0: uevent
usb usb4: uevent
usb 4-0:1.0: uevent
usb 4-0:1.0: uevent
usb usb5: uevent
usb 5-0:1.0: uevent
usb 5-0:1.0: uevent
usb 5-2: uevent
usb 5-2:1.0: uevent
usb 5-2:1.0: uevent
usb usb1: uevent
usb 1-0:1.0: uevent
usb 1-0:1.0: uevent
Intel(R) PRO/1000 Network Driver - version 7.3.20-k2
Copyright (c) 1999-2006 Intel Corporation.
ACPI: PCI Interrupt 0000:02:00.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:02:00.0 to 64
e1000: 0000:02:00.0: e1000_validate_option: Receive Interrupt Delay set to 32
e1000: 0000:02:00.0: e1000_probe: (PCI Express:2.5Gb/s:Width x1) 00:16:41:e3:2c:76
e1000: eth0: e1000_probe: Intel(R) PRO/1000 Network Connection
Adding 1542196k swap on /dev/sda1. Priority:-1 extents:1 across:1542196k
EXT3 FS on sda2, internal journal
fuse init (API version 7.8)
e1000: eth0: e1000_watchdog: NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
e1000: eth0: e1000_watchdog: 10/100 speed: disabling TSOuhci_hcd 0000:00:1d.0: reserve dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: reserve dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: reserve dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 2 ep81-INT, period 8, phase 4, 93 us
IA-32 Microcode Update Driver: v1.14a <[email protected]>uhci_hcd 0000:00:1d.0: reserve dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: reserve dev 2 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 2 ep81-INT, period 8, phase 4, 93 us
Suspending console(s)
hub 5-0:1.0: hub_suspend
usb usb5: suspend_rh
hub 4-0:1.0: hub_suspend
usb usb4: suspend_rh
hub 3-0:1.0: hub_suspend
usb usb3: suspend_rh
hub 2-0:1.0: hub_suspend
usb usb2: suspend_rh
hub 1-0:1.0: hub_suspendehci_hcd 0000:00:1d.7: suspend root hub
sd 0:0:0:0: [sda] Synchronizing SCSI cache
sd 0:0:0:0: [sda] Stopping disk
ACPI: PCI interrupt for device 0000:02:00.0 disabled
ACPI: PCI interrupt for device 0000:00:1d.7 disabledehci_hcd 0000:00:1d.7: --> PCI D3/wakeupuhci_hcd 0000:00:1d.3: uhci_suspend
ACPI: PCI interrupt for device 0000:00:1d.3 disableduhci_hcd 0000:00:1d.3: --> PCI D0/legacyuhci_hcd 0000:00:1d.2: uhci_suspend
ACPI: PCI interrupt for device 0000:00:1d.2 disableduhci_hcd 0000:00:1d.2: --> PCI D0/legacyuhci_hcd 0000:00:1d.1: uhci_suspend
ACPI: PCI interrupt for device 0000:00:1d.1 disableduhci_hcd 0000:00:1d.1: --> PCI D0/legacyuhci_hcd 0000:00:1d.0: uhci_suspend
ACPI: PCI interrupt for device 0000:00:1d.0 disableduhci_hcd 0000:00:1d.0: --> PCI D0/legacy
ACPI: PCI interrupt for device 0000:00:1b.0 disabled
Disabling non-boot CPUs ...
CPU 1 is now offline
SMP alternatives: switching to UP code
CPU1 is down
Extended CMOS year: 2000
Back to C!
Extended CMOS year: 2000
Enabling non-boot CPUs ...
SMP alternatives: switching to SMP code
Booting processor 1/2 APIC 0x1
Initializing CPU#1
Calibrating delay using timer specific routine.. 3657.62 BogoMIPS (lpj=7315250)
CPU: L1 I cache: 32K, L1 D cache: 32K
CPU: L2 cache: 2048K
CPU: Physical Processor ID: 0
CPU: Processor Core ID: 1
Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz stepping 06
CPU1 is up
PM: Writing back config space on device 0000:00:01.0 at offset 7 (was 20002020, writing 2020)
PM: Writing back config space on device 0000:00:01.0 at offset 1 (was 100107, writing 100507)
PCI: Setting latency timer of device 0000:00:01.0 to 64
PM: Writing back config space on device 0000:00:1b.0 at offset 1 (was 100106, writing 100102)
ACPI: PCI Interrupt 0000:00:1b.0[B] -> GSI 17 (level, low) -> IRQ 17
PCI: Setting latency timer of device 0000:00:1b.0 to 64
PM: Writing back config space on device 0000:00:1c.0 at offset 1 (was 180107, writing 100507)
PCI: Setting latency timer of device 0000:00:1c.0 to 64
PM: Writing back config space on device 0000:00:1c.1 at offset 1 (was 100107, writing 100507)
PCI: Setting latency timer of device 0000:00:1c.1 to 64
PM: Writing back config space on device 0000:00:1c.2 at offset 7 (was 20007060, writing 7060)
PM: Writing back config space on device 0000:00:1c.2 at offset 1 (was 100107, writing 100507)
PCI: Setting latency timer of device 0000:00:1c.2 to 64
PM: Writing back config space on device 0000:00:1c.3 at offset f (was 40400, writing 4040b)
PM: Writing back config space on device 0000:00:1c.3 at offset 9 (was 10001, writing e421e421)
PM: Writing back config space on device 0000:00:1c.3 at offset 8 (was 0, writing ebf0ea00)
PM: Writing back config space on device 0000:00:1c.3 at offset 7 (was 20000000, writing 9080)
PM: Writing back config space on device 0000:00:1c.3 at offset 3 (was 810000, writing 810010)
PM: Writing back config space on device 0000:00:1c.3 at offset 1 (was 100000, writing 100507)
PCI: Setting latency timer of device 0000:00:1c.3 to 64uhci_hcd 0000:00:1d.0: PCI legacy resume
ACPI: PCI Interrupt 0000:00:1d.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:00:1d.0 to 64uhci_hcd 0000:00:1d.0: uhci_resumeuhci_hcd 0000:00:1d.0: uhci_check_and_reset_hc: legsup = 0x2f00uhci_hcd 0000:00:1d.0: Performing full reset
usb usb2: root hub lost power or was reset
usb usb2: suspend_rh
hub 2-0:1.0: hub_resume
usb usb2: wakeup_rhuhci_hcd 0000:00:1d.1: PCI legacy resume
ACPI: PCI Interrupt 0000:00:1d.1[B] -> GSI 17 (level, low) -> IRQ 17
PCI: Setting latency timer of device 0000:00:1d.1 to 64uhci_hcd 0000:00:1d.1: uhci_resumeuhci_hcd 0000:00:1d.1: uhci_check_and_reset_hc: legsup = 0x2000uhci_hcd 0000:00:1d.1: Performing full reset
usb usb3: root hub lost power or was reset
usb usb3: suspend_rhuhci_hcd 0000:00:1d.2: PCI legacy resume
ACPI: PCI Interrupt 0000:00:1d.2[C] -> GSI 18 (level, low) -> IRQ 18
PCI: Setting latency timer of device 0000:00:1d.2 to 64uhci_hcd 0000:00:1d.2: uhci_resumeuhci_hcd 0000:00:1d.2: uhci_check_and_reset_hc: legsup = 0x2000uhci_hcd 0000:00:1d.2: Performing full reset
usb usb4: root hub lost power or was reset
usb usb4: suspend_rhuhci_hcd 0000:00:1d.3: PCI legacy resume
ACPI: PCI Interrupt 0000:00:1d.3[D] -> GSI 19 (level, low) -> IRQ 19
PCI: Setting latency timer of device 0000:00:1d.3 to 64uhci_hcd 0000:00:1d.3: uhci_resumeuhci_hcd 0000:00:1d.3: uhci_check_and_reset_hc: legsup = 0x2000uhci_hcd 0000:00:1d.3: Performing full reset
usb usb5: root hub lost power or was reset
usb usb5: suspend_rhehci_hcd 0000:00:1d.7: PCI D0, from previous PCI D3
ACPI: PCI Interrupt 0000:00:1d.7[D] -> GSI 19 (level, low) -> IRQ 19
PCI: Setting latency timer of device 0000:00:1d.7 to 64
PM: Writing back config space on device 0000:00:1e.0 at offset 1 (was 100005, writing 100007)
PCI: Setting latency timer of device 0000:00:1e.0 to 64
ACPI: PCI Interrupt 0000:00:1f.1[C] -> GSI 16 (level, low) -> IRQ 16
PM: Writing back config space on device 0000:00:1f.2 at offset 1 (was 2b00007, writing 2b00407)
PCI: Setting latency timer of device 0000:00:1f.2 to 64
hub 5-0:1.0: hub_resume
usb usb5: wakeup_rh
hub 2-0:1.0: state 7 ports 2 chg 0002 evt 0000uhci_hcd 0000:00:1d.0: port 1 portsc 008a,00
hub 2-0:1.0: port 1, status 0100, change 0003, 12 Mb/s
usb 2-1: USB disconnect, address 2
usb 2-1: unregistering device
usb 2-1: usb_disable_device nuking all URBs
usb 2-1: unregistering interface 2-1:1.0usb_endpoint usbdev2.2_ep81: ep_device_release called for usbdev2.2_ep81
usb 2-1:1.0: uevent
usb 2-1:1.0: ueventusb_endpoint usbdev2.2_ep00: ep_device_release called for usbdev2.2_ep00
usb 2-1: uevent
hub 1-0:1.0: hub_resumeehci_hcd 0000:00:1d.7: resume root hub
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x100
hub 5-0:1.0: state 7 ports 2 chg 0004 evt 0004uhci_hcd 0000:00:1d.3: port 2 portsc 008a,00
hub 5-0:1.0: port 2, status 0100, change 0003, 12 Mb/s
usb 5-2: USB disconnect, address 2
usb 5-2: unregistering device
usb 5-2: usb_disable_device nuking all URBs
usb 5-2: unregistering interface 5-2:1.0usb_endpoint usbdev5.2_ep81: ep_device_release called for usbdev5.2_ep81 usb_endpoint usbdev5.2_ep02: ep_device_release called for usbdev5.2_ep02 usb_endpoint usbdev5.2_ep83: ep_device_release called for usbdev5.2_ep83
usb 5-2:1.0: uevent
usb 5-2:1.0: ueventusb_endpoint usbdev5.2_ep00: ep_device_release called for usbdev5.2_ep00
usb 5-2: uevent
hub 5-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x100
hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0102ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001403 POWER sig=k CSC CONNECT
hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s
hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501ehci_hcd 0000:00:1d.7: port 1 low speed --> companionehci_hcd 0000:00:1d.7: GetStatus port 1 status 003002 POWER OWNER sig=se0 CSC ehci_hcd 0000:00:1d.7: GetStatus port 8 status 001803 POWER sig=j CSC CONNECT
hub 1-0:1.0: port 8, status 0501, change 0001, 480 Mb/s
hub 1-0:1.0: debounce: port 8: total 100ms stable 100ms status 0x501ehci_hcd 0000:00:1d.7: port 8 full speed --> companionehci_hcd 0000:00:1d.7: GetStatus port 8 status 003801 POWER OWNER sig=j CONNECT
hub 1-0:1.0: port 8 not reset yet, waiting 50msehci_hcd 0000:00:1d.7: GetStatus port 8 status 003002 POWER OWNER sig=se0 CSC
hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0100
hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0002uhci_hcd 0000:00:1d.0: port 1 portsc 01a3,00
hub 2-0:1.0: port 1, status 0301, change 0001, 1.5 Mb/s
hub 2-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x301
usb 2-1: new low speed USB device using uhci_hcd and address 3
PM: Writing back config space on device 0000:01:00.0 at offset 1 (was 100103, writing 100107)
PM: Writing back config space on device 0000:02:00.0 at offset 1 (was 100107, writing 100507)
ACPI: PCI Interrupt 0000:02:00.0[A] -> GSI 16 (level, low) -> IRQ 16
PCI: Setting latency timer of device 0000:02:00.0 to 64
PM: Writing back config space on device 0000:15:00.0 at offset f (was 34001ff, writing 3c0010b)
PM: Writing back config space on device 0000:15:00.0 at offset e (was 0, writing a4fc)
PM: Writing back config space on device 0000:15:00.0 at offset d (was 0, writing a400)
PM: Writing back config space on device 0000:15:00.0 at offset c (was 0, writing a0fc)
PM: Writing back config space on device 0000:15:00.0 at offset b (was 0, writing a000)
PM: Writing back config space on device 0000:15:00.0 at offset a (was 0, writing 53fff000)
PM: Writing back config space on device 0000:15:00.0 at offset 9 (was 0, writing 50000000)
PM: Writing back config space on device 0000:15:00.0 at offset 8 (was 0, writing e3fff000)
PM: Writing back config space on device 0000:15:00.0 at offset 7 (was 0, writing e0000000)
PM: Writing back config space on device 0000:15:00.0 at offset 6 (was 0, writing b0171615)
PM: Writing back config space on device 0000:15:00.0 at offset 4 (was 0, writing e4300000)
PM: Writing back config space on device 0000:15:00.0 at offset 3 (was 20000, writing 2a808)
PM: Writing back config space on device 0000:15:00.0 at offset 1 (was 2100000, writing 2100007)
ACPI: PCI Interrupt 0000:15:00.0[A] -> GSI 16 (level, low) -> IRQ 16
usb 2-1: skipped 1 descriptor after interface
hda: selected mode 0x42
usb 2-1: default language 0x0409
sd 0:0:0:0: [sda] Starting disk
usb 2-1: new device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1: Product: Basic Optical Mouse
usb 2-1: Manufacturer: Microsoft
usb 2-1: uevent
usb 2-1: usb_probe_device
usb 2-1: configuration #1 chosen from 1 choice
usb 2-1: adding 2-1:1.0 (config #1, interface 0)
usb 2-1:1.0: uevent
usb 2-1:1.0: uevent
usbhid 2-1:1.0: usb_probe_interface
usbhid 2-1:1.0: usb_probe_interface - got id
input: Microsoft Basic Optical Mouse as /class/input/input7
input: USB HID v1.10 Mouse [Microsoft Basic Optical Mouse] on usb-0000:00:1d.0-1
hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0004uhci_hcd 0000:00:1d.3: port 2 portsc 0093,00
hub 5-0:1.0: port 2, status 0101, change 0001, 12 Mb/suhci_hcd 0000:00:1d.0: reserve dev 3 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 3 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: reserve dev 3 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 3 ep81-INT, period 8, phase 4, 93 us
hub 5-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
ata2: SATA link down (SStatus 0 SControl 0)
ata3: SATA link down (SStatus 0 SControl 0)
ata4: SATA link down (SStatus 0 SControl 0)
usb 5-2: new full speed USB device using uhci_hcd and address 3
ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
usb 5-2: ep0 maxpacket = 8
ata1.00: ata_hpa_resize 1: sectors = 156301488, hpa_sectors = 156301488
ata1.00: ata_hpa_resize 1: sectors = 156301488, hpa_sectors = 156301488
ata1.00: configured for UDMA/100
usb 5-2: default language 0x0409
sd 0:0:0:0: [sda] 156301488 512-byte hardware sectors (80026 MB)
hub 3-0:1.0: hub_resume
usb usb3: wakeup_rh
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
usb 5-2: new device strings: Mfr=1, Product=2, SerialNumber=0
usb 5-2: Product: Biometric Coprocessor
usb 5-2: Manufacturer: STMicroelectronics
usb 5-2: uevent
usb 5-2: usb_probe_device
usb 5-2: configuration #1 chosen from 1 choice
usb 5-2: adding 5-2:1.0 (config #1, interface 0)
usb 5-2:1.0: uevent
usb 5-2:1.0: uevent
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0000
hub 4-0:1.0: hub_resume
usb usb4: wakeup_rh
hub 4-0:1.0: state 7 ports 2 chg 0000 evt 0000
usb usb3: suspend_rh (auto-stop)
usb usb4: suspend_rh (auto-stop)
e1000: eth0: e1000_watchdog: NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
e1000: eth0: e1000_watchdog: 10/100 speed: disabling TSO
ata4: soft resetting port
ata4: SATA link down (SStatus 0 SControl 0)
ata4: EH complete
ata3: soft resetting port
ata3: SATA link down (SStatus 0 SControl 0)
ata3: EH complete
ata2: soft resetting port
ata2: SATA link down (SStatus 0 SControl 0)
ata2: EH complete
Uhhuh. NMI received for unknown reason a0.
You have some hardware problem, likely on the PCI bus.
Dazed and confused, but trying to continueuhci_hcd 0000:00:1d.0: reserve dev 3 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 3 ep81-INT, period 8, phase 4, 93 us
Suspending console(s)
hub 5-0:1.0: port 2 nyet suspended
hub 5-0:1.0: suspend error -16suspend_device(): usb_suspend+0x0/0x1c() returns -16
Could not suspend device usb5: error -16
Some devices failed to suspend
ata4: soft resetting port
ata4: SATA link down (SStatus 0 SControl 0)
ata4: EH complete
ata3: soft resetting port
ata3: SATA link down (SStatus 0 SControl 0)
ata3: EH complete
ata2: soft resetting port
ata2: SATA link down (SStatus 0 SControl 0)
ata2: EH completeuhci_hcd 0000:00:1d.0: reserve dev 3 ep81-INT, period 8, phase 4, 93 usuhci_hcd 0000:00:1d.0: release dev 3 ep81-INT, period 8, phase 4, 93 us
Suspending console(s)
hub 5-0:1.0: port 2 nyet suspended
hub 5-0:1.0: suspend error -16suspend_device(): usb_suspend+0x0/0x1c() returns -16
Could not suspend device usb5: error -16
Some devices failed to suspend
ata4: soft resetting port
ata4: SATA link down (SStatus 0 SControl 0)
ata4: EH complete
ata3: soft resetting port
ata3: SATA link down (SStatus 0 SControl 0)
ata3: EH complete
ata2: soft resetting port
ata2: SATA link down (SStatus 0 SControl 0)
ata2: EH completeuhci_hcd 0000:00:1d.0: reserve dev 3 ep81-INT, period 8, phase 4, 93 us
Quoted 5 lines
Quoted 3 lines
Umm, and CODA which is _very_ similar to fuse was there long before fuse or the freezer ;)
I did userfs around 1994-5.
Yes, fuse didn't in fact have very much original idea in it. It was just putting all the pieces together to make a stable and useful userspace filesystem framework.
Miklos
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally request_wait_answer() And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Regards
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally request_wait_answer() And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Regards
Oliver
Quoted 12 lines
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Quoted 7 lines
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
Miklos
Quoted 12 lines
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Quoted 7 lines
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
Miklos
Quoted 20 lines · Miklos Szeredi
Quoted 12 lines
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Quoted 7 lines
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
How probable is this situation?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 20 lines · Miklos Szeredi
Quoted 12 lines
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Quoted 7 lines
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
How probable is this situation?
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 20 lines
Quoted 12 lines
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Quoted 7 lines
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
The freezer introduces a further limitation in that the server can freeze before the client, which must not be. You can prevent that by freezing the servers last.
In principle you might have dependencies between servers and you won't catch that, true. You won't catch servers blocking on IPC, but you are balancing on the edge of deadlock with fuse anyway.
Regards
Oliver
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?
Quoted 7 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
How probable is this situation?
I guess it depends on usage patterns.
I don't remember seeing any such cases, even though I have a permanent fuse mount, and I suspend regularly. But the fs is probably totally idle during suspend in my case.
But some people use fuse as a home or root filesystem and in those cases it can become quite likely to cause problems.
Miklos
Quoted 6 lines · Miklos Szeredi
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
So, I wonder why I don't see that error on my powerbook?
That's a good question. Miklos, can you please reproduce the suspend error using a kernel built with
CONFIG_USB_DEBUGturned on?Here's the full dmesg. First there was a successful suspend/resume, then a couple of unsuccessful ones:
Okay, good. It's not a coincidence that the first one worked and later ones didn't. Here's what happened:
You suspended the system. Upon resuming, the USB host controller drivers detected that their device sessions had been interrupted and consequently marked your two USB devices (the optical mouse and the biometric thingy) for removal. Normally that removal would take place when khubd wakes up, i.e., after the resume is complete and the thread is taken out of the freezer.
But in this case khubd was already awake. It resumed the two root hubs in response to their remote wakeup requests and saw that the devices were gone. So it unregistered the device structures immediately -- even before the PM core tried to resume them -- and then registered new data structures to embody the new device connections. As far as I can tell, the fact that these new device structures were created while the suspend-list was in flux must have caused one of them (the biometric coprocessor) not to be added to the appropriate list.
Thus the next time you tried to suspend, the PM core didn't call the device's suspend method. It was left awake, and as a result its parent hub refused to suspend (since it had an unsuspended child). This caused the overall system suspend to fail.
This illustrates the folly of allowing other threads to perform driver-core-type operations in the middle of a system sleep transition.
Alan Stern
Quoted 6 lines · Miklos Szeredi
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines · Alan Stern
Remember what I wrote a few minutes ago about khubd and
ksuspend_usbdwanting to resume devices during a system suspend transition? This is exactly what happens when those threads aren't frozen.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
So, I wonder why I don't see that error on my powerbook?
That's a good question. Miklos, can you please reproduce the suspend error using a kernel built with
CONFIG_USB_DEBUGturned on?Here's the full dmesg. First there was a successful suspend/resume, then a couple of unsuccessful ones:
Okay, good. It's not a coincidence that the first one worked and later ones didn't. Here's what happened:
You suspended the system. Upon resuming, the USB host controller drivers detected that their device sessions had been interrupted and consequently marked your two USB devices (the optical mouse and the biometric thingy) for removal. Normally that removal would take place when khubd wakes up, i.e., after the resume is complete and the thread is taken out of the freezer.
But in this case khubd was already awake. It resumed the two root hubs in response to their remote wakeup requests and saw that the devices were gone. So it unregistered the device structures immediately -- even before the PM core tried to resume them -- and then registered new data structures to embody the new device connections. As far as I can tell, the fact that these new device structures were created while the suspend-list was in flux must have caused one of them (the biometric coprocessor) not to be added to the appropriate list.
Thus the next time you tried to suspend, the PM core didn't call the device's suspend method. It was left awake, and as a result its parent hub refused to suspend (since it had an unsuspended child). This caused the overall system suspend to fail.
This illustrates the folly of allowing other threads to perform driver-core-type operations in the middle of a system sleep transition.
Alan Stern
Quoted 11 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
Obviously. But I wasn't about the server trying to acquire a lock held by a client. I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
Quoted 7 lines
The freezer introduces a further limitation in that the server can freeze before the client, which must not be. You can prevent that by freezing the servers last.
In principle you might have dependencies between servers and you won't catch that, true. You won't catch servers blocking on IPC, but you are balancing on the edge of deadlock with fuse anyway.
Huh?
Miklos
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
Quoted 7 lines
Obviously. But I wasn't about the server trying to acquire a lock held by a client. I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Regards
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
Quoted 7 lines
Obviously. But I wasn't about the server trying to acquire a lock held by a client. I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Regards
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Oliver Neukum:
Quoted 17 lines
Am Donnerstag, 5. Juli 2007 schrieb Miklos Szeredi:
Quoted 16 lines
Quoted 11 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
Obviously. But I wasn't about the server trying to acquire a lock held by a client. I was talking about a client trying to acquire a lock held by _another_ client.
Quoted 7 lines
Quoted 3 lines
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Any replying to myself. A deadlock here is not fatal. You can and will timeout in the freezer and can try again.
REegards
Oliver
Quoted 27 lines · Miklos Szeredi
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?Quoted 7 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
How probable is this situation?
Quoted 8 lines
I guess it depends on usage patterns.
I don't remember seeing any such cases, even though I have a permanent fuse mount, and I suspend regularly. But the fs is probably totally idle during suspend in my case.
But some people use fuse as a home or root filesystem and in those cases it can become quite likely to cause problems.
That means we need to prevent the freezer from sending freeze requests FUSE's filesystem servers too early.
What about this (more or less):
1) We add a list of userland processes to the freezer that should not be frozen in the first phase (ie. during the freezing of user space). They will be frozen anyway along with the freezable kernel threads.
2) FUSE adds its filesystem servers to this list upon connecting to them
3) FUSE removes its filesystem servers from this list upon disconnecting
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 27 lines · Miklos Szeredi
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
Actually, why do you need this? There is no absolute need that you finish the request. You must either finish the request or let yourself be frozen.
A quick look through fuse reveals principally
request_wait_answer()And maybe a few other places. Is there some hidden reason you cannot handle being frozen here?Quoted 7 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
How probable is this situation?
Quoted 8 lines
I guess it depends on usage patterns.
I don't remember seeing any such cases, even though I have a permanent fuse mount, and I suspend regularly. But the fs is probably totally idle during suspend in my case.
But some people use fuse as a home or root filesystem and in those cases it can become quite likely to cause problems.
That means we need to prevent the freezer from sending freeze requests FUSE's filesystem servers too early.
What about this (more or less):
1) We add a list of userland processes to the freezer that should not be frozen in the first phase (ie. during the freezing of user space). They will be frozen anyway along with the freezable kernel threads.
2) FUSE adds its filesystem servers to this list upon connecting to them
3) FUSE removes its filesystem servers from this list upon disconnecting
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 11 lines · Oliver Neukum
Quoted 7 lines
Obviously. Â But I wasn't about the server trying to acquire a lock held by a client. Â I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Just to make things more complicated... Since a server isn't restricted in what it can do, what happens when one server depends on another server?
Alan Stern
Quoted 11 lines · Oliver Neukum
Quoted 7 lines
Obviously. Â But I wasn't about the server trying to acquire a lock held by a client. Â I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Just to make things more complicated... Since a server isn't restricted in what it can do, what happens when one server depends on another server?
Alan Stern
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
Obviously. But I wasn't about the server trying to acquire a lock held by a client. I was talking about a client trying to acquire a lock held by _another_ client.
Quoted 7 lines
Quoted 3 lines
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Umm, let's take sshfs, it has a separate "reply processing thread", that reads replies from the sftp server and then wakes up the relevant request thread. The reply processing thread has no direct contact with the fuse kernel module. How is freezer supposed to know that that task in fact also belongs to the server and needs to be kept from freezing?
Given, it's in the same thread group, but using that is a rather weak heuristic, as it could easily be a separate process, and likely in some filesystems it is.
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that PF_FREEZER_SKIP and the kernel dotted randomly with try_to_freeze() calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.
Miklos
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
OK, you made me reach for literatur on theoretical computer science.
IMHO the range of actions a fuse server is inherently limited. You must never ever block on a lock one of your clients is holding. In this case the limitation is not influenced by the freezer.
Obviously. But I wasn't about the server trying to acquire a lock held by a client. I was talking about a client trying to acquire a lock held by _another_ client.
Quoted 7 lines
Quoted 3 lines
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Umm, let's take sshfs, it has a separate "reply processing thread", that reads replies from the sftp server and then wakes up the relevant request thread. The reply processing thread has no direct contact with the fuse kernel module. How is freezer supposed to know that that task in fact also belongs to the server and needs to be kept from freezing?
Given, it's in the same thread group, but using that is a rather weak heuristic, as it could easily be a separate process, and likely in some filesystems it is.
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that PF_FREEZER_SKIP and the kernel dotted randomly with try_to_freeze() calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.
Miklos
Quoted 5 lines · Miklos Szeredi
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.
I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
Alan Stern
Quoted 5 lines · Miklos Szeredi
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.
I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
Alan Stern
Am Donnerstag, 5. Juli 2007 schrieb Alan Stern:
Quoted 10 lines · Oliver Neukum
Quoted 9 lines
Quoted 8 lines
Obviously. Â But I wasn't about the server trying to acquire a lock held by a client. Â I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
Quoted 7 lines
Quoted 3 lines
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Just to make things more complicated... Since a server isn't restricted in what it can do, what happens when one server depends on another server?
The same principle applies. If you really want that you can solve this by freezing servers in the reverse sequence they were started.
The main point remains. If you have a circular dependency anywhere among the servers you can deadlock independent of the freezer.
Regards
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Alan Stern:
Quoted 10 lines · Oliver Neukum
Quoted 9 lines
Quoted 8 lines
Obviously. Â But I wasn't about the server trying to acquire a lock held by a client. Â I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
Quoted 7 lines
Quoted 3 lines
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Just to make things more complicated... Since a server isn't restricted in what it can do, what happens when one server depends on another server?
The same principle applies. If you really want that you can solve this by freezing servers in the reverse sequence they were started.
The main point remains. If you have a circular dependency anywhere among the servers you can deadlock independent of the freezer.
Regards
Oliver
Quoted 10 lines
Quoted 5 lines
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
This has already been discussed, with the conclusion, that it can't be done without hacking VFS internals.
The basic problem is that the freezer tries to get every user process out of the kernel even when those processes have _nothing_ to do with drivers and could happily stay in kernel land across a suspend or even hibernate.
If we could have a good grip on when a request is entering a driver, it would be easy to take care of this. I guess network and block devices are easy. For others there's no obvious common place where such barriers could be placed so it's more work, but nothing conceptually problematic. Is this about right?
Miklos
Quoted 14 lines
Quoted 14 lines · Oliver Neukum
Quoted 12 lines
Quoted 8 lines
Obviously. Â But I wasn't about the server trying to acquire a lock held by a client. Â I was talking about a client trying to acquire a lock held by _another_ client.
If this coincides with the server (or some other task which the server is depending on) being frozen before the clients, the freezer has a problem.
True, but that case can only happen if servers are frozen before clients. You don't need a full dependency graph. A simple set sequence of two classes of tasks will do.
Quoted 6 lines
Quoted 3 lines
Just to make things more complicated... Since a server isn't restricted in what it can do, what happens when one server depends on another server?
The same principle applies. If you really want that you can solve this by freezing servers in the reverse sequence they were started.
You just can't know what constitutes a "server", processes which read from the fuse device are candidates, but all tasks which communicate with these in some way are also. And that basically makes every userspace task in the system a candidate server and you are no further than before.
Quoted 2 lines
The main point remains. If you have a circular dependency anywhere among the servers you can deadlock independent of the freezer.
Well, Duh.
Miklos
Am Donnerstag, 5. Juli 2007 schrieb Alan Stern:
Quoted 8 lines · Miklos Szeredi
Quoted 6 lines
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.
Quoted 4 lines
I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
OK, some radical ideas.
In principle we want a deadlock here. Tasks that are frozen due to fuse are as good as frozen, there's no need to formally freeze them. The bad uninterruptible tasks are those waiting for hardware.
Can we detect the difference? Perhaps we can label those crucial locks and when only tasks in the refrigerator and tasks waiting on these locks are left we are content and go on to suspending the device tree.
Flame away
Oliver
Am Donnerstag, 5. Juli 2007 schrieb Alan Stern:
Quoted 8 lines · Miklos Szeredi
Quoted 6 lines
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.
Quoted 4 lines
I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
OK, some radical ideas.
In principle we want a deadlock here. Tasks that are frozen due to fuse are as good as frozen, there's no need to formally freeze them. The bad uninterruptible tasks are those waiting for hardware.
Can we detect the difference? Perhaps we can label those crucial locks and when only tasks in the refrigerator and tasks waiting on these locks are left we are content and go on to suspending the device tree.
Flame away
Oliver
Good morning!
Quoted 8 lines · On Thursday 05 July 2007 23:59:57 Rafael J. Wysocki wrote:
Quoted 7 lines · Nigel Cunningham
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do
you
Quoted 2 lines
Quoted 2 lines
do
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse is
already
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
frozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on
the
Quoted 9 lines
Quoted 9 lines
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and
putting
Quoted 7 lines
Quoted 7 lines
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
is just user un-friendly.
In fact, I'd like to remove the
sys_sync()from the freezer
entirely,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
because
Quoted 3 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is
that we
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
have a chance to write out everything when applications cannot
produce
Quoted 2 lines
Quoted 2 lines
more
Quoted 1 line
Quoted 1 line
Quoted 1 line
data to write, but there are filesystems which don't do that anyway
(eg.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should
sync
Quoted 4 lines
Quoted 4 lines
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse
processes
Quoted 6 lines
Quoted 6 lines
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 3 lines
Quoted 3 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and
data
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 1 line
Quoted 1 line
sync themselves if they don't already, but that's racy. As it is at
the
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never
a
Quoted 4 lines
Quoted 4 lines
problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll
be
Quoted 5 lines
Quoted 2 lines
more unsynced data when you
sys_synccall finishes). Stopping userspace before syncing removes that race.Yes, that will make the suspend/hibernation less reliable in case the resume fails (some data, written after the sync, may be lost). However, the sync
done
Quoted 1 line
from within the freezer doesn't guarantee that there are no data lost
anyway,
Quoted 4 lines
so we don't lose much by not doing it.
Now, there's a question how much data may be lost, potentially, if we do the sync before the freezer and I don't think that's a lot.
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss. As I said about, XFS should be fixed to properly sync its data, and something should be done about fuse filesystems too.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Good morning!
Quoted 8 lines · On Thursday 05 July 2007 23:59:57 Rafael J. Wysocki wrote:
Quoted 7 lines · Nigel Cunningham
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do
you
Quoted 2 lines
Quoted 2 lines
do
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse is
already
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
frozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on
the
Quoted 9 lines
Quoted 9 lines
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and
putting
Quoted 7 lines
Quoted 7 lines
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). It
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
is just user un-friendly.
In fact, I'd like to remove the
sys_sync()from the freezer
entirely,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
because
Quoted 3 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()is
that we
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
have a chance to write out everything when applications cannot
produce
Quoted 2 lines
Quoted 2 lines
more
Quoted 1 line
Quoted 1 line
Quoted 1 line
data to write, but there are filesystems which don't do that anyway
(eg.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should
sync
Quoted 4 lines
Quoted 4 lines
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse
processes
Quoted 6 lines
Quoted 6 lines
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 3 lines
Quoted 3 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and
data
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 1 line
Quoted 1 line
sync themselves if they don't already, but that's racy. As it is at
the
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never
a
Quoted 4 lines
Quoted 4 lines
problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll
be
Quoted 5 lines
Quoted 2 lines
more unsynced data when you
sys_synccall finishes). Stopping userspace before syncing removes that race.Yes, that will make the suspend/hibernation less reliable in case the resume fails (some data, written after the sync, may be lost). However, the sync
done
Quoted 1 line
from within the freezer doesn't guarantee that there are no data lost
anyway,
Quoted 4 lines
so we don't lose much by not doing it.
Now, there's a question how much data may be lost, potentially, if we do the sync before the freezer and I don't think that's a lot.
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss. As I said about, XFS should be fixed to properly sync its data, and something should be done about fuse filesystems too.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Hi!
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
I have discussed the benefits elsewhere. As for the deadlocks -- do you still observe them if you use the version of the freezer which doesn't freeze kernel threads?
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyNow process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.
Quoted 8 lines
Quoted 5 lines
Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Okay, and you should handle refrigerator in the same paths where you handle SIGKILL. Just add try_to_freeze() there...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
I have discussed the benefits elsewhere. As for the deadlocks -- do you still observe them if you use the version of the freezer which doesn't freeze kernel threads?
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyNow process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.
Quoted 8 lines
Quoted 5 lines
Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Okay, and you should handle refrigerator in the same paths where you handle SIGKILL. Just add try_to_freeze() there...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 6 lines
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
Yet another ugly hack to work around the fact that the freezer cannot work reliably ... yuck
Why not spend that energy fixing drivers to properly block requests instead ?
Ben.
Quoted 4 lines · Pavel Machek
...but the moment you start blocking tasks that done driver request, you _do_ have mini-freezer of your own, with pretty much the same problems.
No, not at all the same problems. Those tasks will block, but that will be harmless because we won't have some "freezer" things waiting for all tasks to reach a "stable" point (calling try_to_freeze()). We just let them block wherever we want, as long as it doesn't prevent a -driver- from suspending, which should be allright, we have no problem.
Quoted 2 lines
In another message I shown that removing freezer will not help with FUSE in general case.
I disagree.
Quoted 3 lines
It probably does not help with firmware, too; as soon as udev attempts to do something with your wireless card, it is blocked, and if the wireless card needs the firmware from udev, you are deadlocked.
Firmware load has been a problem since day 1, I've talked about it multiple times, it's broken with or without the freezer, and so far, the reaction of pretty much everybody has been to dig their head deeper in the mud and ignore the problem.
There are other issues (again, with or without freezer) that should be dealt with. For example, drivers that haven't yet got their suspend() callback or already have got their resume() may rely on services of the kernel that are still blocked, that's where things may go hairy. request_firmware() within resume() is a typical example of that.
There are a few things we should do in that area. For example, once we start to call driver suspend's, we should probably set a system wide flag that will do things such as:
- block usermode helpers (either make call_usermodehelper return
something like -EBUSY or have it queue up the calls and issue them later when thing are resuming, we need to look closely at what semantic we want here).
- Silently add GFP_NOIO to all allocations, to avoid having things
blocking in kmalloc() with a mutex held that will deadlock with suspend() in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
- Deal with the firmware problem. The best way is probably to have an
async request_firmware interface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Ben.
Quoted 4 lines · Pavel Machek
...but the moment you start blocking tasks that done driver request, you _do_ have mini-freezer of your own, with pretty much the same problems.
No, not at all the same problems. Those tasks will block, but that will be harmless because we won't have some "freezer" things waiting for all tasks to reach a "stable" point (calling try_to_freeze()). We just let them block wherever we want, as long as it doesn't prevent a -driver- from suspending, which should be allright, we have no problem.
Quoted 2 lines
In another message I shown that removing freezer will not help with FUSE in general case.
I disagree.
Quoted 3 lines
It probably does not help with firmware, too; as soon as udev attempts to do something with your wireless card, it is blocked, and if the wireless card needs the firmware from udev, you are deadlocked.
Firmware load has been a problem since day 1, I've talked about it multiple times, it's broken with or without the freezer, and so far, the reaction of pretty much everybody has been to dig their head deeper in the mud and ignore the problem.
There are other issues (again, with or without freezer) that should be dealt with. For example, drivers that haven't yet got their suspend() callback or already have got their resume() may rely on services of the kernel that are still blocked, that's where things may go hairy. request_firmware() within resume() is a typical example of that.
There are a few things we should do in that area. For example, once we start to call driver suspend's, we should probably set a system wide flag that will do things such as:
- block usermode helpers (either make call_usermodehelper return
something like -EBUSY or have it queue up the calls and issue them later when thing are resuming, we need to look closely at what semantic we want here).
- Silently add GFP_NOIO to all allocations, to avoid having things
blocking in kmalloc() with a mutex held that will deadlock with suspend() in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
- Deal with the firmware problem. The best way is probably to have an
async request_firmware interface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Ben.
Quoted 4 lines · Alan Stern
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Because nobody is waiting on that kernel thread anyway without a freezer so there is no deadlock anymore.
Quoted 10 lines
I disagree with your analysis -- not that it's completely wrong, but it points out an existing basic problem in the kernel. The kernel should never depend on userspace! More correctly, a task executing in the kernel should never block with any sort of mutex or other lock held (in a way that would preclude it from being frozen, let's say) while waiting for a response from userspace.
Then the dependency graph would be easy to construct: User tasks can depend on whatever they want, and kernel threads never depend on a user task.
In an idea world, there would be no hunger...
Quoted 3 lines
If this contradicts the existing implementations and APIs for userspace filesystems, then so be it. My conclusion would be that the implementations and APIs should be changed.
Why are you guys working so hard and spending so much energy to try to avoid doing the right thing is beyond my understanding...
Quoted 3 lines
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Ok none at all if you don't have a freezer.
Ben.
Quoted 6 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
That task is implicitely frozen... but the kernel doesn't know it and thus the freezer timeouts or fails or deadlocks or whatever.
The freezer could be made to ignore tasks that are sleeping in the kernel assuming that if they go out of it, they'll ultimately reach do_signal and freeze, but that means they can potentially still issues IOs which is what the freezer tries to avoid ...
Or the kernel could start tracking dependencies, but then, good luck implementing that crap.
At the end of the day, I stand my ground, the freezer cannot be made reliable without massive infrastructure changes or giving up on very useful features such as fuse among others. Besides, it only partially "hides" the problem of requests going to drivers, thus it's a bad solutions.
We would be much better off spending time fixing the drivers to properly block requests after suspended, and that also gives for free the ability to do dynamic runtime suspend on them.
And for "trivial" drivers where we don't care, using late_suspend to power the chip off later when IRQs are off is an easy enough way to solve it with very little code (though won't help with dynamic PM but that's not necessarily an issue). No need for a freezer either way.
Ben.
Hi.
Quoted 11 lines · On Friday 06 July 2007 08:46:54 Benjamin Herrenschmidt wrote:
Quoted 4 lines · Pavel Machek
...but the moment you start blocking tasks that done driver request, you _do_ have mini-freezer of your own, with pretty much the same problems.
No, not at all the same problems. Those tasks will block, but that will be harmless because we won't have some "freezer" things waiting for all tasks to reach a "stable" point (calling
try_to_freeze()). We just let them block wherever we want, as long as it doesn't prevent a -driver- from suspending, which should be allright, we have no problem.
Will you be able to guarantee that every place where a task can/will block will be harmless place? If so, how will you guarantee that? How will you debug issues where a task occasionally doesn't block in the right place, particularly instances where it is some less than obvious interaction with other tasks?
This is the whole point to having the freezer. It makes things more predictable and testable. It shows us, clearly, when process X is the one that is causing problems.
Quoted 4 lines
Quoted 2 lines
In another message I shown that removing freezer will not help with FUSE in general case.
I disagree.
Why?
Quoted 24 lines
Quoted 3 lines
It probably does not help with firmware, too; as soon as udev attempts to do something with your wireless card, it is blocked, and if the wireless card needs the firmware from udev, you are deadlocked.
Firmware load has been a problem since day 1, I've talked about it multiple times, it's broken with or without the freezer, and so far, the reaction of pretty much everybody has been to dig their head deeper in the mud and ignore the problem.
There are other issues (again, with or without freezer) that should be dealt with. For example, drivers that haven't yet got their
suspend()callback or already have got theirresume()may rely on services of the kernel that are still blocked, that's where things may go hairy.request_firmware()withinresume()is a typical example of that.There are a few things we should do in that area. For example, once we start to call driver suspend's, we should probably set a system wide flag that will do things such as:
- block usermode helpers (either make
call_usermodehelperreturn
something like-EBUSYor have it queue up the calls and issue them later when thing are resuming, we need to look closely at what semantic we want here).
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)
Quoted 7 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Userspace device drivers too?
Regards,
Nigel
Hi.
Quoted 11 lines · On Friday 06 July 2007 08:46:54 Benjamin Herrenschmidt wrote:
Quoted 4 lines · Pavel Machek
...but the moment you start blocking tasks that done driver request, you _do_ have mini-freezer of your own, with pretty much the same problems.
No, not at all the same problems. Those tasks will block, but that will be harmless because we won't have some "freezer" things waiting for all tasks to reach a "stable" point (calling
try_to_freeze()). We just let them block wherever we want, as long as it doesn't prevent a -driver- from suspending, which should be allright, we have no problem.
Will you be able to guarantee that every place where a task can/will block will be harmless place? If so, how will you guarantee that? How will you debug issues where a task occasionally doesn't block in the right place, particularly instances where it is some less than obvious interaction with other tasks?
This is the whole point to having the freezer. It makes things more predictable and testable. It shows us, clearly, when process X is the one that is causing problems.
Quoted 4 lines
Quoted 2 lines
In another message I shown that removing freezer will not help with FUSE in general case.
I disagree.
Why?
Quoted 24 lines
Quoted 3 lines
It probably does not help with firmware, too; as soon as udev attempts to do something with your wireless card, it is blocked, and if the wireless card needs the firmware from udev, you are deadlocked.
Firmware load has been a problem since day 1, I've talked about it multiple times, it's broken with or without the freezer, and so far, the reaction of pretty much everybody has been to dig their head deeper in the mud and ignore the problem.
There are other issues (again, with or without freezer) that should be dealt with. For example, drivers that haven't yet got their
suspend()callback or already have got theirresume()may rely on services of the kernel that are still blocked, that's where things may go hairy.request_firmware()withinresume()is a typical example of that.There are a few things we should do in that area. For example, once we start to call driver suspend's, we should probably set a system wide flag that will do things such as:
- block usermode helpers (either make
call_usermodehelperreturn
something like-EBUSYor have it queue up the calls and issue them later when thing are resuming, we need to look closely at what semantic we want here).
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)
Quoted 7 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Userspace device drivers too?
Regards,
Nigel
Quoted 6 lines
Will you be able to guarantee that every place where a task can/will block will be harmless place? If so, how will you guarantee that? How will you debug issues where a task occasionally doesn't block in the right place, particularly instances where it is some less than obvious interaction with other tasks?
Which places aren't harmless if you don't have a freezer ?
Quoted 3 lines
This is the whole point to having the freezer. It makes things more predictable and testable. It shows us, clearly, when process X is the one that is causing problems.
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Quoted 7 lines
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)
NOIO should be enough I think but ATOMIC would do).
That's one of the reason why I used to have the pre-suspend and post-resume hooks in my original powermac implementation, for those few drivers complicated enough to require some pre-allocations.
Quoted 4 lines
Quoted 4 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...
Note that the above firmware problem could be dealt with also with the pre-suspend/post-resume. Allowing to pre-request firmware etc... and keep it around until after resume, because we know we will need it. Gives a chance to drivers to perform things while the system is still live, filesystems still working, etc... (big memory allocations for example).
Quoted 5 lines
Quoted 3 lines
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Userspace device drivers too?
Maybe but they are less of an issue, most of the time, they don't do DMA or whatever harmful things. If they are USB drivers, for example, they are an non-issues at that level.
Quoted 6 lines
Will you be able to guarantee that every place where a task can/will block will be harmless place? If so, how will you guarantee that? How will you debug issues where a task occasionally doesn't block in the right place, particularly instances where it is some less than obvious interaction with other tasks?
Which places aren't harmless if you don't have a freezer ?
Quoted 3 lines
This is the whole point to having the freezer. It makes things more predictable and testable. It shows us, clearly, when process X is the one that is causing problems.
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Quoted 7 lines
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)
NOIO should be enough I think but ATOMIC would do).
That's one of the reason why I used to have the pre-suspend and post-resume hooks in my original powermac implementation, for those few drivers complicated enough to require some pre-allocations.
Quoted 4 lines
Quoted 4 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...
Note that the above firmware problem could be dealt with also with the pre-suspend/post-resume. Allowing to pre-request firmware etc... and keep it around until after resume, because we know we will need it. Gives a chance to drivers to perform things while the system is still live, filesystems still working, etc... (big memory allocations for example).
Quoted 5 lines
Quoted 3 lines
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Userspace device drivers too?
Maybe but they are less of an issue, most of the time, they don't do DMA or whatever harmful things. If they are USB drivers, for example, they are an non-issues at that level.
Hi.
Quoted 8 lines · On Friday 06 July 2007 09:20:43 Benjamin Herrenschmidt wrote:
Quoted 6 lines
Will you be able to guarantee that every place where a task can/will block will be harmless place? If so, how will you guarantee that? How will you debug issues where a task occasionally doesn't block in the right place, particularly instances where it is some less than obvious interaction with other tasks?
Which places aren't harmless if you don't have a freezer ?
If I knew that, I wouldn't be asking the question.
Quoted 6 lines
Quoted 3 lines
This is the whole point to having the freezer. It makes things more predictable and testable. It shows us, clearly, when process X is the one that is causing problems.
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
Quoted 30 lines
Quoted 7 lines
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)NOIO should be enough I think but ATOMIC would do).
That's one of the reason why I used to have the pre-suspend and post-resume hooks in my original powermac implementation, for those few drivers complicated enough to require some pre-allocations.
Quoted 4 lines
Quoted 4 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...Note that the above firmware problem could be dealt with also with the pre-suspend/post-resume. Allowing to pre-request firmware etc... and keep it around until after resume, because we know we will need it. Gives a chance to drivers to perform things while the system is still live, filesystems still working, etc... (big memory allocations for example).
Quoted 4 lines
Quoted 3 lines
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Quoted 5 lines
Quoted 1 line
Userspace device drivers too?
Maybe but they are less of an issue, most of the time, they don't do DMA or whatever harmful things. If they are USB drivers, for example, they are an non-issues at that level.
(Leaving the rest of the message intact so we don't have to fragment the discussion into a million subthreads).
Regards,
Nigel
Hi.
Quoted 8 lines · On Friday 06 July 2007 09:20:43 Benjamin Herrenschmidt wrote:
Quoted 6 lines
Will you be able to guarantee that every place where a task can/will block will be harmless place? If so, how will you guarantee that? How will you debug issues where a task occasionally doesn't block in the right place, particularly instances where it is some less than obvious interaction with other tasks?
Which places aren't harmless if you don't have a freezer ?
If I knew that, I wouldn't be asking the question.
Quoted 6 lines
Quoted 3 lines
This is the whole point to having the freezer. It makes things more predictable and testable. It shows us, clearly, when process X is the one that is causing problems.
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
Quoted 30 lines
Quoted 7 lines
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)NOIO should be enough I think but ATOMIC would do).
That's one of the reason why I used to have the pre-suspend and post-resume hooks in my original powermac implementation, for those few drivers complicated enough to require some pre-allocations.
Quoted 4 lines
Quoted 4 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...Note that the above firmware problem could be dealt with also with the pre-suspend/post-resume. Allowing to pre-request firmware etc... and keep it around until after resume, because we know we will need it. Gives a chance to drivers to perform things while the system is still live, filesystems still working, etc... (big memory allocations for example).
Quoted 4 lines
Quoted 3 lines
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Quoted 5 lines
Quoted 1 line
Userspace device drivers too?
Maybe but they are less of an issue, most of the time, they don't do DMA or whatever harmful things. If they are USB drivers, for example, they are an non-issues at that level.
(Leaving the rest of the message intact so we don't have to fragment the discussion into a million subthreads).
Regards,
Nigel
Quoted 4 lines · Nigel Cunningham
Quoted 1 line · On Friday 06 July 2007 09:20:43 Benjamin Herrenschmidt wrote:
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D. When your hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE: Suspend-to-RAM), the list of things to do is short and simple:
1) Stop DMA and put most hardware into low-power states (stops all interrupt sources) 2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep 3) Put the interrupt-controllers into low-power state 4) Go to sleep
Quoted 1 line
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev)
{
set_no_bind_flag(dev);
for (dev->subdevices)
suspend_device(dev);
set_no_io_flag(dev);
wait_for_in_progress_dma(dev);
turn_off_interrupts(dev);
go_to_low_power_state(dev);
}After you've set the "no_bind" flag, you won't get any *new* subdevices trying to bind, therefore it's safe to iterate over the list of present sub-devices and suspend them. Once those are suspended and in low-power states you can set a "no_io" flag to prevent the driver from submitting more IO. At that point you can lazily wait for existing DMA/IO/interrupts to finish on the device, since *NOBODY* will be submitting them anymore, and we certainly aren't probing for new devices. Then you can just turn off the power to the device. When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in schedule() and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Resuming is basically running the whole process in reverse. Runtime-suspend is achieved by not setting the 'no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.
Cheers,
Kyle Moffett
Quoted 4 lines · Nigel Cunningham
Quoted 1 line · On Friday 06 July 2007 09:20:43 Benjamin Herrenschmidt wrote:
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D. When your hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE: Suspend-to-RAM), the list of things to do is short and simple:
1) Stop DMA and put most hardware into low-power states (stops all interrupt sources) 2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep 3) Put the interrupt-controllers into low-power state 4) Go to sleep
Quoted 1 line
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev)
{
set_no_bind_flag(dev);
for (dev->subdevices)
suspend_device(dev);
set_no_io_flag(dev);
wait_for_in_progress_dma(dev);
turn_off_interrupts(dev);
go_to_low_power_state(dev);
}After you've set the "no_bind" flag, you won't get any *new* subdevices trying to bind, therefore it's safe to iterate over the list of present sub-devices and suspend them. Once those are suspended and in low-power states you can set a "no_io" flag to prevent the driver from submitting more IO. At that point you can lazily wait for existing DMA/IO/interrupts to finish on the device, since *NOBODY* will be submitting them anymore, and we certainly aren't probing for new devices. Then you can just turn off the power to the device. When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in schedule() and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Resuming is basically running the whole process in reverse. Runtime-suspend is achieved by not setting the 'no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.
Cheers,
Kyle Moffett
Hi.
Quoted 10 lines · On Friday 06 July 2007 11:19:32 Kyle Moffett wrote:
Quoted 8 lines · Nigel Cunningham
Quoted 2 lines · On Friday 06 July 2007 09:20:43 Benjamin Herrenschmidt wrote:
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
Quoted 5 lines
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D. When your hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE:
Suspend-to-RAM), the list of things to do is short and simple:
We agreed a while back that you don't need the freezer for suspend to ram. As far as I was aware, we went off-topic, so the topic is out of date.
Quoted 28 lines
1) Stop DMA and put most hardware into low-power states (stops all interrupt sources)
2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep
3) Put the interrupt-controllers into low-power state
4) Go to sleepQuoted 3 lines
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev){ set_no_bind_flag(dev); for (dev->subdevices) suspend_device(dev); set_no_io_flag(dev); wait_for_in_progress_dma(dev); turn_off_interrupts(dev); go_to_low_power_state(dev); }
Quoted 12 lines
After you've set the "
no_bind" flag, you won't get any *new* subdevices trying to bind, therefore it's safe to iterate over the list of present sub-devices and suspend them. Once those are suspended and in low-power states you can set a "no_io" flag to prevent the driver from submitting more IO. At that point you can lazily wait for existing DMA/IO/interrupts to finish on the device, since *NOBODY* will be submitting them anymore, and we certainly aren't probing for new devices. Then you can just turn off the power to the device. When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
For suspending, yes. For hibernating, that's not enough, because other processes can still be happily allocating and freeing memory, and will only get stopped when they try to do i/o or such like. If you're trying to make hibernation reliable, you need to be able to reliably check whether you're going to have enough storage for the image you're preparing, and enough memory for the atomic copy and so on. That's why the freezer is needed for hibernation. If you don't have it, any hibernation implementation you make is going to be only as reliable as the extent to which the system is otherwise idle.
Quoted 11 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Quoted 4 lines
Resuming is basically running the whole process in reverse. Runtime- suspend is achieved by not setting the '
no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.
Fully agree when it comes to suspend to ram. There, this process should work, so far as I can see. But as I said, we went - to one degree or another - off topic, and did discuss hibernation too.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Hi.
Quoted 10 lines · On Friday 06 July 2007 11:19:32 Kyle Moffett wrote:
Quoted 8 lines · Nigel Cunningham
Quoted 2 lines · On Friday 06 July 2007 09:20:43 Benjamin Herrenschmidt wrote:
No, the freezer creates all those places what are harmful for a task to block because they will break the freezer :-)
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
Quoted 5 lines
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D. When your hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE:
Suspend-to-RAM), the list of things to do is short and simple:
We agreed a while back that you don't need the freezer for suspend to ram. As far as I was aware, we went off-topic, so the topic is out of date.
Quoted 28 lines
1) Stop DMA and put most hardware into low-power states (stops all interrupt sources)
2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep
3) Put the interrupt-controllers into low-power state
4) Go to sleepQuoted 3 lines
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev){ set_no_bind_flag(dev); for (dev->subdevices) suspend_device(dev); set_no_io_flag(dev); wait_for_in_progress_dma(dev); turn_off_interrupts(dev); go_to_low_power_state(dev); }
Quoted 12 lines
After you've set the "
no_bind" flag, you won't get any *new* subdevices trying to bind, therefore it's safe to iterate over the list of present sub-devices and suspend them. Once those are suspended and in low-power states you can set a "no_io" flag to prevent the driver from submitting more IO. At that point you can lazily wait for existing DMA/IO/interrupts to finish on the device, since *NOBODY* will be submitting them anymore, and we certainly aren't probing for new devices. Then you can just turn off the power to the device. When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
For suspending, yes. For hibernating, that's not enough, because other processes can still be happily allocating and freeing memory, and will only get stopped when they try to do i/o or such like. If you're trying to make hibernation reliable, you need to be able to reliably check whether you're going to have enough storage for the image you're preparing, and enough memory for the atomic copy and so on. That's why the freezer is needed for hibernation. If you don't have it, any hibernation implementation you make is going to be only as reliable as the extent to which the system is otherwise idle.
Quoted 11 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Quoted 4 lines
Resuming is basically running the whole process in reverse. Runtime- suspend is achieved by not setting the '
no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.
Fully agree when it comes to suspend to ram. There, this process should work, so far as I can see. But as I said, we went - to one degree or another - off topic, and did discuss hibernation too.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Quoted 9 lines · Nigel Cunningham
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
I was mostly talking about STR... Regarding STD, we have a different problem and we all know it. The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot.
That is, some kind of proper snapshotting facility, as linus was describing some time ago.
Ben.
Quoted 47 lines
Quoted 30 lines
Quoted 7 lines
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)NOIO should be enough I think but ATOMIC would do).
That's one of the reason why I used to have the pre-suspend and post-resume hooks in my original powermac implementation, for those few drivers complicated enough to require some pre-allocations.
Quoted 4 lines
Quoted 4 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...Note that the above firmware problem could be dealt with also with the pre-suspend/post-resume. Allowing to pre-request firmware etc... and keep it around until after resume, because we know we will need it. Gives a chance to drivers to perform things while the system is still live, filesystems still working, etc... (big memory allocations for example).
Quoted 4 lines
Quoted 3 lines
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Quoted 5 lines
Quoted 1 line
Userspace device drivers too?
Maybe but they are less of an issue, most of the time, they don't do DMA or whatever harmful things. If they are USB drivers, for example, they are an non-issues at that level.
(Leaving the rest of the message intact so we don't have to fragment the discussion into a million subthreads).
Regards,
Nigel
Invalid signature
Quoted 9 lines · Nigel Cunningham
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
I was mostly talking about STR... Regarding STD, we have a different problem and we all know it. The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot.
That is, some kind of proper snapshotting facility, as linus was describing some time ago.
Ben.
Quoted 47 lines
Quoted 30 lines
Quoted 7 lines
Quoted 5 lines
- Silently add
GFP_NOIOto all allocations, to avoid having things
blocking inkmalloc()with a mutex held that will deadlock withsuspend()in a driver for example. Or set some way to have all GFP waiters wakeup and fail rather than wait for IOs. It's hard/bizarre but necessary, again, with or without a freezer.
GFP_ATOMIC? (In driver suspend, they shouldn't be sleeping either, right?)NOIO should be enough I think but ATOMIC would do).
That's one of the reason why I used to have the pre-suspend and post-resume hooks in my original powermac implementation, for those few drivers complicated enough to require some pre-allocations.
Quoted 4 lines
Quoted 4 lines
- Deal with the firmware problem. The best way is probably to have an
asyncrequest_firmwareinterface(). Another thing is, drivers may want to cache their firmware in main memory, that sort of thing...Note that the above firmware problem could be dealt with also with the pre-suspend/post-resume. Allowing to pre-request firmware etc... and keep it around until after resume, because we know we will need it. Gives a chance to drivers to perform things while the system is still live, filesystems still working, etc... (big memory allocations for example).
Quoted 4 lines
Quoted 3 lines
And that's just a small list off the top of my mind, of known problems that will cause deadlocks or misbehaviours today, with or without the freezer, and that need to be addressed.
Quoted 5 lines
Quoted 1 line
Userspace device drivers too?
Maybe but they are less of an issue, most of the time, they don't do DMA or whatever harmful things. If they are USB drivers, for example, they are an non-issues at that level.
(Leaving the rest of the message intact so we don't have to fragment the discussion into a million subthreads).
Regards,
Nigel
Invalid signature
Benjamin Herrenschmidt <[email protected]> writes:
[snip]
Quoted 5 lines
At the end of the day, I stand my ground, the freezer cannot be made reliable without massive infrastructure changes or giving up on very useful features such as fuse among others. Besides, it only partially "hides" the problem of requests going to drivers, thus it's a bad solutions.
I agree that the freezer absolutely should not be used for suspend to ram ("suspend"), since it is unnecessary with properly written drivers, which are important to have anyway. It seems that it is indeed the consensus that it will be phased out sooner or later.
It does seem that the current device suspend interface does not tell the drivers enough, since as discussed, they need to know whether to merely block if they receive a request while suspended (as should be done while initiating a suspend to ram), or if they should wake up the device (as should be done if a suspend to ram is not in progress). Clearly these two cases need to be addressed by every driver supporting suspend/resume (but possibly indirectly if the subsystem handles it for them).
The current hibernate approach used by all of the existing implementations for Linux seems to depend fundamentally on the freezer, though, in order to actually save the system state. Thus, it will still be necessary to fix all of the issues with the freezer, or adopt an alternate hibernate approach (which is unlikely). Unfortunately, even leaving kernel threads and certain drivers running after the snapshot is taken means that the saved image isn't completely correct, and the freezer cannot help with these issues.
[snip]
Signature · 1 line
Jeremy Maitin-Shepard
Quoted 6 lines
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
Well, waiting for pending DMA and making sure to not trigger more activity is what driver suspend() is supposed to do. With the ability for simple drivers that can cope with it to just basically use a late_suspend(), called after IRQs are off, that basically does what you
describe: wait for pending HW tasks to complete (polling) and turn the damn thing off.
Note that the later is really a shortcut for somewhat dump and directly accessible devices (PCI comes to mind). Things like USB has to use the "normal" mechanism of blocking IOs etc... at suspend(), at least, USB devices have to since the USB HC will not issue any new URBs. (And will return them with a nice error code which is a perfect way to deal with it in driver, been there, it works fine, once we fixed the races in the USB host code itself, which I think we pretty much did by now).
Quoted 10 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
What you propose is basically a slightly over-simplistic version of what I think (and Paulus think) should be done. We do need to do it via driver callbacks down the tree since only drivers can know how to deal with their DMA etc... and ordering need to be respected, but that's basically it.
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
Ben.
Benjamin Herrenschmidt <[email protected]> writes:
[snip]
Quoted 5 lines
At the end of the day, I stand my ground, the freezer cannot be made reliable without massive infrastructure changes or giving up on very useful features such as fuse among others. Besides, it only partially "hides" the problem of requests going to drivers, thus it's a bad solutions.
I agree that the freezer absolutely should not be used for suspend to ram ("suspend"), since it is unnecessary with properly written drivers, which are important to have anyway. It seems that it is indeed the consensus that it will be phased out sooner or later.
It does seem that the current device suspend interface does not tell the drivers enough, since as discussed, they need to know whether to merely block if they receive a request while suspended (as should be done while initiating a suspend to ram), or if they should wake up the device (as should be done if a suspend to ram is not in progress). Clearly these two cases need to be addressed by every driver supporting suspend/resume (but possibly indirectly if the subsystem handles it for them).
The current hibernate approach used by all of the existing implementations for Linux seems to depend fundamentally on the freezer, though, in order to actually save the system state. Thus, it will still be necessary to fix all of the issues with the freezer, or adopt an alternate hibernate approach (which is unlikely). Unfortunately, even leaving kernel threads and certain drivers running after the snapshot is taken means that the saved image isn't completely correct, and the freezer cannot help with these issues.
[snip]
Signature · 1 line
Jeremy Maitin-Shepard
Quoted 6 lines
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
Well, waiting for pending DMA and making sure to not trigger more activity is what driver suspend() is supposed to do. With the ability for simple drivers that can cope with it to just basically use a late_suspend(), called after IRQs are off, that basically does what you
describe: wait for pending HW tasks to complete (polling) and turn the damn thing off.
Note that the later is really a shortcut for somewhat dump and directly accessible devices (PCI comes to mind). Things like USB has to use the "normal" mechanism of blocking IOs etc... at suspend(), at least, USB devices have to since the USB HC will not issue any new URBs. (And will return them with a nice error code which is a perfect way to deal with it in driver, been there, it works fine, once we fixed the races in the USB host code itself, which I think we pretty much did by now).
Quoted 10 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
What you propose is basically a slightly over-simplistic version of what I think (and Paulus think) should be done. We do need to do it via driver callbacks down the tree since only drivers can know how to deal with their DMA etc... and ordering need to be respected, but that's basically it.
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
Ben.
Hi.
Quoted 3 lines · On Friday 06 July 2007 13:54:15 Benjamin Herrenschmidt wrote:
Quoted 2 lines · Nigel Cunningham
Nice try :) Okay then, you remove the freezer, try hibernating, then get
back
Quoted 5 lines
Quoted 5 lines
to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
As Pavel rightly said, you can get rid of the freezer, but you're only
going
Quoted 11 lines
Quoted 2 lines
to have to implement another one that does the essentially the same thing, even if it is at some other level.
I was mostly talking about STR... Regarding STD, we have a different problem and we all know it. The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot.
That is, some kind of proper snapshotting facility, as linus was describing some time ago.
The kind of thing Linus was talking about would limit you (as swsusp and uswsusp do now) to only half the amount of memory. I suppose you could lzf compress as you did the snapshot. That would generally get you up to 2/3rds, but then again you can't know what compression ratio you'll get until you try, so reliability would suffer or it would take longer because of retrying.
I/O from swsusp and suspend2 use bios directly, so the page cache isn't an issue for them (apart from the fact that Suspend2 saves the page cache separately so it can get a full image). Not sure about uswsusp.
Only having half the amount of memory doesn't sound like a big limitation for modern desktops & laptops, but don't forget that there are embedded guys wanting to hbernate too :)
Regards,
Nigel
Signature · 5 lines
Nigel Cunningham Christian Reformed Church of Cobden 103 Curdie Street, Cobden 3266, Victoria, Australia Ph. +61 3 5595 1185 / +61 417 100 574 Communal Worship: 11 am Sunday.
Hi.
Quoted 3 lines · On Friday 06 July 2007 13:54:15 Benjamin Herrenschmidt wrote:
Quoted 2 lines · Nigel Cunningham
Nice try :) Okay then, you remove the freezer, try hibernating, then get
back
Quoted 5 lines
Quoted 5 lines
to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
As Pavel rightly said, you can get rid of the freezer, but you're only
going
Quoted 11 lines
Quoted 2 lines
to have to implement another one that does the essentially the same thing, even if it is at some other level.
I was mostly talking about STR... Regarding STD, we have a different problem and we all know it. The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot.
That is, some kind of proper snapshotting facility, as linus was describing some time ago.
The kind of thing Linus was talking about would limit you (as swsusp and uswsusp do now) to only half the amount of memory. I suppose you could lzf compress as you did the snapshot. That would generally get you up to 2/3rds, but then again you can't know what compression ratio you'll get until you try, so reliability would suffer or it would take longer because of retrying.
I/O from swsusp and suspend2 use bios directly, so the page cache isn't an issue for them (apart from the fact that Suspend2 saves the page cache separately so it can get a full image). Not sure about uswsusp.
Only having half the amount of memory doesn't sound like a big limitation for modern desktops & laptops, but don't forget that there are embedded guys wanting to hbernate too :)
Regards,
Nigel
Signature · 5 lines
Nigel Cunningham Christian Reformed Church of Cobden 103 Curdie Street, Cobden 3266, Victoria, Australia Ph. +61 3 5595 1185 / +61 417 100 574 Communal Worship: 11 am Sunday.
Quoted 8 lines
I/O from swsusp and suspend2 use bios directly, so the page cache isn't an issue for them (apart from the fact that Suspend2 saves the page cache separately so it can get a full image). Not sure about uswsusp.
Only having half the amount of memory doesn't sound like a big limitation for modern desktops & laptops, but don't forget that there are embedded guys wanting to hbernate too :)
Wait wait wait ... uses the BIOS ? what do you mean ?
I know that for example, things like MacOS X use a separate polled path to the storage driver for suspend (works fine for the built-in IDE, but more complicated in large scale). If you can use BIOS calls to write your suspend image, that is, if you don't need any of the normal block infrastructure, then you don't need a freezer ! not at all !
You just do like STR ... and at the end of the day, once you have stopped all your driver, you shut interrupts off and do the BIOS thing....
I fail to see how processes could dirty pages while/after the BIOS thingy :-)
But then, the problem with that approach is that of course, you need a BIOS capable of doing that (or a special sideband path to the "blessed" block driver that will be used for suspend ... not necessarily a hard thing to do, would be trivial to add support to drivers/ide or libata for that sort of things I suppose).
Ben.
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Friday 06 July 2007 13:54:15 Benjamin Herrenschmidt wrote:
Quoted 3 lines · Nigel Cunningham
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
I was mostly talking about STR... Regarding STD, we have a different problem and we all know it. The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot.
That is, some kind of proper snapshotting facility, as linus was describing some time ago.
The kind of thing Linus was talking about would limit you (as swsusp and uswsusp do now) to only half the amount of memory.
How so? Suppose hibernate is implemented like this:
(1) Userspace program calls sys_freeze_processes()
(a) Pokes all CPUs with IPMIs and tells them to finish the
currently running timeslot then stop
(b) Atomically sends SIGSTOP to all userspace processes in a non-
trappable way, except the calling process and any process which is ptracing it.
(c) Returns to the calling process.
(2) Userspace process sends SIGCONT to only those processes which are necessary for sync and a device-mapper snapshot.
(3) Userspace calls sys_snapshot_kernel(snapshot_overhead_pages)
(a) Kernel starts freeing memory and swapping stuff out to make
room for a copy of *kernel* memory (not pagecache, not process RAM). It does the same for at least snapshot_overhead_pages extra (used by userspace later). It then allocates this memory to keep it from going away. Since most processes are stopped we won't have much else competing with us for the RAM.
(a) Kernel uses the device-mapper up-call-into-filesystem
machinery to get all mounted filesystems synced and ready for a DM snapshot. This may include sending data via the userspace processes resumed in (2). Any deadlocks here are userspace's fault (see (2)). Will need some modification to handle doing multiple blockdevs at a time. Anything using FUSE is basically perma-synced anyways (no dep-handling needed), and anything using loop should already be handled by DM. This includes allocating memory for the basic snapshot datastructures.
(b) At this point all blockdev operations should be halted and
disk caches flushed; that's all we care about.
(c) Go through the device tree and quiesce DMA and shut off
interrupts. Since all the disks are synced this is easy.
(d) Use IPMIs again to get all the CPUs together, which should be
easy as most processes are sleeping in IO or SIGSTOPed, and we're getting no interrupts.
(e) One CPU turns off all interrupts on itself and takes an atomic
snapshot of kernel memory into the previously allocated storage. Once again, does not include pagecache. The kernel also records a list of what pages *are* included in the pagecache. It then marks all userspace pages as copy-on-write.
(f) That CPU finalizes the modified DM snapshot using the
previously-allocated memory.
(g) That CPU frees up the snapshot_overhead_pages memory allocated
during step (a) for userspace to use.
(h) The CPU does the equivalent of a "swapoff -a" without
overwriting any data already on any swap device(s).
(i) The CPU then IPMI-signals the other CPUs to wake them up
(j) The kernel returns a FD-reference to the snapshot and the read-
only halves of the CoW pagecache to the process which called sys_snapshot_kernel().
(4) The userspace process now has a reference to the copy of the kernel pages and the unmodified pagecache pages. Since 99% of the processes aren't running, we aren't going to be having to CoW many of the pagecache pages.
(5) The userspace process uses read() or other syscalls to get data out of the kernel-snapshot FD in small chunks, within its snapshot_overhead_pages limit. It compresses these and writes them out to the snapshot-storage blockdev (must not be mounted during snapshot), or to any network server.
(6) The userspace process syncs the disks and halts the system. Any changed filesystem pages after the pseudo-DM-snapshot should have been stored in semi-volatile storage somewhere and will be discarded on the next reboot.
So basically your hibernate-overhead would consist of:
(1) The pages necessary for the atomic snapshot of kernel memory
and the list of pagecache pages at that time
(2) A little memory necessary for the kernel non-persistent DM
snapshot datastructures.
(3) The snapshot_overhead_pages needed by userspace.
If you're using swap devices then you can save 99% of the state of the running kernel with an initial swapout overhead of virtually nothing beyond the size of the unswappable kernel memory.
Cheers,
Kyle Moffett
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Friday 06 July 2007 13:54:15 Benjamin Herrenschmidt wrote:
Quoted 3 lines · Nigel Cunningham
Nice try :) Okay then, you remove the freezer, try hibernating, then get back to me after you've fixed your filesystem because some process that wasn't frozen started writing things after the atomic copy (making the on disk filesystem inconsistent with the snapshot).
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
I was mostly talking about STR... Regarding STD, we have a different problem and we all know it. The freezer is one somewhat horrible way to get it working for now, I would prefer something more along the way that blocks the page cache from writing out new dirty pages though, except those specifically flagged by the snapshot.
That is, some kind of proper snapshotting facility, as linus was describing some time ago.
The kind of thing Linus was talking about would limit you (as swsusp and uswsusp do now) to only half the amount of memory.
How so? Suppose hibernate is implemented like this:
(1) Userspace program calls sys_freeze_processes()
(a) Pokes all CPUs with IPMIs and tells them to finish the
currently running timeslot then stop
(b) Atomically sends SIGSTOP to all userspace processes in a non-
trappable way, except the calling process and any process which is ptracing it.
(c) Returns to the calling process.
(2) Userspace process sends SIGCONT to only those processes which are necessary for sync and a device-mapper snapshot.
(3) Userspace calls sys_snapshot_kernel(snapshot_overhead_pages)
(a) Kernel starts freeing memory and swapping stuff out to make
room for a copy of *kernel* memory (not pagecache, not process RAM). It does the same for at least snapshot_overhead_pages extra (used by userspace later). It then allocates this memory to keep it from going away. Since most processes are stopped we won't have much else competing with us for the RAM.
(a) Kernel uses the device-mapper up-call-into-filesystem
machinery to get all mounted filesystems synced and ready for a DM snapshot. This may include sending data via the userspace processes resumed in (2). Any deadlocks here are userspace's fault (see (2)). Will need some modification to handle doing multiple blockdevs at a time. Anything using FUSE is basically perma-synced anyways (no dep-handling needed), and anything using loop should already be handled by DM. This includes allocating memory for the basic snapshot datastructures.
(b) At this point all blockdev operations should be halted and
disk caches flushed; that's all we care about.
(c) Go through the device tree and quiesce DMA and shut off
interrupts. Since all the disks are synced this is easy.
(d) Use IPMIs again to get all the CPUs together, which should be
easy as most processes are sleeping in IO or SIGSTOPed, and we're getting no interrupts.
(e) One CPU turns off all interrupts on itself and takes an atomic
snapshot of kernel memory into the previously allocated storage. Once again, does not include pagecache. The kernel also records a list of what pages *are* included in the pagecache. It then marks all userspace pages as copy-on-write.
(f) That CPU finalizes the modified DM snapshot using the
previously-allocated memory.
(g) That CPU frees up the snapshot_overhead_pages memory allocated
during step (a) for userspace to use.
(h) The CPU does the equivalent of a "swapoff -a" without
overwriting any data already on any swap device(s).
(i) The CPU then IPMI-signals the other CPUs to wake them up
(j) The kernel returns a FD-reference to the snapshot and the read-
only halves of the CoW pagecache to the process which called sys_snapshot_kernel().
(4) The userspace process now has a reference to the copy of the kernel pages and the unmodified pagecache pages. Since 99% of the processes aren't running, we aren't going to be having to CoW many of the pagecache pages.
(5) The userspace process uses read() or other syscalls to get data out of the kernel-snapshot FD in small chunks, within its snapshot_overhead_pages limit. It compresses these and writes them out to the snapshot-storage blockdev (must not be mounted during snapshot), or to any network server.
(6) The userspace process syncs the disks and halts the system. Any changed filesystem pages after the pseudo-DM-snapshot should have been stored in semi-volatile storage somewhere and will be discarded on the next reboot.
So basically your hibernate-overhead would consist of:
(1) The pages necessary for the atomic snapshot of kernel memory
and the list of pagecache pages at that time
(2) A little memory necessary for the kernel non-persistent DM
snapshot datastructures.
(3) The snapshot_overhead_pages needed by userspace.
If you're using swap devices then you can save 99% of the state of the running kernel with an initial swapout overhead of virtually nothing beyond the size of the unswappable kernel memory.
Cheers,
Kyle Moffett
Hi.
Quoted 6 lines · On Friday 06 July 2007 14:41:40 Benjamin Herrenschmidt wrote:
Quoted 6 lines
I/O from swsusp and suspend2 use bios directly, so the page cache isn't an issue for them (apart from the fact that Suspend2 saves the page cache separately so it can get a full image). Not sure about uswsusp.
Only having half the amount of memory doesn't sound like a big limitation
for
Quoted 4 lines
Quoted 2 lines
modern desktops & laptops, but don't forget that there are embedded guys wanting to hbernate too :)
Wait wait wait ... uses the BIOS ? what do you mean ?
You misread me, Ben. Sorry for not being clearer. bios as in struct bio.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Hi.
Quoted 6 lines · On Friday 06 July 2007 14:41:40 Benjamin Herrenschmidt wrote:
Quoted 6 lines
I/O from swsusp and suspend2 use bios directly, so the page cache isn't an issue for them (apart from the fact that Suspend2 saves the page cache separately so it can get a full image). Not sure about uswsusp.
Only having half the amount of memory doesn't sound like a big limitation
for
Quoted 4 lines
Quoted 2 lines
modern desktops & laptops, but don't forget that there are embedded guys wanting to hbernate too :)
Wait wait wait ... uses the BIOS ? what do you mean ?
You misread me, Ben. Sorry for not being clearer. bios as in struct bio.
Regards,
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Quoted 12 lines · Matthew Garrett
Quoted 5 lines · Rafael J. Wysocki
Quoted 2 lines · Matthew Garrett
I have a model for STD that avoids the need to freeze the entirity of userspace, but I need to find some more time to flesh it out.
You can just describe it, as far as I'm concerned. :-)
The basic model is that nobody's really described a use-case where we actually care about restoring system state. What people want is to be able to restore application state. So, arguably, what we want isn't to save the entire kernel state and application state in one go because we can reconstruct a huge amount of that afterwards.
[...]
Quoted 4 lines
I've mocked up a basic implementation using cryopid, but it's somewhat limited by the lack of support for sockets. I'd like to move more of the smarts into the kernel (Hurray, checkpointing!) and then see how much hardware support ends up horifically broken.
You might want to look at the checkpoint / migration support in the OpenVZ kernel in relation to this. That does work to dump the state of a running "virtual environment" complete with applications to disk, move it to another running kernel and restore the content.
That might, perhaps, help with the prototype of this?
Regards,
Daniel
Hi Kyle.
Quoted 5 lines · On Friday 06 July 2007 15:01:48 Kyle Moffett wrote:
Quoted 2 lines · Nigel Cunningham
The kind of thing Linus was talking about would limit you (as swsusp and uswsusp do now) to only half the amount of memory.
How so? Suppose hibernate is implemented like this:
You're not talking about the same thing Linus was suggesting. He was just wanting a result = sys_snapshot() sort of call. That would limit us to half the amount of memory.
I've looked over what you've written below and want to consider it in detail. Right now though, I don't have the time. I'll try to get back to you promptly.
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Hi Kyle.
Quoted 5 lines · On Friday 06 July 2007 15:01:48 Kyle Moffett wrote:
Quoted 2 lines · Nigel Cunningham
The kind of thing Linus was talking about would limit you (as swsusp and uswsusp do now) to only half the amount of memory.
How so? Suppose hibernate is implemented like this:
You're not talking about the same thing Linus was suggesting. He was just wanting a result = sys_snapshot() sort of call. That would limit us to half the amount of memory.
I've looked over what you've written below and want to consider it in detail. Right now though, I don't have the time. I'll try to get back to you promptly.
Nigel
Signature · 2 lines
See http://www.tuxonice.net for Howtos, FAQs, mailing lists, wiki and bugzilla info.
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
Quoted 5 lines
Yet another ugly hack to work around the fact that the freezer cannot work reliably ... yuck
Why not spend that energy fixing drivers to properly block requests instead ?
Because it's more difficult? :-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 6 lines
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
Quoted 5 lines
Yet another ugly hack to work around the fact that the freezer cannot work reliably ... yuck
Why not spend that energy fixing drivers to properly block requests instead ?
Because it's more difficult? :-)
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 16 lines · Oliver Neukum
Am Donnerstag, 5. Juli 2007 schrieb Alan Stern:
Quoted 8 lines · Miklos Szeredi
Quoted 6 lines
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.Quoted 4 lines
I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
OK, some radical ideas.
Quoted 7 lines
In principle we want a deadlock here. Tasks that are frozen due to fuse are as good as frozen, there's no need to formally freeze them. The bad uninterruptible tasks are those waiting for hardware.
Can we detect the difference? Perhaps we can label those crucial locks and when only tasks in the refrigerator and tasks waiting on these locks are left we are content and go on to suspending the device tree.
Well, I think we can just make the freezer handle uninterruptible tasks.
If an uninterruptible task is stuck holding a lock that's needed for suspend, the freezerless suspend will deadlock anyway. :-)
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
Also, the powermac suspend will deadlock in such cases, so the fact that it doesn't deadlock means that they don't occur very often (if at all).
I have a patch for that, will post it in a separate thread in a while.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 5 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Okay, and you should handle refrigerator in the same paths where you handle SIGKILL. Just add
try_to_freeze()there...
It's the fourth time I'm repeating this in this thread:
Yes adding try_to_freeze() there would partially solve the probelem.
But another task can be sleeping on a mutex held by the task waiting for the reply. And the freezer won't be able to handle that one.
Generally, calling try_to_freeze() with mutexes held is not a good idea.
Miklos
Quoted 24 lines · Pavel Machek
Hi!
Quoted 22 lines
Quoted 22 lines
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 3 lines
I have discussed the benefits elsewhere. As for the deadlocks -- do you still observe them if you use the version of the freezer which doesn't freeze kernel threads?
In general the only way to guarantee there are no deadlocks is to construct the graph of dependencies between tasks. Those dependencies are not in practice observable from outside the tasks, so it is virtually impossible to construct the graph.
In which way can user space tasks depend on each other in a way that allows a them members of that cycle to be in uninterruptible sleep?
Quoted 6 lines
- process A calls
rename()on a fuse fs
- process B, the fuse server, starts to process the rename request
- process B is frozen before it can replyNow process A is unfreezable. We cannot make
rename()restartable, hence it cannot be interruptible.Yes, we are claiming fuse is very special in this regard, and perhaps even broken.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Let's see. If I SIGSTOP the fuse server, I can get unrelated tasks unkillable (even for SIGKILL!) forever.
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Okay, and you should handle refrigerator in the same paths where you handle SIGKILL. Just add
try_to_freeze()there...
In fact the problem is more complicated than that, because some tasks may be waiting on VFS locks related to FUSE.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines · Alan Stern
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Because nobody is waiting on that kernel thread anyway without a freezer so there is no deadlock anymore.
I'm not sure what you mean. The freezer doesn't wait for threads that are already frozen ...
Quoted 17 lines
Quoted 10 lines
I disagree with your analysis -- not that it's completely wrong, but it points out an existing basic problem in the kernel. The kernel should never depend on userspace! More correctly, a task executing in the kernel should never block with any sort of mutex or other lock held (in a way that would preclude it from being frozen, let's say) while waiting for a response from userspace.
Then the dependency graph would be easy to construct: User tasks can depend on whatever they want, and kernel threads never depend on a user task.
In an idea world, there would be no hunger...
Quoted 3 lines
If this contradicts the existing implementations and APIs for userspace filesystems, then so be it. My conclusion would be that the implementations and APIs should be changed.
Quoted 8 lines
Why are you guys working so hard and spending so much energy to try to avoid doing the right thing is beyond my understanding...
Quoted 3 lines
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Ok none at all if you don't have a freezer.
Provided that drivers can handle that.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 16 lines · Oliver Neukum
Am Donnerstag, 5. Juli 2007 schrieb Alan Stern:
Quoted 8 lines · Miklos Szeredi
Quoted 6 lines
I fear, that your efforts to "save" the freezer are in vain. It is already moderately hackish with that
PF_FREEZER_SKIPand the kernel dotted randomly withtry_to_freeze()calls, but adding bandaids to try to order freezing userspace processes in the right order would just make it a horrible mess.Quoted 4 lines
I agree that bandaids won't work. What's needed is something more radical. Things like FUSE must be written so that the kernel parts _can_ freeze even while they are waiting for a response from a user thread.
OK, some radical ideas.
Quoted 7 lines
In principle we want a deadlock here. Tasks that are frozen due to fuse are as good as frozen, there's no need to formally freeze them. The bad uninterruptible tasks are those waiting for hardware.
Can we detect the difference? Perhaps we can label those crucial locks and when only tasks in the refrigerator and tasks waiting on these locks are left we are content and go on to suspending the device tree.
Well, I think we can just make the freezer handle uninterruptible tasks.
If an uninterruptible task is stuck holding a lock that's needed for suspend, the freezerless suspend will deadlock anyway. :-)
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
Also, the powermac suspend will deadlock in such cases, so the fact that it doesn't deadlock means that they don't occur very often (if at all).
I have a patch for that, will post it in a separate thread in a while.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines · Alan Stern
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Because nobody is waiting on that kernel thread anyway without a freezer so there is no deadlock anymore.
I'm not sure what you mean. The freezer doesn't wait for threads that are already frozen ...
Quoted 17 lines
Quoted 10 lines
I disagree with your analysis -- not that it's completely wrong, but it points out an existing basic problem in the kernel. The kernel should never depend on userspace! More correctly, a task executing in the kernel should never block with any sort of mutex or other lock held (in a way that would preclude it from being frozen, let's say) while waiting for a response from userspace.
Then the dependency graph would be easy to construct: User tasks can depend on whatever they want, and kernel threads never depend on a user task.
In an idea world, there would be no hunger...
Quoted 3 lines
If this contradicts the existing implementations and APIs for userspace filesystems, then so be it. My conclusion would be that the implementations and APIs should be changed.
Quoted 8 lines
Why are you guys working so hard and spending so much energy to try to avoid doing the right thing is beyond my understanding...
Quoted 3 lines
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Ok none at all if you don't have a freezer.
Provided that drivers can handle that.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 33 lines · Benjamin Herrenschmidt
Quoted 6 lines
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
Well, waiting for pending DMA and making sure to not trigger more activity is what driver
suspend()is supposed to do. With the ability for simple drivers that can cope with it to just basically use alate_suspend(), called after IRQs are off, that basically does what you
describe: wait for pending HW tasks to complete (polling) and turn the damn thing off.Note that the later is really a shortcut for somewhat dump and directly accessible devices (PCI comes to mind). Things like USB has to use the "normal" mechanism of blocking IOs etc... at
suspend(), at least, USB devices have to since the USB HC will not issue any new URBs. (And will return them with a nice error code which is a perfect way to deal with it in driver, been there, it works fine, once we fixed the races in the USB host code itself, which I think we pretty much did by now).Quoted 10 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Quoted 8 lines
What you propose is basically a slightly over-simplistic version of what I think (and Paulus think) should be done. We do need to do it via driver callbacks down the tree since only drivers can know how to deal with their DMA etc... and ordering need to be respected, but that's basically it.
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
On powerbooks you disable the nonboot CPUs before suspending devices, which simplifies things _a_ _lot_ in comparison with the general case.
If you additionally disable kernel preemption, then you don't need anything like the freezer anyway in that case (except for detecting situations in which the suspend process can deadlock with a task stuck in the D state holding a lock, but that's overkill).
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 7 lines
Quoted 6 lines
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
Quoted 5 lines
Yet another ugly hack to work around the fact that the freezer cannot work reliably ... yuck
Why not spend that energy fixing drivers to properly block requests instead ?
Because we will be unable to escape that job. Let's assume that we remove the freezer from the STR path. The next complaint would be that we cannot do STD with fuse. "Then don't do that" would not be taken kindly as answer.
So we would be under pressure to remove the freezer from STD, too, or find a way to make the freezer work. If we'd have to make the freezer work anyway, we can do it right now.
Regards
Oliver
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 7 lines
Quoted 6 lines
There is that.
OK, bite the bullet. Tasks involved in fuse are special. Give them a flag and teach the freezer to put them on ice only after all other task are frozen. In a way they are kernel, there's no use denying that.
Quoted 5 lines
Yet another ugly hack to work around the fact that the freezer cannot work reliably ... yuck
Why not spend that energy fixing drivers to properly block requests instead ?
Because we will be unable to escape that job. Let's assume that we remove the freezer from the STR path. The next complaint would be that we cannot do STD with fuse. "Then don't do that" would not be taken kindly as answer.
So we would be under pressure to remove the freezer from STD, too, or find a way to make the freezer work. If we'd have to make the freezer work anyway, we can do it right now.
Regards
Oliver
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
That task is implicitely frozen... but the kernel doesn't know it and thus the freezer timeouts or fails or deadlocks or whatever.
Quoted 7 lines
The freezer could be made to ignore tasks that are sleeping in the kernel assuming that if they go out of it, they'll ultimately reach
do_signaland freeze, but that means they can potentially still issues IOs which is what the freezer tries to avoid ...Or the kernel could start tracking dependencies, but then, good luck implementing that crap.
Do we need dependencies? Don't we know that fuse can deadlock only on a limited number of locks in VFS?
Regards
Oliver
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines
Quoted 5 lines
Yes, fuse could handle being frozen there. However that would only solve part of the problem: an operation waiting for a reply could be holding a VFS mutex and some other task may be blocked on that mutex.
How would you solve freezing those tasks?
That task is implicitely frozen... but the kernel doesn't know it and thus the freezer timeouts or fails or deadlocks or whatever.
Quoted 7 lines
The freezer could be made to ignore tasks that are sleeping in the kernel assuming that if they go out of it, they'll ultimately reach
do_signaland freeze, but that means they can potentially still issues IOs which is what the freezer tries to avoid ...Or the kernel could start tracking dependencies, but then, good luck implementing that crap.
Do we need dependencies? Don't we know that fuse can deadlock only on a limited number of locks in VFS?
Regards
Oliver
Hi,
Quoted 95 lines · Nigel Cunningham
Good morning!
Quoted 8 lines · On Thursday 05 July 2007 23:59:57 Rafael J. Wysocki wrote:
Quoted 7 lines · Nigel Cunningham
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do
you
Quoted 2 lines
Quoted 2 lines
do
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse isalready
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
frozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on
the
Quoted 9 lines
Quoted 9 lines
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and
putting
Quoted 7 lines
Quoted 7 lines
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). ItQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
is just user un-friendly.
In fact, I'd like to remove the
sys_sync()from the freezerentirely,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
because
Quoted 3 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()isthat we
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
have a chance to write out everything when applications cannot
produce
Quoted 2 lines
Quoted 2 lines
more
Quoted 1 line
Quoted 1 line
Quoted 1 line
data to write, but there are filesystems which don't do that anyway
(eg.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should
sync
Quoted 4 lines
Quoted 4 lines
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse
processes
Quoted 6 lines
Quoted 6 lines
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 3 lines
Quoted 3 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and
data
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 1 line
Quoted 1 line
sync themselves if they don't already, but that's racy. As it is at
the
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never
a
Quoted 4 lines
Quoted 4 lines
problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll
be
Quoted 5 lines
Quoted 2 lines
more unsynced data when you
sys_synccall finishes). Stopping userspace before syncing removes that race.Yes, that will make the suspend/hibernation less reliable in case the resume fails (some data, written after the sync, may be lost). However, the sync
done
Quoted 1 line
from within the freezer doesn't guarantee that there are no data lost
Quoted 8 lines
anyway,
Quoted 4 lines
so we don't lose much by not doing it.
Now, there's a question how much data may be lost, potentially, if we do the sync before the freezer and I don't think that's a lot.
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss.
Well, it should, but it doesn't ...
Moreover, if FUSE implements syncing, then the sync from within the freezer will almost certainly deadlock.
Quoted 2 lines
As I said about, XFS should be fixed to properly sync its data, and something should be done about fuse filesystems too.
I think that we can't do anything about it, so we should just live with it.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines
Quoted 2 lines
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss.
Well, it should, but it doesn't ...
Moreover, if FUSE implements syncing, then the sync from within the freezer will almost certainly deadlock.
Rafael, think positively: by the time fuse implements sync(), the freezer will be long gone ;)
Miklos
Hi,
Quoted 95 lines · Nigel Cunningham
Good morning!
Quoted 8 lines · On Thursday 05 July 2007 23:59:57 Rafael J. Wysocki wrote:
Quoted 7 lines · Nigel Cunningham
Quoted 6 lines · On Thursday 05 July 2007 23:35:45 Rafael J. Wysocki wrote:
Quoted 5 lines · Nigel Cunningham
Quoted 4 lines · On Thursday 05 July 2007 22:25:06 Rafael J. Wysocki wrote:
Quoted 3 lines · Pavel Machek
Quoted 2 lines · Oliver Neukum
Am Dienstag, 3. Juli 2007 schrieb Miklos Szeredi:
Quoted 1 line
Quoted 1 line
And a further question. The freezer is not atomic. What do
you
Quoted 2 lines
Quoted 2 lines
do
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
if a task not yet frozen calls
sys_sync(), but fuse isalready
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
frozen?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
What do you do if a task not yet frozen writes to a pipe, on
the
Quoted 9 lines
Quoted 9 lines
other
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
end of which is a task already frozen?
There's some difference between uninterruptible and interruptible sleep I'd say.
Quoted 1 line
Quoted 1 line
It doesn't matter. The only thing that should matter during
suspend
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(not hibernate) is saving the state of devices to ram, and
putting
Quoted 7 lines
Quoted 7 lines
the
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
devices to sleep.
Well, but you did remove
sys_sync()from the freezer, which is and must be called in the hibernate path.Not "must". In fact, hibernation should be safe without
sys_sync(). ItQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
is just user un-friendly.
In fact, I'd like to remove the
sys_sync()from the freezerentirely,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
because
Quoted 3 lines
it just doesn't belong in there.
The only advantege of having
sys_sync()infreeze_processes()isthat we
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
have a chance to write out everything when applications cannot
produce
Quoted 2 lines
Quoted 2 lines
more
Quoted 1 line
Quoted 1 line
Quoted 1 line
data to write, but there are filesystems which don't do that anyway
(eg.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
XFS),
Quoted 1 line
so generally there's no reason to bother.
Shouldn't XFS - and fuse - be considered to be broken? Sync should
sync
Quoted 4 lines
Quoted 4 lines
data
Quoted 3 lines
Quoted 3 lines
and if XFS isn't doing that, it's wrong.
In the case of fuse, we should have a mechanism by which fuse
processes
Quoted 6 lines
Quoted 6 lines
can be
Quoted 1 line
Quoted 1 line
made to sync if they do have any pending I/O, and by which they can be
frozen
Quoted 3 lines
Quoted 3 lines
later than other userspace processes.
I'd like to see the sync stay, because it improves reliability and
data
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
integrity in the fail-to-resume case. Calling scripts would probably
invoke
Quoted 1 line
Quoted 1 line
sync themselves if they don't already, but that's racy. As it is at
the
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
moment, we know userspace is stopped, so syncing isn't racy.
I'd like to move the sync out of the freezer, but to call it from the suspend/hibernation code, so that we do
sys_sync();
error =freeze_processes();Yeah, I understand that. The problem then is that you're racing against userspace. That's not usually a problem, but that doesn't mean it's never
a
Quoted 4 lines
Quoted 4 lines
problem. Try running the stress suite while testing hibernating and you'll see what I mean. If something is submitting lots of I/O when you try to suspend, your sync call will race against that process if it's not yet frozen, and its continued activity will make your sync pointless (there'll
be
Quoted 5 lines
Quoted 2 lines
more unsynced data when you
sys_synccall finishes). Stopping userspace before syncing removes that race.Yes, that will make the suspend/hibernation less reliable in case the resume fails (some data, written after the sync, may be lost). However, the sync
done
Quoted 1 line
from within the freezer doesn't guarantee that there are no data lost
Quoted 8 lines
anyway,
Quoted 4 lines
so we don't lose much by not doing it.
Now, there's a question how much data may be lost, potentially, if we do the sync before the freezer and I don't think that's a lot.
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss.
Well, it should, but it doesn't ...
Moreover, if FUSE implements syncing, then the sync from within the freezer will almost certainly deadlock.
Quoted 2 lines
As I said about, XFS should be fixed to properly sync its data, and something should be done about fuse filesystems too.
I think that we can't do anything about it, so we should just live with it.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 7 lines
Quoted 2 lines
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss.
Well, it should, but it doesn't ...
Moreover, if FUSE implements syncing, then the sync from within the freezer will almost certainly deadlock.
Rafael, think positively: by the time fuse implements sync(), the freezer will be long gone ;)
Miklos
Am Freitag, 6. Juli 2007 schrieb Miklos Szeredi:
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
You're missing the point. I'm arguing that a sync from within the freezer should guarantee that there is no data loss.
Well, it should, but it doesn't ...
Moreover, if FUSE implements syncing, then the sync from within the freezer will almost certainly deadlock.
Rafael, think positively: by the time fuse implements
sync(), the freezer will be long gone ;)
Now you are entering really dangerous territory.
If you can implement a meaningfull sync method, you must have dirty pages in the page cache. That means you are in the page freeing path of the vm. Then we are in real trouble. Don't even think about it.
As far as suspend/hibernate is concerned, get yourself on the new notifying chain and revert to synchronous operations when notified.
Regards
Oliver
Quoted 5 lines · Rafael J. Wysocki
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Quoted 2 lines
Also, the powermac suspend will deadlock in such cases, so the fact that it doesn't deadlock means that they don't occur very often (if at all).
Ben.
Quoted 3 lines
On powerbooks you disable the nonboot CPUs before suspending devices, which simplifies things _a_ _lot_ in comparison with the general case.
Not that much actually. It avoids having to gather them all in the last stage at the low level but that isn't really related to what we are talking about right now.
Quoted 4 lines
If you additionally disable kernel preemption, then you don't need anything like the freezer anyway in that case (except for detecting situations in which the suspend process can deadlock with a task stuck in the D state holding a lock, but that's overkill).
kernel preemption and SMP have nothing to do with it. You can still schedule because one of the driver suspend() callback is schedul'ing, maybe waiting for some requests to complete, etc... Happens typically with the disk suspend callbacks.
I agree that it does lower the likelyness of having a userspace process pound on the wrong driver at the wrong time though.
Ben.
Quoted 3 lines
On powerbooks you disable the nonboot CPUs before suspending devices, which simplifies things _a_ _lot_ in comparison with the general case.
Not that much actually. It avoids having to gather them all in the last stage at the low level but that isn't really related to what we are talking about right now.
Quoted 4 lines
If you additionally disable kernel preemption, then you don't need anything like the freezer anyway in that case (except for detecting situations in which the suspend process can deadlock with a task stuck in the D state holding a lock, but that's overkill).
kernel preemption and SMP have nothing to do with it. You can still schedule because one of the driver suspend() callback is schedul'ing, maybe waiting for some requests to complete, etc... Happens typically with the disk suspend callbacks.
I agree that it does lower the likelyness of having a userspace process pound on the wrong driver at the wrong time though.
Ben.
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
Moreover, if FUSE implements syncing, then the sync from within the freezer will almost certainly deadlock.
Rafael, think positively: by the time fuse implements
sync(), the freezer will be long gone ;)Now you are entering really dangerous territory.
If you can implement a meaningfull sync method, you must have dirty pages in the page cache. That means you are in the page freeing path of the vm. Then we are in real trouble. Don't even think about it.
VM induced deadlocks are real nasty. I have thought about them a lot already. Suspend shouldn't introduce any big surprises.
Miklos
Hi.
Quoted 1 line · On Friday 06 July 2007 19:09:43 Miklos Szeredi wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Moreover, if FUSE implements syncing, then the sync from within the
freezer
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
will almost certainly deadlock.
Rafael, think positively: by the time fuse implements
sync(), the freezer will be long gone ;)
Quoted 7 lines
Quoted 4 lines
Now you are entering really dangerous territory.
If you can implement a meaningfull sync method, you must have dirty pages in the page cache. That means you are in the page freeing path of the vm. Then we are in real trouble. Don't even think about it.VM induced deadlocks are real nasty. I have thought about them a lot already. Suspend shouldn't introduce any big surprises.
Suspend isn't introducing the surprises. Fuse is. It creates the potential deadlocks simply by existing (this isn't suspend or hibernate specific).
Nigel
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res = evaluate_result();mutex_unlock();
return res;
If you put a task into the refrigerator at wait_event_interruptible() you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
Regards
Oliver
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res = evaluate_result();mutex_unlock();
return res;
If you put a task into the refrigerator at wait_event_interruptible() you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
Regards
Oliver
Quoted 5 lines
Quoted 2 lines
VM induced deadlocks are real nasty. I have thought about them a lot already. Suspend shouldn't introduce any big surprises.
Suspend isn't introducing the surprises. Fuse is. It creates the potential deadlocks simply by existing (this isn't suspend or hibernate specific).
Yes. And fuse is not going away any time soon. Get over it ;)
Miklos
Quoted 20 lines · Oliver Neukum
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res =evaluate_result();mutex_unlock();
return res;
Quoted 4 lines
If you put a task into the refrigerator at
wait_event_interruptible()you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
s/interruptible/uninterruptible/
Quoted 3 lines
you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
Well, is there any driver in the tree that works like that _and_ has a .suspend() method requiring the same lock?
Besides, I'm not going to put the task into the refrigerator at that point.
Please read http://lkml.org/lkml/2007/7/6/71
Moreover, I claim that, in the context of your example, _if_ the task is stuck at the wait_event_uninterruptible(), _then_ the freezerless suspend will deadlock with the task.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 20 lines · Oliver Neukum
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res =evaluate_result();mutex_unlock();
return res;
Quoted 4 lines
If you put a task into the refrigerator at
wait_event_interruptible()you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
s/interruptible/uninterruptible/
Quoted 3 lines
you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
Well, is there any driver in the tree that works like that _and_ has a .suspend() method requiring the same lock?
Besides, I'm not going to put the task into the refrigerator at that point.
Please read http://lkml.org/lkml/2007/7/6/71
Moreover, I claim that, in the context of your example, _if_ the task is stuck at the wait_event_uninterruptible(), _then_ the freezerless suspend will deadlock with the task.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"ON" == Oliver Neukum <[email protected]> writes:
ON> Because we will be unable to escape that job. Let's assume that we ON> remove the freezer from the STR path. The next complaint would be ON> that we cannot do STD with fuse. "Then don't do that" would not be ON> taken kindly as answer.
Ah, we are back to keeping STR broken in order to maybe get STD working. STR is much more interesting than STD.
/Benny
Am Freitag, 6. Juli 2007 schrieb Benny Amorsen:
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"ON" == Oliver Neukum <[email protected]> writes:
ON> Because we will be unable to escape that job. Let's assume that we ON> remove the freezer from the STR path. The next complaint would be ON> that we cannot do STD with fuse. "Then don't do that" would not be ON> taken kindly as answer.
Ah, we are back to keeping STR broken in order to maybe get STD working. STR is much more interesting than STD.
I am sorry, but we cannot live with only fixing parts of the kernel because you don't think the other parts are interesting.
Oliver
Quoted 8 lines · Benjamin Herrenschmidt
What you propose is basically a slightly over-simplistic version of what I think (and Paulus think) should be done. We do need to do it via driver callbacks down the tree since only drivers can know how to deal with their DMA etc... and ordering need to be respected, but that's basically it.
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
I wish you'd stop saying that. Have you ever done any serious testing?
Here's something to try: Add a time delay to the end of hub_suspend in drivers/usb/core/hub.c, so you can provoke a race manually. Then while one of your root hubs is being suspended and the system is waiting in that delay, either plug in a new USB device to that hub or unplug an existing device.
Be sure that CONFIG_USB_DEBUG is on so that we can figure out what happened after the fact.
Alan Stern
Quoted 8 lines · Benjamin Herrenschmidt
What you propose is basically a slightly over-simplistic version of what I think (and Paulus think) should be done. We do need to do it via driver callbacks down the tree since only drivers can know how to deal with their DMA etc... and ordering need to be respected, but that's basically it.
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
I wish you'd stop saying that. Have you ever done any serious testing?
Here's something to try: Add a time delay to the end of hub_suspend in drivers/usb/core/hub.c, so you can provoke a race manually. Then while one of your root hubs is being suspended and the system is waiting in that delay, either plug in a new USB device to that hub or unplug an existing device.
Be sure that CONFIG_USB_DEBUG is on so that we can figure out what happened after the fact.
Alan Stern
Quoted 8 lines · Benjamin Herrenschmidt
Why are you guys working so hard and spending so much energy to try to avoid doing the right thing is beyond my understanding...
Quoted 3 lines
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Ok none at all if you don't have a freezer.
In answer to both questions: We need the freezer in order to implement hibernate. Even if we take your advice and stop using the freezer during suspend, these issues would still remain and would need to be solved.
Alan Stern
Quoted 8 lines · Benjamin Herrenschmidt
Why are you guys working so hard and spending so much energy to try to avoid doing the right thing is beyond my understanding...
Quoted 3 lines
It _does_ apply to kernel threads. That's exactly why I wrote above that kernel threads which try to do I/O during a suspend will need extra attention.
Ok none at all if you don't have a freezer.
In answer to both questions: We need the freezer in order to implement hibernate. Even if we take your advice and stop using the freezer during suspend, these issues would still remain and would need to be solved.
Alan Stern
Quoted 2 lines · Kyle Moffett
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D.
But it _is_ about the freezer; see the "Remove process freezer" part. :-) Since the freezer is used during hibernation, hibernation is a legitimate topic.
Quoted 11 lines
When your
hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE:
Suspend-to-RAM), the list of things to do is short and simple:1) Stop DMA and put most hardware into low-power states (stops all interrupt sources)
2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep
3) Put the interrupt-controllers into low-power state
4) Go to sleep
Your short and simple list omits a few crucial items:
A) Decide what to do about remote wakeup requests.
B) Prevent I/O requests from resuming devices that have been suspended.
C) Prevent devices and drivers from being registered or unregistered; in particular decide what to do about hot-plug or hot-unplug events.
D) Block driver bind or unbind calls.
Any of these things is capable of screwing up the course of events. (In fact A _should_ be allowed to abort a suspend.)
Quoted 21 lines
Quoted 3 lines
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev){ set_no_bind_flag(dev); for (dev->subdevices) suspend_device(dev); set_no_io_flag(dev); wait_for_in_progress_dma(dev); turn_off_interrupts(dev); go_to_low_power_state(dev); }
Quoted 2 lines
After you've set the "
no_bind" flag, you won't get any *new* subdevices trying to bind,
So what happens if a new subdevice arrives at the wrong time? Do you block instead of binding it? While holding a mutex needed to suspend the parent device?
What about drivers trying to bind to existing devices?
What happens to I/O requests submitted after the "no_io" flag is set? The driver will have to block them, effectively creating its own little "freezer".
Quoted 11 lines
therefore it's safe to iterate over the
list of present sub-devices and suspend them. Once those are suspended and in low-power states you can set a "no_io" flag to prevent the driver from submitting more IO. At that point you can lazily wait for existing DMA/IO/interrupts to finish on the device, since *NOBODY* will be submitting them anymore, and we certainly aren't probing for new devices. Then you can just turn off the power to the device. When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
This is a lot like what we already do. The differences are:
There is nothing corresponding to your "no-bind" flag.
Most drivers don't have anything like your "no_io" flag; they assume that nobody will be around to submit an I/O request.
Quoted 11 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Quoted 4 lines
Resuming is basically running the whole process in reverse. Runtime- suspend is achieved by not setting the '
no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.
Nobody doubts that suspend can be made to work without the freezer. The point is that doing it this way dumps a bunch of extra responsibility on drivers.
Alan Stern
Quoted 2 lines · Kyle Moffett
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D.
But it _is_ about the freezer; see the "Remove process freezer" part. :-) Since the freezer is used during hibernation, hibernation is a legitimate topic.
Quoted 11 lines
When your
hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE:
Suspend-to-RAM), the list of things to do is short and simple:1) Stop DMA and put most hardware into low-power states (stops all interrupt sources)
2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep
3) Put the interrupt-controllers into low-power state
4) Go to sleep
Your short and simple list omits a few crucial items:
A) Decide what to do about remote wakeup requests.
B) Prevent I/O requests from resuming devices that have been suspended.
C) Prevent devices and drivers from being registered or unregistered; in particular decide what to do about hot-plug or hot-unplug events.
D) Block driver bind or unbind calls.
Any of these things is capable of screwing up the course of events. (In fact A _should_ be allowed to abort a suspend.)
Quoted 21 lines
Quoted 3 lines
As Pavel rightly said, you can get rid of the freezer, but you're only going to have to implement another one that does the essentially the same thing, even if it is at some other level.
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev){ set_no_bind_flag(dev); for (dev->subdevices) suspend_device(dev); set_no_io_flag(dev); wait_for_in_progress_dma(dev); turn_off_interrupts(dev); go_to_low_power_state(dev); }
Quoted 2 lines
After you've set the "
no_bind" flag, you won't get any *new* subdevices trying to bind,
So what happens if a new subdevice arrives at the wrong time? Do you block instead of binding it? While holding a mutex needed to suspend the parent device?
What about drivers trying to bind to existing devices?
What happens to I/O requests submitted after the "no_io" flag is set? The driver will have to block them, effectively creating its own little "freezer".
Quoted 11 lines
therefore it's safe to iterate over the
list of present sub-devices and suspend them. Once those are suspended and in low-power states you can set a "no_io" flag to prevent the driver from submitting more IO. At that point you can lazily wait for existing DMA/IO/interrupts to finish on the device, since *NOBODY* will be submitting them anymore, and we certainly aren't probing for new devices. Then you can just turn off the power to the device. When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
This is a lot like what we already do. The differences are:
There is nothing corresponding to your "no-bind" flag.
Most drivers don't have anything like your "no_io" flag; they assume that nobody will be around to submit an I/O request.
Quoted 11 lines
Scheduling and userspace are all still fully enabled in this scenario. Once all your devices are turned off, the only remaining running threads will be those which haven't done IO since the beginning of the suspend. We can then disable preemption, turn off the timer interrupts, and tell the other CPUs to park all their remaining threads in
schedule()and sleep. Then we put the IRQ controller to sleep and go to sleep ourselves. If our driver model locking is sufficient to handle putting a parent device to sleep while threads are sleeping on a child device then there are exactly 0 problems.
Quoted 4 lines
Resuming is basically running the whole process in reverse. Runtime- suspend is achieved by not setting the '
no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.
Nobody doubts that suspend can be made to work without the freezer. The point is that doing it this way dumps a bunch of extra responsibility on drivers.
Alan Stern
Quoted 4 lines · Alan Stern
Quoted 1 line · Kyle Moffett
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D.
But it _is_ about the freezer; see the "Remove process freezer" part. :-) Since the freezer is used during hibernation, hibernation is a legitimate topic.
Except Linus already decreed (and I heartily agree) that hibernation and suspend-to-RAM were fundamentally completely different operations and therefore any attempts to share code were basically just making a big muddy mess of things. Would a thread "Remove phase-of-the-moon calculations from network-recv code" be relevant to lunar observation just because the two had to do with the phases of the moon? No!
Quoted 10 lines
Quoted 6 lines
When your hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE: Suspend-to-RAM), the list of things to do is short and simple:
1) Stop DMA and put most hardware into low-power states (stops all interrupt sources) 2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep 3) Put the interrupt-controllers into low-power stat 4) Go to sleepYour short and simple list omits a few crucial items:
A) Decide what to do about remote wakeup requests.
Why do we care? If the wakeup request arrives before we go to sleep, we obviously aren't asleep and so can't wake up. If it arrives after we go to sleep then it will wake us up. Anything that depends on a wakeup arriving mid-sequence is 100% masochistic race condition.
Quoted 1 line
B) Prevent I/O requests from resuming devices that have been suspended.
(1a) As I describe below, step (1) includes setting NO_BIND and NO_IO flags on devices as they are processed. Anybody who wants to do IO while those flags are set should just go sleep on a waitqueue.
Quoted 1 line
C) Prevent devices and drivers from being registered or unregistered; in particular decide what to do about hot-plug or hot-unplug events.
(1b) Again, that's where the NO_BIND flag comes in. If its set then any device probe events must sleep, otherwise they can go through.
Quoted 1 line
D) Block driver bind or unbind calls.
See points (1a) and (1b) above.
Quoted 1 line
Any of these things is capable of screwing up the course of events. (In fact A _should_ be allowed to abort a suspend.)
If any of those things screw up suspend-to-RAM then it is 100% the drivers fault and no "process freezer" is going to fix it, end of story. And "A" cannot be made reliable. At some point you shut off interrupts right before going to sleep, and at that point any remote wakeup event is just going to get dropped until you actually enter sleep mode and the hardware takes over again. If you miss a wakeup event then whatever sent it should just retry, just as with *every* other kind of network packet.
Quoted 13 lines
Quoted 13 lines
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev){ set_no_bind_flag(dev); for (dev->subdevices) suspend_device(dev); set_no_io_flag(dev); wait_for_in_progress_dma(dev); turn_off_interrupts(dev); go_to_low_power_state(dev); }
Quoted 3 lines
Quoted 1 line
After you've set the "
no_bind" flag, you won't get any *new* subdevices trying to bind,So what happens if a new subdevice arrives at the wrong time? Do you block instead of binding it? While holding a mutex needed to suspend the parent device?
That would be a driver bug. If you have asynchronous probing then proper suspend handling includes being able to postpone driver probe events until after resume. If you have synchronous probing then the problem doesn't exist because "set_no_bind_flag" is just telling the device not to raise any more device probe interrupts.
Quoted 1 line
What about drivers trying to bind to existing devices?
While binding it will clearly be holding a mutex/spinlock on the parent device, so the suspend process will wait for it. When binding is done the suspend_device() code will take the device lock and tell everything else to postpone further bind requests as above.
Quoted 1 line
What happens to I/O requests submitted after the "
no_io" flag is set? The driver will have to block them, effectively creating its own little "freezer".
Oh, so you're calling every waitqueue in the kernel a "freezer" now? We do these things at the driver level *all* *the* *time*. For instance, you can't submit new IOs to an ATA controller while it's renegotiating the bus speed, but that's never been a problem before.
Quoted 7 lines
Quoted 1 line
When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
This is a lot like what we already do. The differences are:
There is nothing corresponding to your "no-bind" flag.
Most drivers don't have anything like your "
no_io" flag; they assume that nobody will be around to submit an I/O request.
Most drivers have an implicit NO_BIND flag: The device's interrupts are off and/or its in a low-power state. USB is already terribly buggy with regards to suspend: If you hotplug a device during suspend (like the touchpad in my powerbook powering down/up), then the USB stack will basically hang that controller. The device is off and the hotplug triggers interrupts and IO, *EVEN* *WITHOUT* *USERSPACE*.
So if your driver doesn't already have a proper way of blocking IO during suspend then it probably doesn't suspend 50% of the time anyways. A bug which bites *every* *time* is easy to fix, one which only bites when things hit a race condition is much harder.
Quoted 3 lines
Quoted 1 line
Resuming is basically running the whole process in reverse. Runtime-suspend is achieved by not setting the '
no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.Nobody doubts that suspend can be made to work without the freezer. The point is that doing it this way dumps a bunch of extra responsibility on drivers.
That responsibility has been there ever since suspend-to-RAM support was added. Nobody ever denied that writing a proper driver wasn't tricky. You have to simultaneously be able to handle handle hot-unplug, IO errors, interrupts, IO requests, suspend-to-RAM, and hibernation. If your driver mutual-exclusion is buggy then it probably already bites you during hotplug or other similar scenarios. Let's at least make the problems much more reproducible so we can fix the drivers properly instead of continuing to kludge around it for all eternity.
Cheers,
Kyle Moffett
Quoted 4 lines · Alan Stern
Quoted 1 line · Kyle Moffett
Umm, this thread is NOT ABOUT HIBERNATING!!! Please go back and read the subject, specifically the "suspend to RAM" parts :-D.
But it _is_ about the freezer; see the "Remove process freezer" part. :-) Since the freezer is used during hibernation, hibernation is a legitimate topic.
Except Linus already decreed (and I heartily agree) that hibernation and suspend-to-RAM were fundamentally completely different operations and therefore any attempts to share code were basically just making a big muddy mess of things. Would a thread "Remove phase-of-the-moon calculations from network-recv code" be relevant to lunar observation just because the two had to do with the phases of the moon? No!
Quoted 10 lines
Quoted 6 lines
When your hardware can put itself to sleep and atomically preserve memory as it does so, you don't need an atomic copy. For Real Suspend(TM) (IE: Suspend-to-RAM), the list of things to do is short and simple:
1) Stop DMA and put most hardware into low-power states (stops all interrupt sources) 2) Ensure that the other CPUs have finished any trailing interrupt handlers and put them to sleep 3) Put the interrupt-controllers into low-power stat 4) Go to sleepYour short and simple list omits a few crucial items:
A) Decide what to do about remote wakeup requests.
Why do we care? If the wakeup request arrives before we go to sleep, we obviously aren't asleep and so can't wake up. If it arrives after we go to sleep then it will wake us up. Anything that depends on a wakeup arriving mid-sequence is 100% masochistic race condition.
Quoted 1 line
B) Prevent I/O requests from resuming devices that have been suspended.
(1a) As I describe below, step (1) includes setting NO_BIND and NO_IO flags on devices as they are processed. Anybody who wants to do IO while those flags are set should just go sleep on a waitqueue.
Quoted 1 line
C) Prevent devices and drivers from being registered or unregistered; in particular decide what to do about hot-plug or hot-unplug events.
(1b) Again, that's where the NO_BIND flag comes in. If its set then any device probe events must sleep, otherwise they can go through.
Quoted 1 line
D) Block driver bind or unbind calls.
See points (1a) and (1b) above.
Quoted 1 line
Any of these things is capable of screwing up the course of events. (In fact A _should_ be allowed to abort a suspend.)
If any of those things screw up suspend-to-RAM then it is 100% the drivers fault and no "process freezer" is going to fix it, end of story. And "A" cannot be made reliable. At some point you shut off interrupts right before going to sleep, and at that point any remote wakeup event is just going to get dropped until you actually enter sleep mode and the hardware takes over again. If you miss a wakeup event then whatever sent it should just retry, just as with *every* other kind of network packet.
Quoted 13 lines
Quoted 13 lines
How about a freezer whose job it is to "wait for pending hard interrupts to complete when we have already guaranteed that we won't get any more"? That part should be really *REALLY* easy. You don't need to care about either userspace processes or kernel threads at all. Specifically, Step 1 consists of:
suspend_device(dev){ set_no_bind_flag(dev); for (dev->subdevices) suspend_device(dev); set_no_io_flag(dev); wait_for_in_progress_dma(dev); turn_off_interrupts(dev); go_to_low_power_state(dev); }
Quoted 3 lines
Quoted 1 line
After you've set the "
no_bind" flag, you won't get any *new* subdevices trying to bind,So what happens if a new subdevice arrives at the wrong time? Do you block instead of binding it? While holding a mutex needed to suspend the parent device?
That would be a driver bug. If you have asynchronous probing then proper suspend handling includes being able to postpone driver probe events until after resume. If you have synchronous probing then the problem doesn't exist because "set_no_bind_flag" is just telling the device not to raise any more device probe interrupts.
Quoted 1 line
What about drivers trying to bind to existing devices?
While binding it will clearly be holding a mutex/spinlock on the parent device, so the suspend process will wait for it. When binding is done the suspend_device() code will take the device lock and tell everything else to postpone further bind requests as above.
Quoted 1 line
What happens to I/O requests submitted after the "
no_io" flag is set? The driver will have to block them, effectively creating its own little "freezer".
Oh, so you're calling every waitqueue in the kernel a "freezer" now? We do these things at the driver level *all* *the* *time*. For instance, you can't submit new IOs to an ATA controller while it's renegotiating the bus speed, but that's never been a problem before.
Quoted 7 lines
Quoted 1 line
When all the leaf devices are off, the parent device can be turned off because everything waiting on the leaf devices is blocked on them and won't unblock until the parent device *AND* the leaf device are turned on again, in that order.
This is a lot like what we already do. The differences are:
There is nothing corresponding to your "no-bind" flag.
Most drivers don't have anything like your "
no_io" flag; they assume that nobody will be around to submit an I/O request.
Most drivers have an implicit NO_BIND flag: The device's interrupts are off and/or its in a low-power state. USB is already terribly buggy with regards to suspend: If you hotplug a device during suspend (like the touchpad in my powerbook powering down/up), then the USB stack will basically hang that controller. The device is off and the hotplug triggers interrupts and IO, *EVEN* *WITHOUT* *USERSPACE*.
So if your driver doesn't already have a proper way of blocking IO during suspend then it probably doesn't suspend 50% of the time anyways. A bug which bites *every* *time* is easy to fix, one which only bites when things hit a race condition is much harder.
Quoted 3 lines
Quoted 1 line
Resuming is basically running the whole process in reverse. Runtime-suspend is achieved by not setting the '
no_io' or 'no_bind' flags and putting selective device-subtrees to sleep without doing anything to the rest of the system.Nobody doubts that suspend can be made to work without the freezer. The point is that doing it this way dumps a bunch of extra responsibility on drivers.
That responsibility has been there ever since suspend-to-RAM support was added. Nobody ever denied that writing a proper driver wasn't tricky. You have to simultaneously be able to handle handle hot-unplug, IO errors, interrupts, IO requests, suspend-to-RAM, and hibernation. If your driver mutual-exclusion is buggy then it probably already bites you during hotplug or other similar scenarios. Let's at least make the problems much more reproducible so we can fix the drivers properly instead of continuing to kludge around it for all eternity.
Cheers,
Kyle Moffett
Quoted 20 lines · Oliver Neukum
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res =evaluate_result();mutex_unlock();
return res;
Quoted 4 lines
If you put a task into the refrigerator at
wait_event_interruptible()you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.
Well... 2 things here. Either you have a freezer in which case the chances of the above scenario are increased, or you don't, in which case your suspend method will just sleep on the lock until outstanding HW accesses that have that lock are completed, and everything is fine.
You need to be careful with one thing though, whether you have a freezer or not. If you driver, in some code path, whatever it is (ioctl, kernel thread, workqueue, ...) does something like:
mutex_lockkmalloc(...,GFP_KERNEL);mutex_unlock
And it's suspend callback then does:
mutex_lock
The problem here is that the disks might already have been suspended prior to your driver being called. Thus, any attempt at pushing things out to swap or dirty mmap'ings back to storage will hang, thus kmalloc can potentially hang (afaik), and you will deadlock.
That's what I've been talking about earlier when I said that we should have some security in SLAB/SLUB/Buddy allocators, to silently turn GFP_KERNEL to at least GFP_NOIO or even ATOMIC before we start suspending drivers.
Now, another way to deal with that would have to use pre-suspend/post-resume notifications, and have drivers avoid doing the above between those, but that's much harder. (Essentially, drivers would have to either make sure they don't do things like blocking allocations, even implicitely, or possibly fall back to a degraded synchronous mode or that sort of thing).
I think it's much simpler to tweak slab/slub/buddy instead :-)
Note that the above issue is orthogonal to our freezer discussion, it's just one of the potential deadlock cause we have with suspend that needs to be fixed.
Cheers,
Ben.
Quoted 6 lines · Rafael J. Wysocki
Moreover, I claim that, in the context of your example, _if_ the task is stuck
at thewait_event_uninterruptible(), _then_ the freezerless suspend will
deadlock with the task.
Why would the task be stuck there if it's not becasue of a freezer ? The only reason I see would be a dependency on something like kmalloc trying to push things to disk, or a lock owned by another user process, but the former is a generic issue I've discussed in a separate mail and the later is a driver bug imho.
Ben.
Quoted 6 lines · Kyle Moffett
Except Linus already decreed (and I heartily agree) that hibernation and suspend-to-RAM were fundamentally completely different operations and therefore any attempts to share code were basically just making a big muddy mess of things. Would a thread "Remove phase-of-the-moon calculations from network-recv code" be relevant to lunar observation just because the two had to do with the phases of the moon? No!
For that matter, shutting down a CPU and hibernation are fundamentally different operations -- but they both use the freezer. Is that a big muddy mess? But never mind; I won't discuss hibernation.
Quoted 6 lines
Quoted 1 line
A) Decide what to do about remote wakeup requests.
Why do we care? If the wakeup request arrives before we go to sleep, we obviously aren't asleep and so can't wake up. If it arrives after we go to sleep then it will wake us up. Anything that depends on a wakeup arriving mid-sequence is 100% masochistic race condition.
You don't understand my point. If a wakeup request arrives before the system goes to sleep, and it is serviced, then a device which ought to have been suspended will in fact be awake. This will (if the parent's driver is written correctly) cause the sleep transition to abort.
Not that there's necessarily anything wrong with that. I just wanted to be sure you were aware of the potential problems.
Quoted 6 lines
Quoted 3 lines
C) Prevent devices and drivers from being registered or unregistered; in particular decide what to do about hot-plug or hot- unplug events.
(1b) Again, that's where the
NO_BINDflag comes in. If its set then any device probe events must sleep, otherwise they can go through.
I didn't say "bind", I said "registered". Admittedly, they are rather similar.
Still, there are difficulties. Let's say a driver has set the NO_BIND flag for one of its devices. A bind request comes in, and the driver puts it on a waitqueue. Note that the binding thread holds the device semaphore; this is always true when a driver's probe routine is called.
Later on it comes time for the PM core to resume the device, which will start up the threads on the waitqueue. Before doing so it must acquire the device semaphore. Deadlock!
Quoted 3 lines
If any of those things screw up suspend-to-RAM then it is 100% the drivers fault and no "process freezer" is going to fix it, end of story.
Why do you say that? A "process freezer" can prevent bind and registration calls from occurring, since these calls have to run in process context. Ergo a freezer _can_ fix some of these problems.
Quoted 6 lines
And "A" cannot be made reliable. At some point you shut off
interrupts right before going to sleep, and at that point any remote wakeup event is just going to get dropped until you actually enter sleep mode and the hardware takes over again. If you miss a wakeup event then whatever sent it should just retry, just as with *every* other kind of network packet.
Who mentioned network packets? And who says a remote wakeup event will get dropped once interrupts are disabled? More likely it will set a bit somewhere that causes the system to wake up immediately after it has gone to sleep.
Quoted 7 lines
Quoted 3 lines
So what happens if a new subdevice arrives at the wrong time? Do you block instead of binding it? While holding a mutex needed to suspend the parent device?
That would be a driver bug. If you have asynchronous probing then proper suspend handling includes being able to postpone driver probe events until after resume.
One of your conditions (embodied in the pseudocode you posted earlier) was that drivers should be told to prevent binding and registration before the child devices are suspended. Currently the PM core doesn't do anything like that. You can't blame the drivers for this lack.
Of course it could be added. Or perhaps more easily, the drivers that support asynchronous probing could be notified when a suspend is about to start so they could begin blocking bindings/registrations then.
Quoted 4 lines
Quoted 1 line
What about drivers trying to bind to existing devices?
While binding it will clearly be holding a mutex/spinlock on the parent device,
("Parent device"? Do you mean the device being bound? If so then I agree. Or do you mean the device's parent? If so then your statement is not clear at all. There is special-case code in the driver core to make sure it is true for USB devices, and it looks ugly as can be.)
Quoted 3 lines
so the suspend process will wait for it. When binding
is done thesuspend_device()code will take the device lock and tell everything else to postpone further bind requests as above.
My question referred to drivers trying to bind or unbind a device _after_ the device has been suspended. I suppose you'll say that's covered by the NO_BIND flag. But now we have the locking problem mentioned above: The thread trying to bind is holding a lock which is needed for resuming.
Quoted 2 lines
Most drivers have an implicit
NO_BINDflag: The device's interrupts are off and/or its in a low-power state.
That won't cause binding to block or be postponed; it will cause it to fail. Not the same thing at all.
Quoted 6 lines
USB is already terribly
buggy with regards to suspend: If you hotplug a device during suspend (like the touchpad in my powerbook powering down/up), then the USB stack will basically hang that controller. The device is off and the hotplug triggers interrupts and IO, *EVEN* *WITHOUT* *USERSPACE*.
As one of the people responsible for the USB power management implementation, I would appreciate more details about this. For example, a dmesg log with CONFIG_USB_DEBUG turned on together with a complete description of the actions you took to provoke the bug.
(I wonder how much of this "buginess" is caused by the lack of the freezer in PPC.)
Quoted 4 lines
So if your driver doesn't already have a proper way of blocking IO during suspend then it probably doesn't suspend 50% of the time anyways. A bug which bites *every* *time* is easy to fix, one which only bites when things hit a race condition is much harder.
The USB drivers (at least, the ones with runtime PM support) rely on the freezer to block I/O during suspend. As far as I know, they do suspend properly, on systems where the freezer is used.
Quoted 9 lines
That responsibility has been there ever since suspend-to-RAM support was added. Nobody ever denied that writing a proper driver wasn't tricky. You have to simultaneously be able to handle handle hot- unplug, IO errors, interrupts, IO requests, suspend-to-RAM, and hibernation. If your driver mutual-exclusion is buggy then it probably already bites you during hotplug or other similar scenarios. Let's at least make the problems much more reproducible so we can fix the drivers properly instead of continuing to kludge around it for all eternity.
Is reproducibility really a problem at this stage? A bug which bites 50% of the time might not be quite as easy to fix as one which occurs every time, but it isn't terribly bad either.
Alan Stern
Quoted 6 lines · Kyle Moffett
Except Linus already decreed (and I heartily agree) that hibernation and suspend-to-RAM were fundamentally completely different operations and therefore any attempts to share code were basically just making a big muddy mess of things. Would a thread "Remove phase-of-the-moon calculations from network-recv code" be relevant to lunar observation just because the two had to do with the phases of the moon? No!
For that matter, shutting down a CPU and hibernation are fundamentally different operations -- but they both use the freezer. Is that a big muddy mess? But never mind; I won't discuss hibernation.
Quoted 6 lines
Quoted 1 line
A) Decide what to do about remote wakeup requests.
Why do we care? If the wakeup request arrives before we go to sleep, we obviously aren't asleep and so can't wake up. If it arrives after we go to sleep then it will wake us up. Anything that depends on a wakeup arriving mid-sequence is 100% masochistic race condition.
You don't understand my point. If a wakeup request arrives before the system goes to sleep, and it is serviced, then a device which ought to have been suspended will in fact be awake. This will (if the parent's driver is written correctly) cause the sleep transition to abort.
Not that there's necessarily anything wrong with that. I just wanted to be sure you were aware of the potential problems.
Quoted 6 lines
Quoted 3 lines
C) Prevent devices and drivers from being registered or unregistered; in particular decide what to do about hot-plug or hot- unplug events.
(1b) Again, that's where the
NO_BINDflag comes in. If its set then any device probe events must sleep, otherwise they can go through.
I didn't say "bind", I said "registered". Admittedly, they are rather similar.
Still, there are difficulties. Let's say a driver has set the NO_BIND flag for one of its devices. A bind request comes in, and the driver puts it on a waitqueue. Note that the binding thread holds the device semaphore; this is always true when a driver's probe routine is called.
Later on it comes time for the PM core to resume the device, which will start up the threads on the waitqueue. Before doing so it must acquire the device semaphore. Deadlock!
Quoted 3 lines
If any of those things screw up suspend-to-RAM then it is 100% the drivers fault and no "process freezer" is going to fix it, end of story.
Why do you say that? A "process freezer" can prevent bind and registration calls from occurring, since these calls have to run in process context. Ergo a freezer _can_ fix some of these problems.
Quoted 6 lines
And "A" cannot be made reliable. At some point you shut off
interrupts right before going to sleep, and at that point any remote wakeup event is just going to get dropped until you actually enter sleep mode and the hardware takes over again. If you miss a wakeup event then whatever sent it should just retry, just as with *every* other kind of network packet.
Who mentioned network packets? And who says a remote wakeup event will get dropped once interrupts are disabled? More likely it will set a bit somewhere that causes the system to wake up immediately after it has gone to sleep.
Quoted 7 lines
Quoted 3 lines
So what happens if a new subdevice arrives at the wrong time? Do you block instead of binding it? While holding a mutex needed to suspend the parent device?
That would be a driver bug. If you have asynchronous probing then proper suspend handling includes being able to postpone driver probe events until after resume.
One of your conditions (embodied in the pseudocode you posted earlier) was that drivers should be told to prevent binding and registration before the child devices are suspended. Currently the PM core doesn't do anything like that. You can't blame the drivers for this lack.
Of course it could be added. Or perhaps more easily, the drivers that support asynchronous probing could be notified when a suspend is about to start so they could begin blocking bindings/registrations then.
Quoted 4 lines
Quoted 1 line
What about drivers trying to bind to existing devices?
While binding it will clearly be holding a mutex/spinlock on the parent device,
("Parent device"? Do you mean the device being bound? If so then I agree. Or do you mean the device's parent? If so then your statement is not clear at all. There is special-case code in the driver core to make sure it is true for USB devices, and it looks ugly as can be.)
Quoted 3 lines
so the suspend process will wait for it. When binding
is done thesuspend_device()code will take the device lock and tell everything else to postpone further bind requests as above.
My question referred to drivers trying to bind or unbind a device _after_ the device has been suspended. I suppose you'll say that's covered by the NO_BIND flag. But now we have the locking problem mentioned above: The thread trying to bind is holding a lock which is needed for resuming.
Quoted 2 lines
Most drivers have an implicit
NO_BINDflag: The device's interrupts are off and/or its in a low-power state.
That won't cause binding to block or be postponed; it will cause it to fail. Not the same thing at all.
Quoted 6 lines
USB is already terribly
buggy with regards to suspend: If you hotplug a device during suspend (like the touchpad in my powerbook powering down/up), then the USB stack will basically hang that controller. The device is off and the hotplug triggers interrupts and IO, *EVEN* *WITHOUT* *USERSPACE*.
As one of the people responsible for the USB power management implementation, I would appreciate more details about this. For example, a dmesg log with CONFIG_USB_DEBUG turned on together with a complete description of the actions you took to provoke the bug.
(I wonder how much of this "buginess" is caused by the lack of the freezer in PPC.)
Quoted 4 lines
So if your driver doesn't already have a proper way of blocking IO during suspend then it probably doesn't suspend 50% of the time anyways. A bug which bites *every* *time* is easy to fix, one which only bites when things hit a race condition is much harder.
The USB drivers (at least, the ones with runtime PM support) rely on the freezer to block I/O during suspend. As far as I know, they do suspend properly, on systems where the freezer is used.
Quoted 9 lines
That responsibility has been there ever since suspend-to-RAM support was added. Nobody ever denied that writing a proper driver wasn't tricky. You have to simultaneously be able to handle handle hot- unplug, IO errors, interrupts, IO requests, suspend-to-RAM, and hibernation. If your driver mutual-exclusion is buggy then it probably already bites you during hotplug or other similar scenarios. Let's at least make the problems much more reproducible so we can fix the drivers properly instead of continuing to kludge around it for all eternity.
Is reproducibility really a problem at this stage? A bug which bites 50% of the time might not be quite as easy to fix as one which occurs every time, but it isn't terribly bad either.
Alan Stern
Quoted 13 lines · Alan Stern
Quoted 8 lines · Benjamin Herrenschmidt
What you propose is basically a slightly over-simplistic version of what I think (and Paulus think) should be done. We do need to do it via driver callbacks down the tree since only drivers can know how to deal with their DMA etc... and ordering need to be respected, but that's basically it.
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
I wish you'd stop saying that. Have you ever done any serious testing?
Quoted 8 lines
Here's something to try: Add a time delay to the end of
hub_suspendindrivers/usb/core/hub.c, so you can provoke a race manually. Then while one of your root hubs is being suspended and the system is waiting in that delay, either plug in a new USB device to that hub or unplug an existing device.Be sure that
CONFIG_USB_DEBUGis on so that we can figure out what happened after the fact.
If you remember, one of the things I've been advocating has always been that we should put on hold all plug activity (unplug might be alright as long as the user events are just delayed) when we start suspending. No new devices, no new bindings. "hub" type devices are respondible for bringing in the new stuff after resume.
Ben.
Quoted 10 lines
Quoted 4 lines
so the suspend process will wait for it. When binding
is done thesuspend_device()code will take the device lock and tell everything else to postpone further bind requests as above.My question referred to drivers trying to bind or unbind a device _after_ the device has been suspended. I suppose you'll say that's covered by the
NO_BINDflag. But now we have the locking problem mentioned above: The thread trying to bind is holding a lock which is needed for resuming.
Why would it ? Just make it fail, maybe with some kind of -ERETRY... Or it can spin with the lock not held if it want. That's a detail really.
Quoted 7 lines
As one of the people responsible for the USB power management implementation, I would appreciate more details about this. For example, a dmesg log with
CONFIG_USB_DEBUGturned on together with a complete description of the actions you took to provoke the bug.(I wonder how much of this "buginess" is caused by the lack of the freezer in PPC.)
No. The freezer will hide some of those problems under the carpet, but not solve the basic issue which is the driver should be solid. Period.
The freezer is a flawed concept in the first place. If you go back to square one, what is the basic idea of it ? I'll basically expose the idea and go down all of the path I have in mind where it stops working and becomes an incredibly difficult thing that in the end doesn't even solve all the problems it's supposed to.
So first thing first...
I want a quiescent system with no new "IO requests" (whatever that mean in the context of drivers) issued to avoid races during suspend/resume.
That sounds like a nice idea. Yeah. Sounds... only. Problem is. How do you define that quiescent system ? First idea is ... let's stop userland. There are various ways of doing that, but the freezer hooking into the signal code is not necessarily a bad one.
No, I'm purposefully putting aside all the cases where the above doesn't work (user process in the kernel in some uninterruptible wait, etc...), which are the first big setback imho... our simple idea is suddenly not so simple anymore, but we can bring those back later.
Now, there is still a problem... kernel threads. In fact, there is no fundamental distinction between a kernel thread and a user process... one has an MM and the other doesn't but as far as we are concerned, it's the same. Kernel threads can issues IOs, or like khubd, detect devices, plug/unplug them, etc etc.... all over the place.
Easy answer that comes to mind -> freeze them too. Heh, but kernel threads don't do signals, so we end up with all those try_to_freeze(). Then what about the fact that drivers may need those kernel threads to proceed ? Some drivers queue up their IO requests to a kernel thread to process them and suspend() might need to flush those down, issue a couple more such as "spin down disks" before that kernel thread can actually be frozen... Hrm.. maybe not all of them then.
But how do you decide ? What defines that a kernel can issue an IO ? In fact, if you look closely, anything doing kmalloc(...,GFP_KERNEL) for example can trigger an IO... implicitely, via the VM pushing things out. And that's just one example.
In some case, those same threads that may need to be kept non-frozen are -also- the ones that will potentially submit new IOs or bring in new devices.
And then, there is keventd ... what do you do about work queues ? You have everybody pouring things at workqueues... some of these things may well hit your driver, some may not. Same goes in some cases with interrupt time stuff, such as timers or tasklets.. think about networking.
In the end, the nice idea that "threads/tasks cause requests, so we just stop them" basically falls appart. Half of the kernel can cause a driver to be hit somewhere and a given time, it can be from a thread context, directly caused by userland, or from some timer due to some subsystem having a keepalive thing ticking in or whatever else.
Now, we go back to the previous issue of what do we do about uninterruptible sleep... You want to abort suspend because, for example, somethign called a driver that does an msleep(200) or so ? Are you aware that 99% of laptop users close their laptops and shove it in the bag not even waiting for the disk to spin down ? And you want suspend to abort because some random "happen all the time" even such as a process being somewhere temporarily in uninterruptible state in the kernel ?
So let's say we freeze them from within the scheduler even when they are uininterruptible.. ouch... you just caused the deadlocks we talked about before. While without a freezer, suspend() can at least rely on the fact that it can wait for processes that have such pending locked constructs waiting will ultimately wakeupm and wait for them (or even explicitely wake them), it can't if they've been frozen. So what was a perfectly solvable moderate driver synchronisation issue becomes a deadlock nightmare.
And those are just example. During this discussion, we also brought the example of FUSE which is a big stab at the whole freezer concept. And I'm sure we can find more everyday.
Face it, we should seriously look into doing suspend/resume without a freezer. I even tend to think that we could do STD that way too, in fact, while Linus is right saying it's a different problem than STR, we could even probably re-use some of the STR infrastructure in some hackish way, still without a freezer. We could have ways to block page cache writeout, for example, to prevent new post-snapshot dirty data from hitting the platter, and use direct BIOs for writeout. That's just an example.
Ben.
Quoted 10 lines
Quoted 4 lines
so the suspend process will wait for it. When binding
is done thesuspend_device()code will take the device lock and tell everything else to postpone further bind requests as above.My question referred to drivers trying to bind or unbind a device _after_ the device has been suspended. I suppose you'll say that's covered by the
NO_BINDflag. But now we have the locking problem mentioned above: The thread trying to bind is holding a lock which is needed for resuming.
Why would it ? Just make it fail, maybe with some kind of -ERETRY... Or it can spin with the lock not held if it want. That's a detail really.
Quoted 7 lines
As one of the people responsible for the USB power management implementation, I would appreciate more details about this. For example, a dmesg log with
CONFIG_USB_DEBUGturned on together with a complete description of the actions you took to provoke the bug.(I wonder how much of this "buginess" is caused by the lack of the freezer in PPC.)
No. The freezer will hide some of those problems under the carpet, but not solve the basic issue which is the driver should be solid. Period.
The freezer is a flawed concept in the first place. If you go back to square one, what is the basic idea of it ? I'll basically expose the idea and go down all of the path I have in mind where it stops working and becomes an incredibly difficult thing that in the end doesn't even solve all the problems it's supposed to.
So first thing first...
I want a quiescent system with no new "IO requests" (whatever that mean in the context of drivers) issued to avoid races during suspend/resume.
That sounds like a nice idea. Yeah. Sounds... only. Problem is. How do you define that quiescent system ? First idea is ... let's stop userland. There are various ways of doing that, but the freezer hooking into the signal code is not necessarily a bad one.
No, I'm purposefully putting aside all the cases where the above doesn't work (user process in the kernel in some uninterruptible wait, etc...), which are the first big setback imho... our simple idea is suddenly not so simple anymore, but we can bring those back later.
Now, there is still a problem... kernel threads. In fact, there is no fundamental distinction between a kernel thread and a user process... one has an MM and the other doesn't but as far as we are concerned, it's the same. Kernel threads can issues IOs, or like khubd, detect devices, plug/unplug them, etc etc.... all over the place.
Easy answer that comes to mind -> freeze them too. Heh, but kernel threads don't do signals, so we end up with all those try_to_freeze(). Then what about the fact that drivers may need those kernel threads to proceed ? Some drivers queue up their IO requests to a kernel thread to process them and suspend() might need to flush those down, issue a couple more such as "spin down disks" before that kernel thread can actually be frozen... Hrm.. maybe not all of them then.
But how do you decide ? What defines that a kernel can issue an IO ? In fact, if you look closely, anything doing kmalloc(...,GFP_KERNEL) for example can trigger an IO... implicitely, via the VM pushing things out. And that's just one example.
In some case, those same threads that may need to be kept non-frozen are -also- the ones that will potentially submit new IOs or bring in new devices.
And then, there is keventd ... what do you do about work queues ? You have everybody pouring things at workqueues... some of these things may well hit your driver, some may not. Same goes in some cases with interrupt time stuff, such as timers or tasklets.. think about networking.
In the end, the nice idea that "threads/tasks cause requests, so we just stop them" basically falls appart. Half of the kernel can cause a driver to be hit somewhere and a given time, it can be from a thread context, directly caused by userland, or from some timer due to some subsystem having a keepalive thing ticking in or whatever else.
Now, we go back to the previous issue of what do we do about uninterruptible sleep... You want to abort suspend because, for example, somethign called a driver that does an msleep(200) or so ? Are you aware that 99% of laptop users close their laptops and shove it in the bag not even waiting for the disk to spin down ? And you want suspend to abort because some random "happen all the time" even such as a process being somewhere temporarily in uninterruptible state in the kernel ?
So let's say we freeze them from within the scheduler even when they are uininterruptible.. ouch... you just caused the deadlocks we talked about before. While without a freezer, suspend() can at least rely on the fact that it can wait for processes that have such pending locked constructs waiting will ultimately wakeupm and wait for them (or even explicitely wake them), it can't if they've been frozen. So what was a perfectly solvable moderate driver synchronisation issue becomes a deadlock nightmare.
And those are just example. During this discussion, we also brought the example of FUSE which is a big stab at the whole freezer concept. And I'm sure we can find more everyday.
Face it, we should seriously look into doing suspend/resume without a freezer. I even tend to think that we could do STD that way too, in fact, while Linus is right saying it's a different problem than STR, we could even probably re-use some of the STR infrastructure in some hackish way, still without a freezer. We could have ways to block page cache writeout, for example, to prevent new post-snapshot dirty data from hitting the platter, and use direct BIOs for writeout. That's just an example.
Ben.
Hi!
Quoted 6 lines
Quoted 3 lines
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Because nobody is waiting on that kernel thread anyway without a freezer so there is no deadlock anymore.
In the deadlock we are seeing, _someone_ is waiting on userspace thread, that leads to deadlock with freezer. We don't know who, because we have not seen the sysrq-t dumps.
The "unknown who" will deadlock on fused frozen by driver, too. We really need to fix the "unknown who" here.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 6 lines
Quoted 3 lines
How will that help? Block the kernel thread in the freezer or block it in the driver -- either way it is blocked. So how do your deadlocks get resolved?
Because nobody is waiting on that kernel thread anyway without a freezer so there is no deadlock anymore.
In the deadlock we are seeing, _someone_ is waiting on userspace thread, that leads to deadlock with freezer. We don't know who, because we have not seen the sysrq-t dumps.
The "unknown who" will deadlock on fused frozen by driver, too. We really need to fix the "unknown who" here.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
Well, issue is, you should stop claiming it works fine until issue below is fixed... please?
And anyway I believe that current issue (fuse deadlocks with s2ram) should be present on powerbooks, too... it is just way harder to trigger. All that is neccessary is fused (or one of its helpers) to get frozen by accessing suspended device.
Pavel
Quoted 16 lines
Quoted 10 lines
I wish you'd stop saying that. Have you ever done any serious testing?
Here's something to try: Add a time delay to the end of
hub_suspendindrivers/usb/core/hub.c, so you can provoke a race manually. Then while one of your root hubs is being suspended and the system is waiting in that delay, either plug in a new USB device to that hub or unplug an existing device.Be sure that
CONFIG_USB_DEBUGis on so that we can figure out what happened after the fact.If you remember, one of the things I've been advocating has always been that we should put on hold all plug activity (unplug might be alright as long as the user events are just delayed) when we start suspending. No new devices, no new bindings. "hub" type devices are respondible for bringing in the new stuff after resume.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Matthew GarrettHi!
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
And also "Userland should not depend on userland services", which is rather more of a problem.
I think you're oversimplifying it, as far as FUSE is concerned.
Namely, if there are two userland tasks, A and B, and B is uninterruptible, because A is blocked, then this is not a usual situation.
Fuse is one case of it occuring, and if we end up with more userspace drivers then the problem is only going to get worse.
We'll have to solve them as they come.
Face it, hardware drivers _have_ to know about suspend/resume. Even userspace drivers will have to know about suspend/resume, because they need to reinit the hw during resume.
Now... most parts of kernel need to know (a bit) about suspend/resume -- at least enough to play nicely with refrigerator. In retrospect it is pretty obvious that this covers fused, too, unfortunately noone noticed that when fuse was designed.
Can we try to solve the suspend vs. fuse problem now? "Just removing the refrigerator" is not the answer. First, refrigerator is impossible to remove in few months timeframe, and second, it does not solve the problem anyway.
(Actually, there are two separate problems with suspend vs. fuse.)
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Miklos SzerediHi!
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
You have processes that don't react to signals, because some other user land task is misbehaving. I'd call that ugly at the very least.
It already happens with, say, NFS. Don't think about it in terms of a userland task misbehaving - think of it in terms of a resource becoming unavailable.
I think there's a difference between a userland task playing the role of a resource and a "real" external resource the kernel doesn't control.
Quoted 6 lines
Quoted 2 lines
IMO, userland tasks should not have the power to affect each other as though they were parts of the kernel.
One task doing
ptrace()can basically do whatever it wants with the task being traced. This is not an exact analogy to what fuse does, but close.
Well, IMO userland tasks should not have power to grab VFS mutexes for indefinite ammount of time. ("fused is allowed to deadlock kernel, in a way only write to special file helps" is ugly). Unfortunately, I don't think there's a way to work around that deadlock within fuse design limits... (coda was able to get around it by working on whole files granularity, AFAICT), so we'll have to live with that.
I think we have two separate problems here, and both are solvable, without major changes to fuse or suspend framework.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
problem 1 (was Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway))
In reply to Matthew GarrettHi!
Quoted 8 lines
Quoted 5 lines
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
No, that's not a problem. Or rather, that's different problem, called "problem 2" (fuse causes freezer to fail to stop processes).
But we still have "problem 1" here: after devices are suspended, kernel tries to use fuse's services. That is not going to work, one way or another, because devices are suspended and userland can't work reliably.
(Aha, it _may_ be it is kernel tries to use fuse's services after freezing userland but before freezing devices. I don't think it is).
To solve "problem 1", we need to know which part of kernel asks for fuse services. sysrq-t trace is likely to tell us. Can someone repeat the "problem 1" scenario (freezer succeeds but then it deadlocks), and produce sysrq-t trace? That way we can solve "problem 1".
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
problem 1 (was Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway))
In reply to Matthew GarrettHi!
Quoted 8 lines
Quoted 5 lines
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
No, that's not a problem. Or rather, that's different problem, called "problem 2" (fuse causes freezer to fail to stop processes).
But we still have "problem 1" here: after devices are suspended, kernel tries to use fuse's services. That is not going to work, one way or another, because devices are suspended and userland can't work reliably.
(Aha, it _may_ be it is kernel tries to use fuse's services after freezing userland but before freezing devices. I don't think it is).
To solve "problem 1", we need to know which part of kernel asks for fuse services. sysrq-t trace is likely to tell us. Can someone repeat the "problem 1" scenario (freezer succeeds but then it deadlocks), and produce sysrq-t trace? That way we can solve "problem 1".
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Paul Mackerras
Quoted 4 lines · Rafael J. Wysocki
This is incompatible with the code in
kernel/power/main.c, since we only disable the nonboot CPUs after devices have been suspended. Do you think that your framework can be modified to work without disabling the nonboot CPUs by the user space?
Quoted 6 lines
Sure. It was a "if it can be done in userspace, do it in userspace" kind of decision, but I'm not wedded to it.
I actually do want to converge to using the generic suspend-to-ram code on powerbooks. I just want to avoid causing regressions for powerbook users, including myself. :)
Curious, do you actually use fuse? Can you try it _with_ freezer and produce sysrq-t trace of deadlock?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 7 lines · Paul Mackerras
Quoted 4 lines · Rafael J. Wysocki
This is incompatible with the code in
kernel/power/main.c, since we only disable the nonboot CPUs after devices have been suspended. Do you think that your framework can be modified to work without disabling the nonboot CPUs by the user space?
Quoted 6 lines
Sure. It was a "if it can be done in userspace, do it in userspace" kind of decision, but I'm not wedded to it.
I actually do want to converge to using the generic suspend-to-ram code on powerbooks. I just want to avoid causing regressions for powerbook users, including myself. :)
Curious, do you actually use fuse? Can you try it _with_ freezer and produce sysrq-t trace of deadlock?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
I think you want to stick
try_to_freeze()at the same places where you do SIGKILL handling. That should solve the 'syslogd is unfreezeable' problem.I could, but it would not solve the general problem. Namely, that the presence of fuse imposes a certain ordering in which userspace tasks have to be frozen. And it is not possible to know this ordering.
We can just wait for all fuse requests to be serviced before proceeding further with freeze, right?
Quoted 4 lines
And even if the ordering were solved, the freezer would still not work if the filesystem is not responding due to external events, such as a lost network (this affects NFS, CIFS, whatever just the same as fuse).
That's ok, you can't suspend if your hdd is dead, and in the same way you can't suspend if your NFS server is dead. I agree it is ugly, but we seem to live ok with that.
We could (and should?) handle that, probably by realizing that NFS is not a disk and using interruptible sleep, but...
Quoted 6 lines
Quoted 4 lines
Plus, it would be nice to find out where suspend/hibernation is triggering fuse activity. We can then decide where to fix it -- in fuse or in suspend parts. You said
sys_syncis not implemented... so where is the problem?I cannot say without having a sysrq-t of the situation.
Yes please. Can someone affected please produce sysrq-t?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Miklos Szeredi
Quoted 5 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Okay, and you should handle refrigerator in the same paths where you handle SIGKILL. Just add
try_to_freeze()there...It's the fourth time I'm repeating this in this thread:
Quoted 7 lines
Yes adding
try_to_freeze()there would partially solve the probelem.But another task can be sleeping on a mutex held by the task waiting for the reply. And the freezer won't be able to handle that one.
Generally, calling
try_to_freeze()with mutexes held is not a good idea.
Agreed, calling try_to_freeze() with mutex held is no-no, and it is even documented somewhere.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Miklos Szeredi
Quoted 5 lines
Quoted 2 lines
Actually fuse allows SIGKILL, because it's always fatal, and the syscall may not be restarted.
Okay, and you should handle refrigerator in the same paths where you handle SIGKILL. Just add
try_to_freeze()there...It's the fourth time I'm repeating this in this thread:
Quoted 7 lines
Yes adding
try_to_freeze()there would partially solve the probelem.But another task can be sleeping on a mutex held by the task waiting for the reply. And the freezer won't be able to handle that one.
Generally, calling
try_to_freeze()with mutexes held is not a good idea.
Agreed, calling try_to_freeze() with mutex held is no-no, and it is even documented somewhere.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 2 lines
Quoted 2 lines
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
If you remember, one of the things I've been advocating has always been that we should put on hold all plug activity (unplug might be alright as long as the user events are just delayed) when we start suspending. No new devices, no new bindings. "hub" type devices are respondible for bringing in the new stuff after resume.
Which is exactly my point. It _doesn't_ work fine without a freezer, because the USB stack currently relies on the freezer to prevent plug activity.
Alan Stern
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 4 lines
Quoted 3 lines
so the suspend process will wait for it. When binding
is done thesuspend_device()code will take the device lock and tell everything else to postpone further bind requests as above.
Quoted 8 lines
Quoted 5 lines
My question referred to drivers trying to bind or unbind a device _after_ the device has been suspended. I suppose you'll say that's covered by the
NO_BINDflag. But now we have the locking problem mentioned above: The thread trying to bind is holding a lock which is needed for resuming.Why would it ? Just make it fail, maybe with some kind of
-ERETRY... Or it can spin with the lock not held if it want. That's a detail really.
Spinning in the driver with the lock not held is impossible, since the driver is called with the lock already acquired.
Failing with -ERETRY is non-transparent. I would prefer to block such requests at their source, before the lock is acquired. Perhaps in the driver core, perhaps even earlier.
(And rather than trying to manage a waitqueue or struct completion, it would be easiest to jump directly into the freezer! The driver or the core wouldn't have to worry about waking up all these blocked threads.)
Quoted 10 lines
Quoted 7 lines
As one of the people responsible for the USB power management implementation, I would appreciate more details about this. For example, a dmesg log with
CONFIG_USB_DEBUGturned on together with a complete description of the actions you took to provoke the bug.(I wonder how much of this "buginess" is caused by the lack of the freezer in PPC.)
No. The freezer will hide some of those problems under the carpet, but not solve the basic issue which is the driver should be solid. Period.
You're missing the point. If the driver and the freezer are both solid, there's no reason they can't share the work. If many drivers can pass off part of their workload to the single freezer, it's a net win.
So it isn't a question of how solid the drivers are; it's a question of how solid the freezer is. And bear in mind that if you convince people the freezer is not solid enough to be used, then you will have to find an alternative for purposes of hibernation.
Quoted 1 line
The freezer is a flawed concept in the first place.
<... Long and cogent argument which I will skip over for now ...>
Quoted 2 lines
Face it, we should seriously look into doing suspend/resume without a freezer.
I'm willing to try, although I think it will be a tremendous amount of work to verify that every driver does the right thing. There's lots of support missing. For example, don't you think we should block all sysfs I/O during suspend? And likewise for insmod/rmmod?
Quoted 7 lines
I even tend to think that we could do STD that way too, in fact, while Linus is right saying it's a different problem than STR, we could even probably re-use some of the STR infrastructure in some hackish way, still without a freezer. We could have ways to block page cache writeout, for example, to prevent new post-snapshot dirty data from hitting the platter, and use direct BIOs for writeout. That's just an example.
What about systems with no BIOS? I think this would be very hard or even impossible to make work.
Alan Stern
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 4 lines
Quoted 3 lines
so the suspend process will wait for it. When binding
is done thesuspend_device()code will take the device lock and tell everything else to postpone further bind requests as above.
Quoted 8 lines
Quoted 5 lines
My question referred to drivers trying to bind or unbind a device _after_ the device has been suspended. I suppose you'll say that's covered by the
NO_BINDflag. But now we have the locking problem mentioned above: The thread trying to bind is holding a lock which is needed for resuming.Why would it ? Just make it fail, maybe with some kind of
-ERETRY... Or it can spin with the lock not held if it want. That's a detail really.
Spinning in the driver with the lock not held is impossible, since the driver is called with the lock already acquired.
Failing with -ERETRY is non-transparent. I would prefer to block such requests at their source, before the lock is acquired. Perhaps in the driver core, perhaps even earlier.
(And rather than trying to manage a waitqueue or struct completion, it would be easiest to jump directly into the freezer! The driver or the core wouldn't have to worry about waking up all these blocked threads.)
Quoted 10 lines
Quoted 7 lines
As one of the people responsible for the USB power management implementation, I would appreciate more details about this. For example, a dmesg log with
CONFIG_USB_DEBUGturned on together with a complete description of the actions you took to provoke the bug.(I wonder how much of this "buginess" is caused by the lack of the freezer in PPC.)
No. The freezer will hide some of those problems under the carpet, but not solve the basic issue which is the driver should be solid. Period.
You're missing the point. If the driver and the freezer are both solid, there's no reason they can't share the work. If many drivers can pass off part of their workload to the single freezer, it's a net win.
So it isn't a question of how solid the drivers are; it's a question of how solid the freezer is. And bear in mind that if you convince people the freezer is not solid enough to be used, then you will have to find an alternative for purposes of hibernation.
Quoted 1 line
The freezer is a flawed concept in the first place.
<... Long and cogent argument which I will skip over for now ...>
Quoted 2 lines
Face it, we should seriously look into doing suspend/resume without a freezer.
I'm willing to try, although I think it will be a tremendous amount of work to verify that every driver does the right thing. There's lots of support missing. For example, don't you think we should block all sysfs I/O during suspend? And likewise for insmod/rmmod?
Quoted 7 lines
I even tend to think that we could do STD that way too, in fact, while Linus is right saying it's a different problem than STR, we could even probably re-use some of the STR infrastructure in some hackish way, still without a freezer. We could have ways to block page cache writeout, for example, to prevent new post-snapshot dirty data from hitting the platter, and use direct BIOs for writeout. That's just an example.
What about systems with no BIOS? I think this would be very hard or even impossible to make work.
Alan Stern
Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Pavel MachekQuoted 10 lines
Quoted 3 lines
One task doing
ptrace()can basically do whatever it wants with the task being traced. This is not an exact analogy to what fuse does, but close.Well, IMO userland tasks should not have power to grab VFS mutexes for indefinite ammount of time. ("fused is allowed to deadlock kernel, in a way only write to special file helps" is ugly). Unfortunately, I don't think there's a way to work around that deadlock within fuse design limits... (coda was able to get around it by working on whole files granularity, AFAICT), so we'll have to live with that.
That's just file I/O. You can easily deadlock coda with any other file operation. In fact coda is _less_ robust wrt a misbehaving userspace server than fuse by a big margin.
Miklos
Quoted 21 lines · Benjamin Herrenschmidt
Quoted 20 lines · Oliver Neukum
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res =evaluate_result();mutex_unlock();
return res;
Quoted 7 lines
Quoted 4 lines
If you put a task into the refrigerator at
wait_event_interruptible()you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.Well... 2 things here. Either you have a freezer in which case the chances of the above scenario are increased,
How so? :-)
Quoted 33 lines
or you don't, in which case
your suspend method will just sleep on the lock until outstanding HW accesses that have that lock are completed, and everything is fine.You need to be careful with one thing though, whether you have a freezer or not. If you driver, in some code path, whatever it is (ioctl, kernel thread, workqueue, ...) does something like:
mutex_lockkmalloc(...,GFP_KERNEL);mutex_unlockAnd it's suspend callback then does:
mutex_lockThe problem here is that the disks might already have been suspended prior to your driver being called. Thus, any attempt at pushing things out to swap or dirty mmap'ings back to storage will hang, thus kmalloc can potentially hang (afaik), and you will deadlock.
That's what I've been talking about earlier when I said that we should have some security in SLAB/SLUB/Buddy allocators, to silently turn
GFP_KERNELto at leastGFP_NOIOor even ATOMIC before we start suspending drivers.Now, another way to deal with that would have to use pre-suspend/post-resume notifications, and have drivers avoid doing the above between those, but that's much harder. (Essentially, drivers would have to either make sure they don't do things like blocking allocations, even implicitely, or possibly fall back to a degraded synchronous mode or that sort of thing).
Quoted 5 lines
I think it's much simpler to tweak slab/slub/buddy instead :-)
Note that the above issue is orthogonal to our freezer discussion, it's just one of the potential deadlock cause we have with suspend that needs to be fixed.
Agreed.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Quoted 2 lines
We can just wait for all fuse requests to be serviced before proceeding further with freeze, right?
Right. Nice way to slow down or stop the suspend with an unprivileged process. Avoiding that sort of DoS is one of the design goals of fuse.
Look at it this way: the task of the freezer is to stop new I/O hitting the hardware. But it is totally indiscriminate about what it stops, it tries to stop _everything_ even things which have nothing to do with hardware.
Not nice.
Miklos
Quoted 21 lines · Benjamin Herrenschmidt
Quoted 20 lines · Oliver Neukum
Am Freitag, 6. Juli 2007 schrieb Benjamin Herrenschmidt:
Quoted 9 lines · Rafael J. Wysocki
Quoted 5 lines
The only reason (I know of) why we don't handle uninterruptible tasks in the freezer is that we're afraid of the suspend process deadlocking with an uninterruptible task holding a lock, but AFAICS the probability of such an event is extremely small.
What would deadlock specifically ? One of the drivers trying to acquire that lock ? It would be a driver bug then.
Your driver's write method looks like:
mutex_lock();poke_some_hardware();wait_event_uninterruptible(); //for result
res =evaluate_result();mutex_unlock();
return res;
Quoted 7 lines
Quoted 4 lines
If you put a task into the refrigerator at
wait_event_interruptible()you will deadlock if you need this lock for the driver to go to suspend. The suspend method then must not take the lock _and_ it must be aware that there may be an ongoing operation.Well... 2 things here. Either you have a freezer in which case the chances of the above scenario are increased,
How so? :-)
Quoted 33 lines
or you don't, in which case
your suspend method will just sleep on the lock until outstanding HW accesses that have that lock are completed, and everything is fine.You need to be careful with one thing though, whether you have a freezer or not. If you driver, in some code path, whatever it is (ioctl, kernel thread, workqueue, ...) does something like:
mutex_lockkmalloc(...,GFP_KERNEL);mutex_unlockAnd it's suspend callback then does:
mutex_lockThe problem here is that the disks might already have been suspended prior to your driver being called. Thus, any attempt at pushing things out to swap or dirty mmap'ings back to storage will hang, thus kmalloc can potentially hang (afaik), and you will deadlock.
That's what I've been talking about earlier when I said that we should have some security in SLAB/SLUB/Buddy allocators, to silently turn
GFP_KERNELto at leastGFP_NOIOor even ATOMIC before we start suspending drivers.Now, another way to deal with that would have to use pre-suspend/post-resume notifications, and have drivers avoid doing the above between those, but that's much harder. (Essentially, drivers would have to either make sure they don't do things like blocking allocations, even implicitely, or possibly fall back to a degraded synchronous mode or that sort of thing).
Quoted 5 lines
I think it's much simpler to tweak slab/slub/buddy instead :-)
Note that the above issue is orthogonal to our freezer discussion, it's just one of the potential deadlock cause we have with suspend that needs to be fixed.
Agreed.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: problem 1 (was Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway))
In reply to Pavel MachekQuoted 19 lines · Pavel Machek
Hi!
Quoted 8 lines
Quoted 5 lines
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
No, that's not a problem. Or rather, that's different problem, called "problem 2" (fuse causes freezer to fail to stop processes).
But we still have "problem 1" here: after devices are suspended, kernel tries to use fuse's services. That is not going to work, one way or another, because devices are suspended and userland can't work reliably.
Quoted 7 lines
(Aha, it _may_ be it is kernel tries to use fuse's services after freezing userland but before freezing devices. I don't think it is).
To solve "problem 1", we need to know which part of kernel asks for fuse services. sysrq-t trace is likely to tell us. Can someone repeat the "problem 1" scenario (freezer succeeds but then it deadlocks), and produce sysrq-t trace? That way we can solve "problem 1".
Well, such a trace would be helpful in any case.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
Re: problem 1 (was Re: removing refrigerator does not help with s2ram vs. fuse deadlocks (was Re: Re: [PATCH] Remove process freezer from suspend to RAM pathway))
In reply to Pavel MachekQuoted 19 lines · Pavel Machek
Hi!
Quoted 8 lines
Quoted 5 lines
Now, if kernel needs FUSE services for some reason (that's the problem we hit in s2ram case, right?), we have a deadlock.
So main problem still seems to be "kernel should not depend on userland services during suspend", refrigerator or not.
And also "Userland should not depend on userland services", which is rather more of a problem.
No, that's not a problem. Or rather, that's different problem, called "problem 2" (fuse causes freezer to fail to stop processes).
But we still have "problem 1" here: after devices are suspended, kernel tries to use fuse's services. That is not going to work, one way or another, because devices are suspended and userland can't work reliably.
Quoted 7 lines
(Aha, it _may_ be it is kernel tries to use fuse's services after freezing userland but before freezing devices. I don't think it is).
To solve "problem 1", we need to know which part of kernel asks for fuse services. sysrq-t trace is likely to tell us. Can someone repeat the "problem 1" scenario (freezer succeeds but then it deadlocks), and produce sysrq-t trace? That way we can solve "problem 1".
Well, such a trace would be helpful in any case.
Greetings,
Rafael
Signature · 1 line
"Premature optimization is the root of all evil." - Donald Knuth
malicious filesystems (was Re: [linux-pm] Re: [PATCH] Remove process freezer from suspend to RAM pathway)
In reply to Miklos SzerediHi!
Quoted 6 lines
Quoted 2 lines
We can just wait for all fuse requests to be serviced before proceeding further with freeze, right?
Right. Nice way to slow down or stop the suspend with an unprivileged process. Avoiding that sort of DoS is one of the design goals of fuse.
So you want me to handle _malicious_ filesystems now?
That should be easy... :-). You already have nasty deadlocks in FUSE, and you solve them by "root can echo 1 > abort"... so allow me the same possibility.
We can tell fused we are freezing, and if all the requests are not serviced within, say, 30 seconds, we call the filesystem malicious and do echo 1 > abort.
Not ideal, but neither is allowing malicious filesystems in the first place...
Quoted 6 lines
Look at it this way: the task of the freezer is to stop new I/O hitting the hardware. But it is totally indiscriminate about what it stops, it tries to stop _everything_ even things which have nothing to do with hardware.
Not nice.
Not nice, but we don't know any better for now. "Just fix all the drivers" basically means "just fix 90% of kernel".
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 4 lines · Pavel Machek
And anyway I believe that current issue (fuse deadlocks with s2ram) should be present on powerbooks, too... it is just way harder to trigger. All that is neccessary is fused (or one of its helpers) to get frozen by accessing suspended device.
I don't see any fuse specific issue without a freezer, but I see generic issues such as kmalloc blocking in a driver with a mutex held etc... but I've talked about these already. They have nothing to do with the freezer though.
Ben.
Quoted 11 lines · Alan Stern
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 2 lines
Quoted 2 lines
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
If you remember, one of the things I've been advocating has always been that we should put on hold all plug activity (unplug might be alright as long as the user events are just delayed) when we start suspending. No new devices, no new bindings. "hub" type devices are respondible for bringing in the new stuff after resume.
Quoted 3 lines
Which is exactly my point. It _doesn't_ work fine without a freezer, because the USB stack currently relies on the freezer to prevent plug activity.
Putting on hold plug activity has nothing, NOTHING, to do with the half assed piece of deadlocking crap we have now we call a freezer.
As long as you guys keep mixing up all the issues and coming up with totally bogus solutions that cannot work, we won't have a useful suspend (either to RAM or to disk) in linux.
Ben.
Quoted 11 lines · Alan Stern
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 2 lines
Quoted 2 lines
And guess what ? It's what we do on powerbooks, and it works fine, without a freezer :-)
If you remember, one of the things I've been advocating has always been that we should put on hold all plug activity (unplug might be alright as long as the user events are just delayed) when we start suspending. No new devices, no new bindings. "hub" type devices are respondible for bringing in the new stuff after resume.
Quoted 3 lines
Which is exactly my point. It _doesn't_ work fine without a freezer, because the USB stack currently relies on the freezer to prevent plug activity.
Putting on hold plug activity has nothing, NOTHING, to do with the half assed piece of deadlocking crap we have now we call a freezer.
As long as you guys keep mixing up all the issues and coming up with totally bogus solutions that cannot work, we won't have a useful suspend (either to RAM or to disk) in linux.
Ben.