All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: "\"Cheng Renquan (程任全)\"" <crquan@gmail.com>,
	"Arjan van de Ven" <arjan@linux.intel.com>,
	"Al Viro" <viro@zeniv.linux.org.uk>,
	"Matt Helsley" <matthltc@us.ibm.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Adrian Bunk" <bunk@kernel.org>,
	anil.s.keshavamurthy@intel.com, davem@davemloft.net,
	linux-kernel@vger.kernel.org, "Pavel Machek" <pavel@suse.cz>
Subject: [PATCH] kprobes: check CONFIG_FREEZER instead of CONFIG_PM
Date: Mon, 05 Jan 2009 17:11:00 -0500	[thread overview]
Message-ID: <49628574.20401@redhat.com> (raw)
In-Reply-To: <200901051416.04816.rjw@sisk.pl>

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



  parent reply	other threads:[~2009-01-05 22:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 16:55   ` Cheng Renquan (程任全)
2009-01-05 19:51     ` Rafael J. Wysocki
2009-01-05 19:51     ` Rafael J. Wysocki
2009-01-05 22:11   ` Masami Hiramatsu [this message]
2009-01-06  8:48   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49628574.20401@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=arjan@linux.intel.com \
    --cc=bunk@kernel.org \
    --cc=crquan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthltc@us.ibm.com \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.