* [RFC][PATCH -mm] swsusp userland interface: additional ioctl
@ 2006-01-29 21:56 Rafael J. Wysocki
2006-01-29 21:57 ` Pavel Machek
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2006-01-29 21:56 UTC (permalink / raw)
To: Pavel Machek; +Cc: Linux PM
[-- Attachment #1: Type: text/plain, Size: 3082 bytes --]
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
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/power/console.c | 5 +++--
kernel/power/power.h | 6 +++++-
kernel/power/user.c | 5 +++++
3 files changed, 13 insertions(+), 3 deletions(-)
Index: linux-2.6.16-rc1-mm3/kernel/power/console.c
===================================================================
--- linux-2.6.16-rc1-mm3.orig/kernel/power/console.c 2006-01-15 12:42:27.000000000 +0100
+++ linux-2.6.16-rc1-mm3/kernel/power/console.c 2006-01-29 21:24:48.000000000 +0100
@@ -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();
Index: linux-2.6.16-rc1-mm3/kernel/power/power.h
===================================================================
--- linux-2.6.16-rc1-mm3.orig/kernel/power/power.h 2006-01-25 21:21:13.000000000 +0100
+++ linux-2.6.16-rc1-mm3/kernel/power/power.h 2006-01-29 21:24:58.000000000 +0100
@@ -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
Index: linux-2.6.16-rc1-mm3/kernel/power/user.c
===================================================================
--- linux-2.6.16-rc1-mm3.orig/kernel/power/user.c 2006-01-25 21:53:52.000000000 +0100
+++ linux-2.6.16-rc1-mm3/kernel/power/user.c 2006-01-29 21:24:48.000000000 +0100
@@ -78,6 +78,7 @@ static int snapshot_release(struct inode
enable_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;
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl
2006-01-29 21:56 [RFC][PATCH -mm] swsusp userland interface: additional ioctl Rafael J. Wysocki
@ 2006-01-29 21:57 ` Pavel Machek
2006-01-29 22:46 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Pavel Machek @ 2006-01-29 21:57 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
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.).
klogd can already change loglevel... It should be possible to use that
to silence suspend, no?
Pavel
--
Thanks, Sharp!
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl
2006-01-29 21:57 ` Pavel Machek
@ 2006-01-29 22:46 ` Rafael J. Wysocki
2006-01-29 23:06 ` Pavel Machek
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2006-01-29 22:46 UTC (permalink / raw)
To: Pavel Machek; +Cc: Linux PM
Hi,
On Sunday 29 January 2006 22:57, Pavel Machek wrote:
> > 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl
2006-01-29 22:46 ` Rafael J. Wysocki
@ 2006-01-29 23:06 ` Pavel Machek
2006-01-30 4:54 ` Greg KH
2006-01-30 21:15 ` Rafael J. Wysocki
0 siblings, 2 replies; 7+ messages in thread
From: Pavel Machek @ 2006-01-29 23:06 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM
[-- Attachment #1: Type: text/plain, Size: 728 bytes --]
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.).
> >
> > 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
--
Thanks, Sharp!
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl
2006-01-29 23:06 ` Pavel Machek
@ 2006-01-30 4:54 ` Greg KH
2006-01-30 21:15 ` Rafael J. Wysocki
1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2006-01-30 4:54 UTC (permalink / raw)
To: Pavel Machek; +Cc: Linux PM
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
On Mon, Jan 30, 2006 at 12:06:47AM +0100, Pavel Machek wrote:
> 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.).
> > >
> > > 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
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl
2006-01-29 23:06 ` Pavel Machek
2006-01-30 4:54 ` Greg KH
@ 2006-01-30 21:15 ` Rafael J. Wysocki
2006-01-30 21:59 ` Pavel Machek
1 sibling, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2006-01-30 21:15 UTC (permalink / raw)
To: Pavel Machek; +Cc: Linux PM
Hi,
On Monday 30 January 2006 00:06, Pavel Machek wrote:
> > > > 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.
Sure, we can:
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/power/console.c | 12 +-----------
kernel/power/power.h | 5 +++++
2 files changed, 6 insertions(+), 11 deletions(-)
Index: linux-2.6.16-rc1-mm4/kernel/power/console.c
===================================================================
--- linux-2.6.16-rc1-mm4.orig/kernel/power/console.c 2006-01-30 21:17:53.000000000 +0100
+++ linux-2.6.16-rc1-mm4/kernel/power/console.c 2006-01-30 21:32:24.000000000 +0100
@@ -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
Index: linux-2.6.16-rc1-mm4/kernel/power/power.h
===================================================================
--- linux-2.6.16-rc1-mm4.orig/kernel/power/power.h 2006-01-30 21:19:43.000000000 +0100
+++ linux-2.6.16-rc1-mm4/kernel/power/power.h 2006-01-30 21:33:19.000000000 +0100
@@ -43,8 +43,13 @@ static struct subsys_attribute _name##_a
extern 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;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl
2006-01-30 21:15 ` Rafael J. Wysocki
@ 2006-01-30 21:59 ` Pavel Machek
0 siblings, 0 replies; 7+ messages in thread
From: Pavel Machek @ 2006-01-30 21:59 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM
[-- Attachment #1: Type: text/plain, Size: 909 bytes --]
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.).
> > > >
> > > > 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:
>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
ACK and thanks. Patches that remve code are always good.
Pavel
--
Thanks, Sharp!
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-01-30 21:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-29 21:56 [RFC][PATCH -mm] swsusp userland interface: additional ioctl Rafael J. Wysocki
2006-01-29 21:57 ` Pavel Machek
2006-01-29 22:46 ` Rafael J. Wysocki
2006-01-29 23:06 ` Pavel Machek
2006-01-30 4:54 ` Greg KH
2006-01-30 21:15 ` Rafael J. Wysocki
2006-01-30 21:59 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox