Skip to contentSkip to conversation

KPROBE linking error (who's the maintainer of kernel/power/) ?

PATCH New Cheng Renquan (程任全) 4 participants 8 messages Jan 5, 2009 – Jan 6, 2009

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

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 tofreeze_processes'/usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference tothaw_processes'/usr/src/linux-2.6.28/kernel/kprobes.c:139: undefined reference tothaw_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�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#1 lore raw

Hi,

Quoted 11 lines · Cheng Renquan (程任全)

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:

Quoted 8 lines

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.

Quoted 11 lines

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",

Quoted 1 line

Now I'm confused on how to resolve this?

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

Quoted 1 line

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
Quoted 11 lines

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 <[email protected]>

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.

---
 kernel/power/Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/power/Makefile +2 -1
Index: 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
#2 lore raw
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines

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 [email protected] 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?

Quoted 3 lines

Thanks,
Rafael

Signature · 6 lines
Cheng Renquan (程任全), Shenzhen, China
Eddie Izzard  - "I grew up in Europe, where the history comes from."
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
#3 lore raw
In reply to Rafael J. Wysocki

On Mon, Jan 5, 2009 at 9:16 PM, Rafael J. Wysocki <[email protected]> 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 [email protected] 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?

Quoted 1 line
Quoted 1 line

Thanks,> Rafael

-- Cheng Renquan (程任全), Shenzhen, ChinaEddie Izzard - "I grew up in Europe, where the history comes from."���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#4 lore raw
Quoted 6 lines · Cheng Renquan (程任全)
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines

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.

Quoted 6 lines
Quoted 1 line

I'm one of the maintainers.

I found that [email protected] 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

#5 lore raw
In reply to Cheng Renquan (程任全)
Quoted 6 lines · Cheng Renquan (程任全)
Quoted 5 lines · Rafael J. Wysocki
Quoted 4 lines

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.

Quoted 6 lines
Quoted 1 line

I'm one of the maintainers.

I found that [email protected] 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
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

#6 lore raw

PATCH 1/1 kprobes: check CONFIG_FREEZER instead of CONFIG_PM

In reply to Rafael J. Wysocki

Hi,

Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Cheng Renquan (程任全)

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",

Quoted 3 lines
Quoted 1 line

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 <[email protected]>

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.

---
 arch/ia64/kernel/kprobes.c |    2 +-
 arch/x86/kernel/kprobes.c  |    2 +-
 kernel/kprobes.c           |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/ia64/kernel/kprobes.c +1 -1
Index: 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;
arch/x86/kernel/kprobes.c +1 -1
Index: 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();
kernel/kprobes.c +1 -1
Index: 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;
Signature · 7 lines
Masami Hiramatsu

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

e-mail: [email protected]
Acked-by
#7 lore raw
In reply to Rafael J. Wysocki
Quoted 78 lines

Hi,

Quoted 11 lines · Cheng Renquan (?????????)

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:

Quoted 8 lines

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.

Quoted 11 lines

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",

Quoted 1 line

Now I'm confused on how to resolve this?

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

Quoted 1 line

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
Quoted 11 lines

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 <[email protected]>

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

Quoted 4 lines

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

Quoted 20 lines
---
 kernel/power/Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/kernel/power/Makefile
===================================================================

kernel/power/Makefile +2 -1
@@ -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
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html