swsusp userland interface: additional ioctl
Subsystems (2)
RFC PATCH 1/1 swsusp userland interface: additional ioctl
Hi,
The appended patch provides an additional ioctl() for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).
Comments welcome.
Greetings,
Rafael
kernel/power/console.c | 5 +++-- kernel/power/power.h | 6 +++++- kernel/power/user.c | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-)
kernel/power/console.c +3 -2
@@ -9,7 +9,8 @@#include <linux/console.h> #include "power.h" -static int new_loglevel =10 ; +int suspend_loglevel =DEFAULT_SUSPEND_LOGLEVEL ; +static int orig_loglevel;#ifdef SUSPEND_CONSOLE static int orig_fgconsole, orig_kmsg;
@@ -18,7 +19,7 @@ static int orig_fgconsole, orig_kmsg;int pm_prepare_console (void ) { orig_loglevel = console_loglevel; - console_loglevel = new_loglevel; + console_loglevel = suspend_loglevel;#ifdef SUSPEND_CONSOLE acquire_console_sem ();
kernel/power/power.h +5 -1
@@ -55,6 +55,9 @@ extern struct pbe *pagedir_nosave;extern unsigned long image_size;extern int in_suspend;extern dev_t swsusp_resume_device; +extern int suspend_loglevel; + +#define DEFAULT_SUSPEND_LOGLEVEL 10 extern asmlinkage int swsusp_arch_suspend(void); extern asmlinkage int swsusp_arch_resume(void);
@@ -88,7 +91,8 @@ int snapshot_image_loaded(struct snapsho#define SNAPSHOT_GET_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 8, void *)#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)#define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int) -#define SNAPSHOT_IOC_MAXNR 10 +#define SNAPSHOT_SET_LOGLEVEL _IOW(SNAPSHOT_IOC_MAGIC, 11, int) +#define SNAPSHOT_IOC_MAXNR 11/** * The bitmap is used for tracing allocated swap pages
kernel/power/user.c +5 -0
@@ -78,6 +78,7 @@ static int snapshot_release(struct inodeenable_nonboot_cpus ();up (&pm_sem); } + suspend_loglevel =DEFAULT_SUSPEND_LOGLEVEL ;atomic_inc (&device_available);return 0 ; }
@@ -264,6 +265,10 @@ static int snapshot_ioctl(struct inode * }break ; +case SNAPSHOT_SET_LOGLEVEL : + suspend_loglevel = arg <=10 ? arg :DEFAULT_SUSPEND_LOGLEVEL ; +break ; +default : error = -ENOTTY ;
Hi!
Quoted 4 lines
The appended patch provides an additional
ioctl()for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).
klogd can already change loglevel... It should be possible to use that to silence suspend, no?
Pavel
Signature · 1 line
Thanks, Sharp!
Hi,
Quoted 7 lines · Pavel Machek
Quoted 4 lines
The appended patch provides an additional
ioctl()for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).klogd can already change loglevel... It should be possible to use that to silence suspend, no?
Well, no. Currently the kernel changes the log level to 10 unconditionally in pm_prepare_console() (that's the reason for the patch, BTW).
Rafael
Hi!
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
The appended patch provides an additional
ioctl()for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).klogd can already change loglevel... It should be possible to use that to silence suspend, no?
Well, no. Currently the kernel changes the log level to 10 unconditionally in
pm_prepare_console()(that's the reason for the patch, BTW).
Can we just kill that log-level setting? It may have been useful in the past, but I do not think it has right to live any more.
Pavel
Signature · 1 line
Thanks, Sharp!
Quoted 7 lines · Pavel Machek
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
The appended patch provides an additional
ioctl()for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
klogd can already change loglevel... It should be possible to use that to silence suspend, no?
Well, no. Currently the kernel changes the log level to 10 unconditionally in
pm_prepare_console()(that's the reason for the patch, BTW).Can we just kill that log-level setting? It may have been useful in the past, but I do not think it has right to live any more.
Yes, change that, don't create another interface to the kernel where there is already one.
thanks,
greg k-h
Hi,
Quoted 5 lines · Pavel Machek
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
The appended patch provides an additional
ioctl()for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
klogd can already change loglevel... It should be possible to use that to silence suspend, no?
Well, no. Currently the kernel changes the log level to 10 unconditionally in
pm_prepare_console()(that's the reason for the patch, BTW).Can we just kill that log-level setting? It may have been useful in the past, but I do not think it has right to live any more.
Sure, we can:
kernel/power/console.c | 12 +----------- kernel/power/power.h | 5 +++++ 2 files changed, 6 insertions(+), 11 deletions(-)
kernel/power/console.c +1 -11
@@ -9,18 +9,11 @@#include <linux/console.h> #include "power.h" -static int new_loglevel =10 ; -static int orig_loglevel;#ifdef SUSPEND_CONSOLE static int orig_fgconsole, orig_kmsg; -#endif int pm_prepare_console (void ) { - orig_loglevel = console_loglevel; - console_loglevel = new_loglevel; - -#ifdef SUSPEND_CONSOLE acquire_console_sem (); orig_fgconsole = fg_console;
@@ -41,18 +34,15 @@ int pm_prepare_console(void) } orig_kmsg = kmsg_redirect; kmsg_redirect =SUSPEND_CONSOLE ; -#endif return 0 ; }void pm_restore_console (void ) { - console_loglevel = orig_loglevel; -#ifdef SUSPEND_CONSOLE acquire_console_sem ();set_console (orig_fgconsole);release_console_sem (); kmsg_redirect = orig_kmsg; -#endif return ; } +#endif
kernel/power/power.h +5 -0
@@ -43,8 +43,13 @@ static struct subsys_attribute _name##_aextern struct subsystem power_subsys; +#ifdef SUSPEND_CONSOLE extern int pm_prepare_console (void );extern void pm_restore_console (void ); +#else +static int pm_prepare_console (void ) {return 0 ; } +static void pm_restore_console (void ) {} +#endif /* References to section boundaries */ extern const void __nosave_begin, __nosave_end;
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
The appended patch provides an additional
ioctl()for the swsusp userland interface that will allow the suspending and/or resuming utilities to change the kernel log level at the time of suspend/resume (or even set it to 0 if they are going to use some frame buffer graphics etc.).klogd can already change loglevel... It should be possible to use that to silence suspend, no?
Well, no. Currently the kernel changes the log level to 10 unconditionally in
pm_prepare_console()(that's the reason for the patch, BTW).
Quoted 6 lines
Quoted 2 lines
Can we just kill that log-level setting? It may have been useful in the past, but I do not think it has right to live any more.
Sure, we can:
Signed-off-by Rafael J. Wysocki <[email protected]>
ACK and thanks. Patches that remve code are always good.
Pavel
Signature · 1 line
Thanks, Sharp!