Re: [systemd-devel] [PATCH] cgtop: useful error messages when bootup fails
On Fri, 25.05.12 16:34, shawn (shawnland...@gmail.com) wrote: On Tue, 2012-05-22 at 13:12 +0200, Lennart Poettering wrote: Hmm, this is misleading. THis has little to do with being ready, as the cgroup VFS are mounted synchronously very early in PID 1 and it is basically very hard to run in parallel with that. So this check actually would check for something different: whether the system was booted with systemd at all, and whether the respective cgroup controller has been enabled in the kernel at all. But for the former an excplicit early check for sd_booted() would probably a nicer choice (though I must say I shiver at the idea that we add this to all our tools). And for the latter we should probably fix things so that the tool works fine even if cpuacct, memory and blkio (or any subset of them are not available), after all those controllers should be optional. How did you start cgtop so that you ran into this problem? Lennart Amazingly enough, cgtop works just fine if we just silently ignore the missing ones here. Patch looks good! Applied. Lennart -- Lennart Poettering - Red Hat, Inc. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] cgtop: useful error messages when bootup fails
On Tue, 2012-05-22 at 13:12 +0200, Lennart Poettering wrote: Hmm, this is misleading. THis has little to do with being ready, as the cgroup VFS are mounted synchronously very early in PID 1 and it is basically very hard to run in parallel with that. So this check actually would check for something different: whether the system was booted with systemd at all, and whether the respective cgroup controller has been enabled in the kernel at all. But for the former an excplicit early check for sd_booted() would probably a nicer choice (though I must say I shiver at the idea that we add this to all our tools). And for the latter we should probably fix things so that the tool works fine even if cpuacct, memory and blkio (or any subset of them are not available), after all those controllers should be optional. How did you start cgtop so that you ran into this problem? Lennart Amazingly enough, cgtop works just fine if we just silently ignore the missing ones here. -- -Shawn Landden From f13e3be6ce9460016958f02877295fcfb2f1abf3 Mon Sep 17 00:00:00 2001 From: Shawn Landden shawnland...@gmail.com Date: Mon, 21 May 2012 22:54:41 -0700 Subject: [PATCH] cgtop: work even if not all cgroups are available cgtop quits on startup if all the cgroup mounts it expects are not available. Just continue without nonexistant ones. --- src/cgtop/cgtop.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index ddb5709..f988adb 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -341,17 +341,22 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned iteration) { r = refresh_one(name=systemd, /, a, b, iteration, 0); if (r 0) -return r; - +if (r != -ENOENT) +return r; r = refresh_one(cpuacct, /, a, b, iteration, 0); if (r 0) -return r; - +if (r != -ENOENT) +return r; r = refresh_one(memory, /, a, b, iteration, 0); if (r 0) -return r; +if (r != -ENOENT) +return r; -return refresh_one(blkio, /, a, b, iteration, 0); +r = refresh_one(blkio, /, a, b, iteration, 0); +if (r 0) +if (r != -ENOENT) +return r; +return 0; } static int group_compare(const void*a, const void *b) { -- 1.7.9.5 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] cgtop: useful error messages when bootup fails
Uggh, sorry for sending that super-buggy patch. Here is a better version. On Mon, 2012-05-21 at 22:59 -0700, Shawn Landden wrote: cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. From 33fa72fdbed3e82d9910e8ecf4b04502fe266ebf Mon Sep 17 00:00:00 2001 From: Shawn Landden shawnland...@gmail.com Date: Mon, 21 May 2012 22:54:41 -0700 Subject: [PATCH] cgtop: useful error messages when bootup fails cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. --- src/cgtop/cgtop.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index ddb5709..493687e 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -340,18 +340,30 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned iteration) { assert(a); r = refresh_one(name=systemd, /, a, b, iteration, 0); -if (r 0) +if (r 0) { +if (r == -ENOENT) +log_error(Is /sys/fs/cgroup/systemd mounted?: %s, strerror(-r)); return r; - +} r = refresh_one(cpuacct, /, a, b, iteration, 0); -if (r 0) +if (r 0) { +if (r == -ENOENT) +log_error(Is /sys/fs/cgroup/cpu,cpuacct mounted?: %s, strerror(-r)); return r; - +} r = refresh_one(memory, /, a, b, iteration, 0); if (r 0) +if (r == -ENOENT) +log_error(Is /sys/fs/cgroup/memory mounted?: %s, strerror(-r)); return r; -return refresh_one(blkio, /, a, b, iteration, 0); +r = refresh_one(blkio, /, a, b, iteration, 0); +if (r 0) { +if (r == -ENOENT) +log_error(Is /sys/fs/cgroup/blkio mounted?: %s, strerror(-r)); +return r; +} +return 0; } static int group_compare(const void*a, const void *b) { -- 1.7.9.5 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] cgtop: useful error messages when bootup fails
On Mon, 21.05.12 23:04, shawn (shawnland...@gmail.com) wrote: Heya, Uggh, sorry for sending that super-buggy patch. Here is a better version. On Mon, 2012-05-21 at 22:59 -0700, Shawn Landden wrote: cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. From 33fa72fdbed3e82d9910e8ecf4b04502fe266ebf Mon Sep 17 00:00:00 2001 From: Shawn Landden shawnland...@gmail.com Date: Mon, 21 May 2012 22:54:41 -0700 Subject: [PATCH] cgtop: useful error messages when bootup fails cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. Hmm, this is misleading. THis has little to do with being ready, as the cgroup VFS are mounted synchronously very early in PID 1 and it is basically very hard to run in parallel with that. So this check actually would check for something different: whether the system was booted with systemd at all, and whether the respective cgroup controller has been enabled in the kernel at all. But for the former an excplicit early check for sd_booted() would probably a nicer choice (though I must say I shiver at the idea that we add this to all our tools). And for the latter we should probably fix things so that the tool works fine even if cpuacct, memory and blkio (or any subset of them are not available), after all those controllers should be optional. How did you start cgtop so that you ran into this problem? Lennart -- Lennart Poettering - Red Hat, Inc. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] cgtop: useful error messages when bootup fails
On Tue, 2012-05-22 at 13:12 +0200, Lennart Poettering wrote: On Mon, 21.05.12 23:04, shawn (shawnland...@gmail.com) wrote: Heya, Uggh, sorry for sending that super-buggy patch. Here is a better version. On Mon, 2012-05-21 at 22:59 -0700, Shawn Landden wrote: cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. From 33fa72fdbed3e82d9910e8ecf4b04502fe266ebf Mon Sep 17 00:00:00 2001 From: Shawn Landden shawnland...@gmail.com Date: Mon, 21 May 2012 22:54:41 -0700 Subject: [PATCH] cgtop: useful error messages when bootup fails cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. Hmm, this is misleading. THis has little to do with being ready, as the cgroup VFS are mounted synchronously very early in PID 1 and it is basically very hard to run in parallel with that. So this check actually would check for something different: whether the system was booted with systemd at all, and whether the respective cgroup controller has been enabled in the kernel at all. But for the former an excplicit early check for sd_booted() would probably a nicer choice (though I must say I shiver at the idea that we add this to all our tools). And for the latter we should probably fix things so that the tool works fine even if cpuacct, memory and blkio (or any subset of them are not available), after all those controllers should be optional. 100% agree. How did you start cgtop so that you ran into this problem? On an armel system running systemd, but which doesn' have the memory (or blkid) cgroups sections, I presume because I didn't compile them in. (I'd rather not have the overhead of the memory one) I had to use strace to get any idea why it didn't work. I ran across a similar issue with nspawn before. Alot of these tools require specific kernel features, and why they fail correctly they don't really give useful error messages. Lennart -- -Shawn Landden ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] cgtop: useful error messages when bootup fails
cgtop quits on startup if all the cgroup mounts it expects are not ready. Provide user with some indication of why cgtop failed. --- src/cgtop/cgtop.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index ddb5709..381f399 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -341,14 +341,20 @@ static int refresh(Hashmap *a, Hashmap *b, unsigned iteration) { r = refresh_one(name=systemd, /, a, b, iteration, 0); if (r 0) +if (r == -ENOENT) +log_error(/sys/fs/cgroup/systemd not mounted: %s, strerror(-r)); return r; r = refresh_one(cpuacct, /, a, b, iteration, 0); if (r 0) +if (r == -ENOENT) +log_error(/sys/fs/cgroup/cpu,cpuacct not mounted: %s, strerror(-r)); return r; r = refresh_one(memory, /, a, b, iteration, 0); if (r 0) +if (r == -ENOENT) +log_error(/sys/fs/cgroup/memory not mounted: %s, strerror(-r)); return r; return refresh_one(blkio, /, a, b, iteration, 0); -- 1.7.9.5 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel