public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* KPROBE linking error (who's the maintainer of kernel/power/) ?
@ 2009-01-05  7:12 Cheng Renquan (程任全)
  2009-01-05 13:16 ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Cheng Renquan (程任全) @ 2009-01-05  7:12 UTC (permalink / raw)
  To: Arjan van de Ven, Al Viro, Matt Helsley, Andrew Morton,
	Linus Torvalds, Adrian Bunk, Ananth N Mavinakayanahalli,
	anil.s.keshavamurthy, davem, mhiramat
  Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1891 bytes --]

with this .config
CONFIG_CGROUPS=yCONFIG_CGROUP_FREEZER=yCONFIG_MODULES=yCONFIG_FREEZER=yCONFIG_PM=yCONFIG_PM_SLEEP=n
the kernel will end compiling with error:
kernel/built-in.o: In function `check_safety':/usr/src/linux-2.6.28/kernel/kprobes.c:126: undefined reference to`freeze_processes'/usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference to`thaw_processes'/usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference to`thaw_processes'make: *** [.tmp_vmlinux1] Error 1
By read kernel/kprobes.c, I found there maybe a bug:
1. "check_safety" in "kernel/kprobes.c" call thaw_processes if bothCONFIG_PREEMPT and CONFIG_PM defined,2. "thaw_processes" function is implemented in "kernel/power/process.c",3. but it is only used if CONFIG_FREEZER defined, from <linux/freezer.h>,4. else (CONFIG_FREEZER undefined) it's a null macro defined in<linux/freezer.h>,5. but process.o only get compile if CONFIG_PM_SLEEP defined, from"kernel/power/Makefile",
Now I'm confused on how to resolve this?What's the relation of PM, PM_SLEEP, and FREEZER?Which modification of the following will be better?1. modify kernel/Kconfig, let KPROBES depends more?2. modify kernel/kprobes.c, let the conditional compile depends more?3. modify include/linux/freezer.h, move thaw_processes to include/linux/pm.h?4. modify kernel/power/Makefile, let kernel/power/process.c compile onless condition?
Furthermore, there seems no entry for maintainers of "kernel/power/",who maintain that subdir please add your name to the MAINTAINERS file?I just grab some latest touchers of kernel/power/ and kernel/kprobes.cas the recipients here.
-- Cheng Renquan (程任全), Shenzhen, ChinaEddie Izzard  - "I grew up in Europe, where the history comes from."ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KPROBE linking error (who's the maintainer of kernel/power/) ?
  2009-01-05  7:12 KPROBE linking error (who's the maintainer of kernel/power/) ? Cheng Renquan (程任全)
@ 2009-01-05 13:16 ` Rafael J. Wysocki
  2009-01-05 16:55   ` Cheng Renquan (程任全)
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2009-01-05 13:16 UTC (permalink / raw)
  To: Cheng Renquan (程任全)
  Cc: Arjan van de Ven, Al Viro, Matt Helsley, Andrew Morton,
	Linus Torvalds, Adrian Bunk, Ananth N Mavinakayanahalli,
	anil.s.keshavamurthy, davem, mhiramat, linux-kernel, Pavel Machek

Hi,

On Monday 05 January 2009, Cheng Renquan (程任全) wrote:
> with this .config
> 
> CONFIG_CGROUPS=y
> CONFIG_CGROUP_FREEZER=y
> CONFIG_MODULES=y
> CONFIG_FREEZER=y
> CONFIG_PM=y
> CONFIG_PM_SLEEP=n
> 
> the kernel will end compiling with error:
> 
> kernel/built-in.o: In function `check_safety':
> /usr/src/linux-2.6.28/kernel/kprobes.c:126: undefined reference to
> `freeze_processes'
> /usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference to
> `thaw_processes'
> /usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference to
> `thaw_processes'
> make: *** [.tmp_vmlinux1] Error 1

So there is a bug, thanks for the report.

> By read kernel/kprobes.c, I found there maybe a bug:
> 
> 1. "check_safety" in "kernel/kprobes.c" call thaw_processes if both
> CONFIG_PREEMPT and CONFIG_PM defined,
> 2. "thaw_processes" function is implemented in "kernel/power/process.c",
> 3. but it is only used if CONFIG_FREEZER defined, from <linux/freezer.h>,
> 4. else (CONFIG_FREEZER undefined) it's a null macro defined in
> <linux/freezer.h>,
> 5. but process.o only get compile if CONFIG_PM_SLEEP defined, from
> "kernel/power/Makefile",
> 
> Now I'm confused on how to resolve this?

I'd make process.o depend on CONFIG_FREEZER (patch below).

> What's the relation of PM, PM_SLEEP, and FREEZER?

PM_SLEEP depends on PM and FREEZER is defined in kernel/Kconfig.freezer as

config FREEZER
        def_bool PM_SLEEP || CGROUP_FREEZER

> Which modification of the following will be better?
> 1. modify kernel/Kconfig, let KPROBES depends more?
> 2. modify kernel/kprobes.c, let the conditional compile depends more?
> 3. modify include/linux/freezer.h, move thaw_processes to include/linux/pm.h?
> 4. modify kernel/power/Makefile, let kernel/power/process.c compile on
> less condition?
> 
> Furthermore, there seems no entry for maintainers of "kernel/power/",
> who maintain that subdir please add your name to the MAINTAINERS file?
> I just grab some latest touchers of kernel/power/ and kernel/kprobes.c
> as the recipients here.

I'm one of the maintainers.

Thanks,
Rafael

---
Subject: PM: Fix freezer compilation if PM_SLEEP is unset
From: Rafael J. Wysocki <rjw@sisk.pl>

Freezer fails to compile if with the following configuration
settings:

CONFIG_CGROUPS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_MODULES=y
CONFIG_FREEZER=y
CONFIG_PM=y
CONFIG_PM_SLEEP=n

Fix this by making process.o compilation depend on CONFIG_FREEZER.

Reported-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 kernel/power/Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/kernel/power/Makefile
===================================================================
--- linux-2.6.orig/kernel/power/Makefile
+++ linux-2.6/kernel/power/Makefile
@@ -4,7 +4,8 @@ EXTRA_CFLAGS	+=	-DDEBUG
 endif
 
 obj-y				:= main.o
-obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
+obj-$(CONFIG_PM_SLEEP)		+= console.o
+obj-$(CONFIG_FREEZER)		+= process.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KPROBE linking error (who's the maintainer of kernel/power/) ?
  2009-01-05 13:16 ` Rafael J. Wysocki
@ 2009-01-05 16:55   ` Cheng Renquan (程任全)
  2009-01-05 19:51     ` Rafael J. Wysocki
  2009-01-05 22:11   ` [PATCH] kprobes: check CONFIG_FREEZER instead of CONFIG_PM Masami Hiramatsu
  2009-01-06  8:48   ` KPROBE linking error (who's the maintainer of kernel/power/) ? Pavel Machek
  2 siblings, 1 reply; 6+ messages in thread
From: Cheng Renquan (程任全) @ 2009-01-05 16:55 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Arjan van de Ven, Al Viro, Matt Helsley, Andrew Morton,
	Linus Torvalds, Adrian Bunk, Ananth N Mavinakayanahalli,
	anil.s.keshavamurthy, davem, mhiramat, linux-kernel, Pavel Machek,
	linux-pm

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 882 bytes --]

On Mon, Jan 5, 2009 at 9:16 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:>> Furthermore, there seems no entry for maintainers of "kernel/power/",>> who maintain that subdir please add your name to the MAINTAINERS file?>> I just grab some latest touchers of kernel/power/ and kernel/kprobes.c>> as the recipients here.>> I'm one of the maintainers.
I found that linux-pm@lists.linux-foundation.org by searching youremail in the MAINTAINERS file, in the section of "SUSPEND TO RAM" and"HIBERNATION", both not very apparently related to kernel/power/,maybe my careless, maybe we can improve it?
>> Thanks,> Rafael

