public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Mike Frysinger <vapier@gentoo.org>, graf.yang@analog.com
Cc: dhowells@redhat.com, uclinux-dev@uclinux.org,
	Greg Ungerer <gerg@uclinux.org>, Paul Mundt <lethal@linux-sh.org>,
	uclinux-dist-devel@blackfin.uclinux.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NOMMU: support SMP dynamic percpu_alloc
Date: Thu, 24 Mar 2011 00:20:12 +0000	[thread overview]
Message-ID: <10444.1300926012@redhat.com> (raw)
In-Reply-To: <1300826506-23192-1-git-send-email-vapier@gentoo.org>

Mike Frysinger <vapier@gentoo.org> wrote:

> The percpu code requires more functions to be implemented in the mm core
> which nommu currently does not provide.  So add inline implementations
> since these are largely meaningless on nommu systems.

Under what conditions are these required?

I've seen one percpu compilation bug that I've made a patch for (see
attached), but none of these.  Is SMP required to trigger them?

David
---
From: David Howells <dhowells@redhat.com>
Subject: [PATCH] NOMMU: percpu should use is_vmalloc_addr().

per_cpu_ptr_to_phys() uses VMALLOC_START and VMALLOC_END to determine if an
address is in the vmalloc() region or not.  This is incorrect on NOMMU as
there is no real vmalloc() capability (vmalloc() is emulated by kmalloc()).

The correct way to do this is to use is_vmalloc_addr().  This encapsulates the
vmalloc() region test in MMU mode and just returns 0 in NOMMU mode.

On FRV in NOMMU mode, the percpu compilation fails without this patch:

mm/percpu.c: In function 'per_cpu_ptr_to_phys':
mm/percpu.c:1011: error: 'VMALLOC_START' undeclared (first use in this function)
mm/percpu.c:1011: error: (Each undeclared identifier is reported only once
mm/percpu.c:1011: error: for each function it appears in.)
mm/percpu.c:1012: error: 'VMALLOC_END' undeclared (first use in this function)
mm/percpu.c:1018: warning: control reaches end of non-void function

Signed-off-by: David Howells <dhowells@redhat.com>
---

 mm/percpu.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/mm/percpu.c b/mm/percpu.c
index 3f93001..55d4d11 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1008,8 +1008,7 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
 	}
 
 	if (in_first_chunk) {
-		if ((unsigned long)addr < VMALLOC_START ||
-		    (unsigned long)addr >= VMALLOC_END)
+		if (!is_vmalloc_addr(addr))
 			return __pa(addr);
 		else
 			return page_to_phys(vmalloc_to_page(addr));

  parent reply	other threads:[~2011-03-24  0:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 20:41 [PATCH] NOMMU: support SMP dynamic percpu_alloc Mike Frysinger
2011-03-23 12:37 ` Paul Mundt
2011-03-23 23:09   ` [uclinux-dist-devel] " Mike Frysinger
2011-03-24  0:06     ` David Howells
2011-03-24  0:13       ` Mike Frysinger
2011-03-24  0:20         ` David Howells
2011-03-23 13:30 ` Greg Ungerer
2011-03-24  0:20 ` David Howells [this message]
2011-03-24  0:31   ` Mike Frysinger
2011-03-24  9:40     ` David Howells

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=10444.1300926012@redhat.com \
    --to=dhowells@redhat.com \
    --cc=gerg@uclinux.org \
    --cc=graf.yang@analog.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=uclinux-dev@uclinux.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=vapier@gentoo.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