From: Cliff Wickman <cpw@sgi.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: per_cpu_ptr_to_phys() failure on UV x86_64
Date: Thu, 17 Jun 2010 13:24:53 -0500 [thread overview]
Message-ID: <20100617182453.GA31478@sgi.com> (raw)
In-Reply-To: <4C1A5CD4.3020802@kernel.org>
On Thu, Jun 17, 2010 at 07:35:16PM +0200, Tejun Heo wrote:
> On 06/17/2010 07:08 PM, Tejun Heo wrote:
> > (scratching head...) So, that means it's given an address for which
> > !pcpu_addr_in_first_chunk() but outside of vmalloc area. Strange.
> > I'll find out what's going on.
>
> Does the following patch work? The original patch assumed that @addr
> would be the address of the base cpu which isn't true. I only compile
> tested the patch so it might be broken (sorry, I gotta go somewhere
> now) but this should be the right direction.
Yes, your patch works. I tested it on a 32p UV system.
-Cliff
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 46485e1..8956155 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -978,14 +978,23 @@ bool is_kernel_percpu_address(unsigned long addr)
> */
> phys_addr_t per_cpu_ptr_to_phys(void *addr)
> {
> - if (pcpu_addr_in_first_chunk(addr)) {
> - if ((unsigned long)addr < VMALLOC_START ||
> - (unsigned long)addr >= VMALLOC_END)
> - return __pa(addr);
> - else
> - return page_to_phys(vmalloc_to_page(addr));
> - } else
> - return page_to_phys(pcpu_addr_to_page(addr));
> + void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr);
> + unsigned int cpu;
> +
> + for_each_possible_cpu(cpu) {
> + void *start = per_cpu_ptr(base, cpu);
> +
> + if (addr >= start && addr < start + pcpu_unit_size) {
> + /* in the first chunk */
> + if ((unsigned long)addr < VMALLOC_START ||
> + (unsigned long)addr >= VMALLOC_END)
> + return __pa(addr);
> + else
> + return page_to_phys(vmalloc_to_page(addr));
> + }
> + }
> + /* in one of the other chunks */
> + return page_to_phys(pcpu_addr_to_page(addr));
> }
>
> static inline size_t pcpu_calc_fc_sizes(size_t static_size,
>
>
> --
> tejun
--
Cliff Wickman
SGI
cpw@sgi.com
(651) 683-3824
next prev parent reply other threads:[~2010-06-17 18:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 16:20 per_cpu_ptr_to_phys() failure on UV x86_64 Cliff Wickman
2010-06-17 17:08 ` Tejun Heo
2010-06-17 17:35 ` Tejun Heo
2010-06-17 18:24 ` Cliff Wickman [this message]
2010-06-18 9:56 ` [PATCH] percpu: fix first chunk match in per_cpu_ptr_to_phys() Tejun Heo
2010-06-18 12:30 ` Cliff Wickman
2010-06-18 13:07 ` Tejun Heo
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=20100617182453.GA31478@sgi.com \
--to=cpw@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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.