All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Meelis Roos <mroos@linux.ee>
Cc: David Miller <davem@davemloft.net>,
	sparclinux@vger.kernel.org,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: boot panic after oops from sysfs_new_dirent
Date: Tue, 01 Sep 2009 07:58:20 +0000	[thread overview]
Message-ID: <4A9CD41C.8060604@kernel.org> (raw)
In-Reply-To: <Pine.SOC.4.64.0909011032350.10835@math.ut.ee>

Meelis Roos wrote:
>> Ummm.... one more question.  Is cpu0 missing?  Can you please post the
>> output of "cat /proc/cpuinfo"?
> 
> Yes, there's no CPU numbered 0, the numbers come from hardware slots on 
> backplane.

Aha...  Does the following patch fix the problem?

diff --git a/mm/percpu.c b/mm/percpu.c
index 5fe3784..3311c89 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -197,7 +197,12 @@ static unsigned long pcpu_chunk_addr(struct pcpu_chunk *chunk,
 static bool pcpu_chunk_page_occupied(struct pcpu_chunk *chunk,
 				     int page_idx)
 {
-	return *pcpu_chunk_pagep(chunk, 0, page_idx) != NULL;
+	/*
+	 * Any possible cpu id can be used here, so there's no need to
+	 * worry about preemption or cpu hotplug.
+	 */
+	return *pcpu_chunk_pagep(chunk, raw_smp_processor_id(),
+				 page_idx) != NULL;
 }

 /* set the pointer to a chunk in a page struct */
@@ -297,6 +302,14 @@ static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr)
 		return pcpu_first_chunk;
 	}

+	/*
+	 * The address is relative to unit0 which might be unused and
+	 * thus unmapped.  Offset the address to the unit space of the
+	 * current processor before looking it up in the vmalloc
+	 * space.  Note that any possible cpu id can be used here, so
+	 * there's no need to worry about preemption or cpu hotplug.
+	 */
+	addr += raw_smp_processor_id() * pcpu_unit_size;
 	return pcpu_get_page_chunk(vmalloc_to_page(addr));
 }

-- 
tejun

WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <tj@kernel.org>
To: Meelis Roos <mroos@linux.ee>
Cc: David Miller <davem@davemloft.net>,
	sparclinux@vger.kernel.org,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: boot panic after oops from sysfs_new_dirent
Date: Tue, 01 Sep 2009 16:58:20 +0900	[thread overview]
Message-ID: <4A9CD41C.8060604@kernel.org> (raw)
In-Reply-To: <Pine.SOC.4.64.0909011032350.10835@math.ut.ee>

Meelis Roos wrote:
>> Ummm.... one more question.  Is cpu0 missing?  Can you please post the
>> output of "cat /proc/cpuinfo"?
> 
> Yes, there's no CPU numbered 0, the numbers come from hardware slots on 
> backplane.

Aha...  Does the following patch fix the problem?

diff --git a/mm/percpu.c b/mm/percpu.c
index 5fe3784..3311c89 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -197,7 +197,12 @@ static unsigned long pcpu_chunk_addr(struct pcpu_chunk *chunk,
 static bool pcpu_chunk_page_occupied(struct pcpu_chunk *chunk,
 				     int page_idx)
 {
-	return *pcpu_chunk_pagep(chunk, 0, page_idx) != NULL;
+	/*
+	 * Any possible cpu id can be used here, so there's no need to
+	 * worry about preemption or cpu hotplug.
+	 */
+	return *pcpu_chunk_pagep(chunk, raw_smp_processor_id(),
+				 page_idx) != NULL;
 }

 /* set the pointer to a chunk in a page struct */
@@ -297,6 +302,14 @@ static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr)
 		return pcpu_first_chunk;
 	}

+	/*
+	 * The address is relative to unit0 which might be unused and
+	 * thus unmapped.  Offset the address to the unit space of the
+	 * current processor before looking it up in the vmalloc
+	 * space.  Note that any possible cpu id can be used here, so
+	 * there's no need to worry about preemption or cpu hotplug.
+	 */
+	addr += raw_smp_processor_id() * pcpu_unit_size;
 	return pcpu_get_page_chunk(vmalloc_to_page(addr));
 }

-- 
tejun

  reply	other threads:[~2009-09-01  7:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-31 13:51 boot panic after oops from sysfs_new_dirent Meelis Roos
2009-08-31 21:22 ` David Miller
2009-08-31 21:22   ` David Miller
2009-09-01  7:05   ` Meelis Roos
2009-09-01  7:05     ` Meelis Roos
2009-09-01  7:14     ` Tejun Heo
2009-09-01  7:14       ` Tejun Heo
2009-09-01  7:30       ` Tejun Heo
2009-09-01  7:30         ` Tejun Heo
2009-09-01  7:33         ` Meelis Roos
2009-09-01  7:33           ` Meelis Roos
2009-09-01  7:58           ` Tejun Heo [this message]
2009-09-01  7:58             ` Tejun Heo
2009-09-01 11:48             ` Meelis Roos
2009-09-01 11:48               ` Meelis Roos
2009-09-01 12:30               ` [PATCH] percpu: don't assume existence of cpu0 Tejun Heo
2009-09-01 12:30                 ` Tejun Heo
2009-09-01 22:52                 ` David Miller
2009-09-01 22:52                   ` David Miller

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=4A9CD41C.8060604@kernel.org \
    --to=tj@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=sparclinux@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 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.