-- Cheng Renquan (程任全), Shenzhen, ChinaEddie Izzard  - "I grew up in Europe, where the history comes from."ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KPROBE linking error (who's the maintainer of kernel/power/) ?
  2009-01-05 16:55   ` Cheng Renquan (程任全)
@ 2009-01-05 19:51     ` Rafael J. Wysocki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2009-01-05 19:51 UTC (permalink / raw)
  To: Cheng Renquan (程任全)
  Cc: Arjan van de Ven, Al Viro, Matt Helsley, Andrew Morton,
	Linus Torvalds, Adrian Bunk, Ananth N Mavinakayanahalli,
	anil.s.keshavamurthy, davem, mhiramat, linux-kernel, Pavel Machek,
	linux-pm

On Monday 05 January 2009, Cheng Renquan (程任全) wrote:
> On Mon, Jan 5, 2009 at 9:16 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> >> Furthermore, there seems no entry for maintainers of "kernel/power/",
> >> who maintain that subdir please add your name to the MAINTAINERS file?
> >> I just grab some latest touchers of kernel/power/ and kernel/kprobes.c
> >> as the recipients here.
> >
> > I'm one of the maintainers.
> 
> I found that linux-pm@lists.linux-foundation.org by searching your
> email in the MAINTAINERS file, in the section of "SUSPEND TO RAM" and
> "HIBERNATION", both not very apparently related to kernel/power/,
> maybe my careless, maybe we can improve it?

Well, kernel/power is mostly about hibernation and suspend to RAM, the freezer
is the only "other" thing.  It used to be suspend/hibernation-specific, though.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] kprobes: check CONFIG_FREEZER instead of CONFIG_PM
  2009-01-05 13:16 ` Rafael J. Wysocki
  2009-01-05 16:55   ` Cheng Renquan (程任全)
