public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: srinivasa <srinivasa@in.ibm.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] for "BUG: using smp_processor_id() in preemptible" in 2.6.17.rc6.mm2
Date: Wed, 21 Jun 2006 09:58:27 +0530	[thread overview]
Message-ID: <4498CAEB.5010105@in.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

Hi all
I saw a stack trace while booting the 2.6.17-rc6-mm2 kernel. Which looks 
  like this

BUG: using smp_processor_id() in preemptible [00000001] code: init/1
caller is __handle_mm_fault+0x22/0x248
  [<c010334c>] show_trace+0x27/0x29
  [<c0103486>] dump_stack+0x26/0x28
  [<c02e4d6f>] debug_smp_processor_id+0x9f/0xb0
  [<c0157a98>] __handle_mm_fault+0x22/0x248
  [<c01140b2>] do_page_fault+0x17e/0x605
  [<c01030b9>] error_code+0x39/0x40
  [<c0198eef>] padzero+0x2c/0x37
  [<c0199ff5>] load_elf_binary+0x6e2/0xcfc
  [<c0174e14>] search_binary_handler+0x96/0x201
  [<c017510e>] do_execve+0x18f/0x243
  [<c010152b>] sys_execve+0x3c/0x81
  [<c04a9c93>] syscall_call+0x7/0xb

    Cause for the bug is a set of functions count_vm_event(),
     count_vm_events() and get_cpu_vm_events() calling smp_processor_id()
     in preemptible context without disabling irq's

So I developed patch for this problem,attaching the patch here



[-- Attachment #2: mm.fix --]
[-- Type: text/plain, Size: 1037 bytes --]

diff -Naurp linux-orig/include/linux/page-flags.h linux-mod/include/linux/page-flags.h
--- linux-orig/include/linux/page-flags.h	2006-06-20 20:49:59.000000000 -0700
+++ linux-mod/include/linux/page-flags.h	2006-06-20 20:47:50.000000000 -0700
@@ -141,17 +141,27 @@ DECLARE_PER_CPU(struct vm_event_state, v
 
 static inline unsigned long get_cpu_vm_events(enum vm_event_item item)
 {
-	return __get_cpu_var(vm_event_states).event[item];
+	unsigned long flags, res;
+	local_irq_save(flags); 
+	res = __get_cpu_var(vm_event_states).event[item];
+	local_irq_restore(flags);
+	return res;
 }
 
 static inline void count_vm_event(enum vm_event_item item)
 {
+	unsigned long flags;
+	local_irq_save(flags);
 	__get_cpu_var(vm_event_states).event[item]++;
+	local_irq_restore(flags);
 }
 
 static inline void count_vm_events(enum vm_event_item item, long delta)
 {
+	unsigned long flags;
+	local_irq_save(flags);
 	__get_cpu_var(vm_event_states).event[item] += delta;
+	local_irq_restore(flags);
 }
 
 extern void all_vm_events(unsigned long *);

                 reply	other threads:[~2006-06-21  4:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4498CAEB.5010105@in.ibm.com \
    --to=srinivasa@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox