LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] slob: fix linking for user mode linux
@ 2008-02-11 22:32 Pekka J Enberg
  2008-02-11 22:39 ` Matt Mackall
  0 siblings, 1 reply; 5+ messages in thread
From: Pekka J Enberg @ 2008-02-11 22:32 UTC (permalink / raw)
  To: mpm; +Cc: jdike, blaisorblade, clameter, linux-kernel

From: Pekka Enberg <penberg@cs.helsinki.fi>

UML has some header magic that expects a non-inline __kmalloc() function to be
available. Fixes the following link time errors:

arch/um/drivers/built-in.o: In function `kmalloc':
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
arch/um/drivers/built-in.o:/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: more undefined references to `__kmalloc' follow

Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
Matt, does this look ok to you? Can we merge it via Christoph's tree?

 include/linux/slob_def.h |    5 +----
 mm/slob.c                |    6 ++++++
 2 files changed, 7 insertions(+), 4 deletions(-)

Index: linux-2.6/include/linux/slob_def.h
===================================================================
--- linux-2.6.orig/include/linux/slob_def.h	2008-01-12 01:00:37.000000000 +0200
+++ linux-2.6/include/linux/slob_def.h	2008-02-12 00:27:38.000000000 +0200
@@ -28,9 +28,6 @@
 	return __kmalloc_node(size, flags, -1);
 }
 
-static inline void *__kmalloc(size_t size, gfp_t flags)
-{
-	return kmalloc(size, flags);
-}
+extern void *__kmalloc(size_t size, gfp_t flags);
 
 #endif /* __LINUX_SLOB_DEF_H */
Index: linux-2.6/mm/slob.c
===================================================================
--- linux-2.6.orig/mm/slob.c	2008-02-11 23:47:19.000000000 +0200
+++ linux-2.6/mm/slob.c	2008-02-12 00:27:38.000000000 +0200
@@ -486,6 +486,12 @@
 }
 EXPORT_SYMBOL(__kmalloc_node);
 
+void *__kmalloc(size_t size, gfp_t gfp)
+{
+	return __kmalloc_node(size, gfp, -1);
+}
+EXPORT_SYMBOL(__kmalloc);
+
 void kfree(const void *block)
 {
 	struct slob_page *sp;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slob: fix linking for user mode linux
  2008-02-11 22:32 [PATCH] slob: fix linking for user mode linux Pekka J Enberg
@ 2008-02-11 22:39 ` Matt Mackall
  2008-02-11 22:44   ` Christoph Lameter
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2008-02-11 22:39 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: jdike, blaisorblade, clameter, linux-kernel


On Tue, 2008-02-12 at 00:32 +0200, Pekka J Enberg wrote:
> From: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> UML has some header magic that expects a non-inline __kmalloc() function to be
> available. Fixes the following link time errors:
> 
> arch/um/drivers/built-in.o: In function `kmalloc':
> /home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
> /home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
> /home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
> /home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
> /home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: undefined reference to `__kmalloc'
> arch/um/drivers/built-in.o:/home/penberg/linux-2.6/arch/um/include/um_malloc.h:14: more undefined references to `__kmalloc' follow

Can someone explain why the magic is needed (and preferably capture it
in a comment somewhere sensible)? I took a peek at this and have no idea
what's going on. 

-- 
Mathematics is the supreme nostalgia of our time.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slob: fix linking for user mode linux
  2008-02-11 22:39 ` Matt Mackall
@ 2008-02-11 22:44   ` Christoph Lameter
  2008-02-11 23:32     ` Jeff Dike
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Lameter @ 2008-02-11 22:44 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Pekka J Enberg, jdike, blaisorblade, linux-kernel

On Mon, 11 Feb 2008, Matt Mackall wrote:

> Can someone explain why the magic is needed (and preferably capture it
> in a comment somewhere sensible)? I took a peek at this and have no idea
> what's going on. 

UML defined its own external __kmalloc and things. Isnt there some other 
way to fix it? I guess including slab.h is not possible here?


/*
 * Copyright (C) 2005 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
 * Licensed under the GPL
 */

#ifndef __UM_MALLOC_H__
#define __UM_MALLOC_H__

#include "kern_constants.h"

extern void *__kmalloc(int size, int flags);
static inline void *kmalloc(int size, int flags)
{
        return __kmalloc(size, flags);
}

extern void kfree(const void *ptr);

extern void *vmalloc(unsigned long size);
extern void vfree(void *ptr);

#endif /* __UM_MALLOC_H__ */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slob: fix linking for user mode linux
  2008-02-11 22:44   ` Christoph Lameter
@ 2008-02-11 23:32     ` Jeff Dike
  2008-02-12  6:23       ` Pekka Enberg
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Dike @ 2008-02-11 23:32 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Matt Mackall, Pekka J Enberg, blaisorblade, linux-kernel

On Mon, Feb 11, 2008 at 02:44:21PM -0800, Christoph Lameter wrote:
> UML defined its own external __kmalloc and things. Isnt there some other 
> way to fix it? I guess including slab.h is not possible here?

This is definitely dubious code on my part and I wouldn't support
Pekka's patch unless you're going to uninline __kmalloc for some
other reason.

The reason for this is that part of UML is userspace code, and thus
can't use kernel headers.  However, they do need some kernel
interfaces in some form.  That form has traditionally been little
wrappers in the kernel side of UML which just call the kernel
interface.

In this case, there used to be um_kmalloc, which just called kmalloc.
I've been trying to get rid of these stupid little helpers for a
while, and this is what I ended up with for kmalloc.

It would be an annoyance to reintroduce um_kmalloc, but that might be
the best thing to do here.

				Jeff

-- 
Work email - jdike at linux dot intel dot com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] slob: fix linking for user mode linux
  2008-02-11 23:32     ` Jeff Dike
@ 2008-02-12  6:23       ` Pekka Enberg
  0 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2008-02-12  6:23 UTC (permalink / raw)
  To: Jeff Dike; +Cc: Christoph Lameter, Matt Mackall, blaisorblade, linux-kernel

Jeff Dike wrote:
>> UML defined its own external __kmalloc and things. Isnt there some other 
>> way to fix it? I guess including slab.h is not possible here?
 >
> It would be an annoyance to reintroduce um_kmalloc, but that might be
> the best thing to do here.

I'm ok with that as long as we get this annoying bug fixed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-12  6:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-11 22:32 [PATCH] slob: fix linking for user mode linux Pekka J Enberg
2008-02-11 22:39 ` Matt Mackall
2008-02-11 22:44   ` Christoph Lameter
2008-02-11 23:32     ` Jeff Dike
2008-02-12  6:23       ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).