@ 2009-01-05 22:11   ` Masami Hiramatsu
  2009-01-06  8:48   ` KPROBE linking error (who's the maintainer of kernel/power/) ? Pavel Machek
  2 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2009-01-05 22:11 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andrew Morton, Ananth N Mavinakayanahalli
  Cc: "Cheng Renquan (程任全)",
	Arjan van de Ven, Al Viro, Matt Helsley, Linus Torvalds,
	Adrian Bunk, anil.s.keshavamurthy, davem, linux-kernel,
	Pavel Machek

Hi,

Rafael J. Wysocki wrote:
> On Monday 05 January 2009, Cheng Renquan (程任全) wrote:
>> 1. "check_safety" in "kernel/kprobes.c" call thaw_processes if both
>> CONFIG_PREEMPT and CONFIG_PM defined,
>> 2. "thaw_processes" function is implemented in "kernel/power/process.c",
>> 3. but it is only used if CONFIG_FREEZER defined, from <linux/freezer.h>,
>> 4. else (CONFIG_FREEZER undefined) it's a null macro defined in
>> <linux/freezer.h>,
>> 5. but process.o only get compile if CONFIG_PM_SLEEP defined, from
>> "kernel/power/Makefile",
>>
>> Now I'm confused on how to resolve this?
> 
> I'd make process.o depend on CONFIG_FREEZER (patch below).

Thank you for fixing.
In addition, I think that kprobes also should check CONFIG_FREEZER
instead of CONFIG_PM.
---
From: Masami Hiramatsu <mhiramat@redhat.com>

Check CONFIG_FREEZER instead of CONFIG_PM because kprobe booster
depends on freeze_processes() and thaw_processes() when CONFIG_PREEMPT=y.

This fixes a linkage error which occurs when CONFIG_PREEMPT=y, CONFIG_PM=y
and CONFIG_FREEZER=n.

Reported-by: Cheng Renquan <crquan@gmail.com>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
---
 arch/ia64/kernel/kprobes.c |    2 +-
 arch/x86/kernel/kprobes.c  |    2 +-
 kernel/kprobes.c           |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Index: 2.6.28/arch/ia64/kernel/kprobes.c
===================================================================
--- 2.6.28.orig/arch/ia64/kernel/kprobes.c
+++ 2.6.28/arch/ia64/kernel/kprobes.c
@@ -868,7 +868,7 @@ static int __kprobes pre_kprobes_handler
 		return 1;

 ss_probe:
-#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PM)
+#if !defined(CONFIG_PREEMPT) || defined(CONFIG_FREEZER)
 	if (p->ainsn.inst_flag == INST_FLAG_BOOSTABLE && !p->post_handler) {
 		/* Boost up -- we can execute copied instructions directly */
 		ia64_psr(regs)->ri = p->ainsn.slot;
Index: 2.6.28/arch/x86/kernel/kprobes.c
===================================================================
--- 2.6.28.orig/arch/x86/kernel/kprobes.c
+++ 2.6.28/arch/x86/kernel/kprobes.c
@@ -445,7 +445,7 @@ void __kprobes arch_prepare_kretprobe(st
 static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
 				       struct kprobe_ctlblk *kcb)
 {
-#if !defined(CONFIG_PREEMPT) || defined(CONFIG_PM)
+#if !defined(CONFIG_PREEMPT) || defined(CONFIG_FREEZER)
 	if (p->ainsn.boostable == 1 && !p->post_handler) {
 		/* Boost up -- we can execute copied instructions directly */
 		reset_current_kprobe();
Index: 2.6.28/kernel/kprobes.c
===================================================================
--- 2.6.28.orig/kernel/kprobes.c
+++ 2.6.28/kernel/kprobes.c
@@ -122,7 +122,7 @@ static int collect_garbage_slots(void);
 static int __kprobes check_safety(void)
 {
 	int ret = 0;
-#if defined(CONFIG_PREEMPT) && defined(CONFIG_PM)
+#if defined(CONFIG_PREEMPT) && defined(CONFIG_FREEZER)
 	ret = freeze_processes();
 	if (ret == 0) {
 		struct task_struct *p, *q;



-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: KPROBE linking error (who's the maintainer of kernel/power/) ?
  2009-01-05 13:16 ` Rafael J. Wysocki
  2009-01-05 16:55   ` Cheng Renquan (程任全)
  2009-01-05 22:11   ` [PATCH] kprobes: check CONFIG_FREEZER instead of CONFIG_PM Masami Hiramatsu
@ 2009-01-06  8:48   ` Pavel Machek
  2 siblings, 0 replies; 6+ messages in thread
From: Pavel Machek @ 2009-01-06  8:48 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Cheng Renquan (?????????), Arjan van de Ven, Al Viro,
	Matt Helsley, Andrew Morton, Linus Torvalds, Adrian Bunk,
	Ananth N Mavinakayanahalli, anil.s.keshavamurthy, davem, mhiramat,
	linux-kernel

> Hi,
> 
> On Monday 05 January 2009, Cheng Renquan (?????????) wrote:
> > with this .config
> > 
> > CONFIG_CGROUPS=y
> > CONFIG_CGROUP_FREEZER=y
> > CONFIG_MODULES=y
> > CONFIG_FREEZER=y
> > CONFIG_PM=y
> > CONFIG_PM_SLEEP=n
> > 
> > the kernel will end compiling with error:
> > 
> > kernel/built-in.o: In function `check_safety':
> > /usr/src/linux-2.6.28/kernel/kprobes.c:126: undefined reference to
> > `freeze_processes'
> > /usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference to
> > `thaw_processes'
> > /usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference to
> > `thaw_processes'
> > make: *** [.tmp_vmlinux1] Error 1
> 
> So there is a bug, thanks for the report.
> 
> > By read kernel/kprobes.c, I found there maybe a bug:
> > 
> > 1. "check_safety" in "kernel/kprobes.c" call thaw_processes if both
> > CONFIG_PREEMPT and CONFIG_PM defined,
> > 2. "thaw_processes" function is implemented in "kernel/power/process.c",
> > 3. but it is only used if CONFIG_FREEZER defined, from <linux/freezer.h>,
> > 4. else (CONFIG_FREEZER undefined) it's a null macro defined in
> > <linux/freezer.h>,
> > 5. but process.o only get compile if CONFIG_PM_SLEEP defined, from
> > "kernel/power/Makefile",
> > 
> > Now I'm confused on how to resolve this?
> 
> I'd make process.o depend on CONFIG_FREEZER (patch below).
> 
> > What's the relation of PM, PM_SLEEP, and FREEZER?
> 
> PM_SLEEP depends on PM and FREEZER is defined in kernel/Kconfig.freezer as
> 
> config FREEZER
>         def_bool PM_SLEEP || CGROUP_FREEZER
> 
> > Which modification of the following will be better?
> > 1. modify kernel/Kconfig, let KPROBES depends more?
> > 2. modify kernel/kprobes.c, let the conditional compile depends more?
> > 3. modify include/linux/freezer.h, move thaw_processes to include/linux/pm.h?
> > 4. modify kernel/power/Makefile, let kernel/power/process.c compile on
> > less condition?
> > 
> > Furthermore, there seems no entry for maintainers of "kernel/power/",
> > who maintain that subdir please add your name to the MAINTAINERS file?
> > I just grab some latest touchers of kernel/power/ and kernel/kprobes.c
> > as the recipients here.
> 
> I'm one of the maintainers.
> 
> Thanks,
> Rafael
> 
> ---
> Subject: PM: Fix freezer compilation if PM_SLEEP is unset
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Freezer fails to compile if with the following configuration
> settings:
> 
> CONFIG_CGROUPS=y
> CONFIG_CGROUP_FREEZER=y
> CONFIG_MODULES=y
> CONFIG_FREEZER=y
> CONFIG_PM=y
> CONFIG_PM_SLEEP=n
> 
> Fix this by making process.o compilation depend on CONFIG_FREEZER.
> 
> Reported-by: Cheng Renquan <crquan@gmail.com>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Acked-by: Pavel Machek <pavel@suse.cz>

> ---
>  kernel/power/Makefile |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/kernel/power/Makefile
> ===================================================================
> --- linux-2.6.orig/kernel/power/Makefile
> +++ linux-2.6/kernel/power/Makefile
> @@ -4,7 +4,8 @@ EXTRA_CFLAGS	+=	-DDEBUG
>  endif
>  
>  obj-y				:= main.o
> -obj-$(CONFIG_PM_SLEEP)		+= process.o console.o
> +obj-$(CONFIG_PM_SLEEP)		+= console.o
> +obj-$(CONFIG_FREEZER)		+= process.o
>  obj-$(CONFIG_HIBERNATION)	+= swsusp.o disk.o snapshot.o swap.o user.o
>  
>  obj-$(CONFIG_MAGIC_SYSRQ)	+= poweroff.o
> 
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-06  8:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05  7:12 KPROBE linking error (who's the maintainer of kernel/power/) ? Cheng Renquan (程任全)
2009-01-05 13:16 ` Rafael J. Wysocki
2009-01-05 16:55   ` Cheng Renquan (程任全)
2009-01-05 19:51     ` Rafael J. Wysocki
2009-01-05 22:11   ` [PATCH] kprobes: check CONFIG_FREEZER instead of CONFIG_PM Masami Hiramatsu
2009-01-06  8:48   ` KPROBE linking error (who's the maintainer of kernel/power/) ? Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox