Skip to contentSkip to conversation

fs/proc: fix softlockup in __read_vmcore

PATCH Applied Rik van Riel 2 participants 4 messages May 7, 2024 – May 9, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/proc: fix softlockup in __read_vmcore

While taking a kernel core dump with makedumpfile on a larger system, softlockup messages often appear.

While softlockup warnings can be harmless, they can also interfere with things like RCU freeing memory, which can be problematic when the kdump kexec image is configured with as little memory as possible.

Avoid the softlockup, and give things like work items and RCU a chance to do their thing during __read_vmcore by adding a cond_resched.

---
 fs/proc/vmcore.c | 2 ++
 1 file changed, 2 insertions(+)
fs/proc/vmcore.c +2 -0
index 1fb213f379a5..d06607a1f137 100644
@@ -383,6 +383,8 @@ static ssize_t __read_vmcore(struct iov_iter *iter, loff_t *fpos)
 		/* leave now if filled buffer already */
 		if (!iov_iter_count(iter))
 			return acc;
+
+		cond_resched();
 	}
 
 	list_for_each_entry(m, &vmcore_list, list) {
Signature · 1 line
2.42.0
#1 lore raw

Hi,

Quoted 9 lines · Rik van Riel

While taking a kernel core dump with makedumpfile on a larger system, softlockup messages often appear.

While softlockup warnings can be harmless, they can also interfere with things like RCU freeing memory, which can be problematic when the kdump kexec image is configured with as little memory as possible.

Avoid the softlockup, and give things like work items and RCU a chance to do their thing during __read_vmcore by adding a cond_resched.

Thanks for fixing this.

By the way, is it easy to reproduce? And should we add some trace of the softlockup into log so that people can search for it and confirm when encountering it?

Thanks
Baoquan

Quoted 27 lines
---
 fs/proc/vmcore.c | 2 ++
 1 file changed, 2 insertions(+)
fs/proc/vmcore.c +2 -0
index 1fb213f379a5..d06607a1f137 100644
@@ -383,6 +383,8 @@ static ssize_t __read_vmcore(struct iov_iter *iter, loff_t *fpos)
 		/* leave now if filled buffer already */
 		if (!iov_iter_count(iter))
 			return acc;
+
+		cond_resched();
 	}
 
 	list_for_each_entry(m, &vmcore_list, list) {
Signature · 8 lines
2.42.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw
Quoted 16 lines · Baoquan He

Hi,

Quoted 4 lines · Rik van Riel

While taking a kernel core dump with makedumpfile on a larger system,
softlockup messages often appear.

Quoted 8 lines

While softlockup warnings can be harmless, they can also interfere with things like RCU freeing memory, which can be problematic when the kdump kexec image is configured with as little memory as possible.

Avoid the softlockup, and give things like work items and RCU a chance to do their thing during __read_vmcore by adding a cond_resched.

Quoted 6 lines

Thanks for fixing this.

By the way, is it easy to reproduce? And should we add some trace of the
softlockup into log so that people can search for it and confirm when encountering it?

It is pretty easy to reproduce, but it does not happen all the time. With millions of systems, even rare errors are common :)

However, we have been running with this fix for long enough (we deployed it in order to test it) that I don't think we have the warning stored any more. Those logs were rotated out long ago.

kind regards,

Rik

Signature · 1 line
All Rights Reversed.
Acked-by
#3 lore raw
Quoted 24 lines · Rik van Riel
Quoted 16 lines · Baoquan He

Hi,

Quoted 4 lines · Rik van Riel

While taking a kernel core dump with makedumpfile on a larger system,
softlockup messages often appear.

Quoted 8 lines

While softlockup warnings can be harmless, they can also interfere with things like RCU freeing memory, which can be problematic when the kdump kexec image is configured with as little memory as possible.

Avoid the softlockup, and give things like work items and RCU a chance to do their thing during __read_vmcore by adding a cond_resched.

Quoted 6 lines

Thanks for fixing this.

By the way, is it easy to reproduce? And should we add some trace of the
softlockup into log so that people can search for it and confirm when encountering it?

Quoted 6 lines

It is pretty easy to reproduce, but it does not happen all the time. With millions of systems, even rare errors are common :)

However, we have been running with this fix for long enough (we deployed it in order to test it) that I don't think we have the warning stored any more. Those logs were rotated out long ago.

OK, thanks for the explanation.