uml: fix build when SLOB is enabled
PATCH 1/14 uml: fix build when SLOB is enabled
From 94409ded7768e15b0d0a5a172d611073c72308de Mon Sep 17 00:00:00 2001
Reintroduce uml_kmalloc for the benefit of UML libc code. The previous tactic of declaring __kmalloc so it could be called directly from the libc side of the house turned out to be getting too intimate with slab, and it doesn't work with slob.
So, the uml_kmalloc wrapper is back. It calls kmalloc or whatever that translates into, and libc code calls it.
kfree is left alone since that still works, leaving a somewhat inconsistent API.
--- arch/um/drivers/chan_user.c | 1 + arch/um/drivers/cow_sys.h | 2 +- arch/um/drivers/daemon_user.c | 4 ++-- arch/um/drivers/fd.c | 2 +- arch/um/drivers/mcast_user.c | 3 ++- arch/um/drivers/net_user.c | 2 +- arch/um/drivers/port_user.c | 2 +- arch/um/drivers/pty.c | 2 +- arch/um/drivers/slip_user.c | 2 +- arch/um/drivers/tty.c | 2 +- arch/um/drivers/xterm.c | 2 +- arch/um/include/um_malloc.h | 9 +++------ arch/um/kernel/mem.c | 5 +++++ arch/um/os-Linux/drivers/ethertap_user.c | 4 ++-- arch/um/os-Linux/helper.c | 4 ++-- arch/um/os-Linux/main.c | 2 +- arch/um/os-Linux/sigio.c | 4 ++-- 17 files changed, 28 insertions(+), 24 deletions(-)
arch/um/drivers/chan_user.c +1 -0
@@ -11,6 +11,7 @@#include <termios.h> #include <sys/ioctl.h> #include "chan_user.h" +#include "kern_constants.h" #include "os.h" #include "um_malloc.h" #include "user.h"
arch/um/drivers/cow_sys.h +1 -1
@@ -8,7 +8,7 @@static inline void *cow_malloc (int size) { -return kmalloc (size,UM_GFP_KERNEL ); +return uml_kmalloc (size,UM_GFP_KERNEL ); }static inline void cow_free (void *ptr)
arch/um/drivers/daemon_user.c +2 -2
@@ -34,7 +34,7 @@ static struct sockaddr_un *new_addr(void *name, int len) {struct sockaddr_un *sun; - sun =kmalloc (sizeof (struct sockaddr_un ),UM_GFP_KERNEL ); + sun =uml_kmalloc (sizeof (struct sockaddr_un ),UM_GFP_KERNEL );if (sun ==NULL ) {printk (UM_KERN_ERR "new_addr: allocation of sockaddr_un " "failed\n" );
@@ -83,7 +83,7 @@ static int connect_to_switch(struct daemon_data *pri) goto out_close; } - sun =kmalloc (sizeof (struct sockaddr_un ),UM_GFP_KERNEL ); + sun =uml_kmalloc (sizeof (struct sockaddr_un ),UM_GFP_KERNEL );if (sun ==NULL ) {printk (UM_KERN_ERR "new_addr: allocation of sockaddr_un " "failed\n" );
arch/um/drivers/fd.c +1 -1
@@ -40,7 +40,7 @@ static void *fd_init(char *str, int device, const struct chan_opts *opts)return NULL ; } - data =kmalloc (sizeof (*data),UM_GFP_KERNEL ); + data =uml_kmalloc (sizeof (*data),UM_GFP_KERNEL );if (data ==NULL )return NULL ;
arch/um/drivers/mcast_user.c +2 -1
@@ -15,6 +15,7 @@#include <unistd.h> #include <errno.h> #include <netinet/in.h> +#include "kern_constants.h" #include "mcast.h" #include "net_user.h" #include "um_malloc.h"
@@ -24,7 +25,7 @@ static struct sockaddr_in *new_addr(char *addr, unsigned short port) {struct sockaddr_in *sin; - sin =kmalloc (sizeof (struct sockaddr_in ),UM_GFP_KERNEL ); + sin =uml_kmalloc (sizeof (struct sockaddr_in ),UM_GFP_KERNEL );if (sin ==NULL ) {printk (UM_KERN_ERR "new_addr: allocation of sockaddr_in " "failed\n" );
arch/um/drivers/net_user.c +1 -1
@@ -222,7 +222,7 @@ static void change(char *dev, char *what, unsigned char *addr, netmask[2], netmask[3]); output_len =UM_KERN_PAGE_SIZE ; - output =kmalloc (output_len,UM_GFP_KERNEL ); + output =uml_kmalloc (output_len,UM_GFP_KERNEL );if (output ==NULL )printk (UM_KERN_ERR "change : failed to allocate output " "buffer\n" );
arch/um/drivers/port_user.c +1 -1
@@ -47,7 +47,7 @@ static void *port_init(char *str, int device, const struct chan_opts *opts)if (kern_data ==NULL )return NULL ; - data =kmalloc (sizeof (*data),UM_GFP_KERNEL ); + data =uml_kmalloc (sizeof (*data),UM_GFP_KERNEL );if (data ==NULL ) goto err;
arch/um/drivers/pty.c +1 -1
@@ -29,7 +29,7 @@ static void *pty_chan_init(char *str, int device, const struct chan_opts *opts) {struct pty_chan *data; - data =kmalloc (sizeof (*data),UM_GFP_KERNEL ); + data =uml_kmalloc (sizeof (*data),UM_GFP_KERNEL );if (data ==NULL )return NULL ;
arch/um/drivers/slip_user.c +1 -1
@@ -96,7 +96,7 @@ static int slip_tramp(char **argv, int fd) pid = err; output_len =UM_KERN_PAGE_SIZE ; - output =kmalloc (output_len,UM_GFP_KERNEL ); + output =uml_kmalloc (output_len,UM_GFP_KERNEL );if (output ==NULL ) {printk (UM_KERN_ERR "slip_tramp : failed to allocate output " "buffer\n" );
arch/um/drivers/tty.c +1 -1
@@ -29,7 +29,7 @@ static void *tty_chan_init(char *str, int device, const struct chan_opts *opts) } str++; - data =kmalloc (sizeof (*data),UM_GFP_KERNEL ); + data =uml_kmalloc (sizeof (*data),UM_GFP_KERNEL );if (data ==NULL )return NULL ; *data = ((struct tty_chan) { .dev = str,
arch/um/drivers/xterm.c +1 -1
@@ -30,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts) {struct xterm_chan *data; - data =kmalloc (sizeof (*data),UM_GFP_KERNEL ); + data =uml_kmalloc (sizeof (*data),UM_GFP_KERNEL );if (data ==NULL )return NULL ; *data = ((struct xterm_chan) { .pid = -1,
arch/um/include/um_malloc.h +3 -6
@@ -8,15 +8,12 @@#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 *uml_kmalloc (int size,int flags);extern void kfree (const void *ptr);extern void *vmalloc (unsigned long size);extern void vfree (void *ptr);#endif /* __UM_MALLOC_H__ */ + +
arch/um/kernel/mem.c +5 -0
@@ -375,3 +375,8 @@ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) return pmd; }#endif + +void *uml_kmalloc (int size,int flags) +{ +return kmalloc (size, flags); +}
arch/um/os-Linux/drivers/ethertap_user.c +2 -2
@@ -52,7 +52,7 @@ static void etap_change(int op, unsigned char *addr, unsigned char *netmask,return ; } - output =kmalloc (UM_KERN_PAGE_SIZE ,UM_GFP_KERNEL ); + output =uml_kmalloc (UM_KERN_PAGE_SIZE ,UM_GFP_KERNEL );if (output ==NULL )printk (UM_KERN_ERR "etap_change : Failed to allocate output " "buffer\n" );
@@ -165,7 +165,7 @@ static int etap_open(void *data) err =etap_tramp (pri->dev_name, pri->gate_addr, control_fds[0 ], control_fds[1 ], data_fds[0 ], data_fds[1 ]); output_len =UM_KERN_PAGE_SIZE ; - output =kmalloc (output_len,UM_GFP_KERNEL ); + output =uml_kmalloc (output_len,UM_GFP_KERNEL );read_output (control_fds[0 ], output, output_len);if (output ==NULL )
arch/um/os-Linux/helper.c +2 -2
@@ -70,8 +70,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv) data.pre_data = pre_data; data.argv = argv; data.fd = fds[1 ]; - data.buf =__cant_sleep () ?kmalloc (PATH_MAX ,UM_GFP_ATOMIC ) : -kmalloc (PATH_MAX ,UM_GFP_KERNEL ); + data.buf =__cant_sleep () ?uml_kmalloc (PATH_MAX ,UM_GFP_ATOMIC ) : +uml_kmalloc (PATH_MAX ,UM_GFP_KERNEL ); pid =clone (helper_child, (void *) sp,CLONE_VM , &data);if (pid <0 ) { ret = -errno;
arch/um/os-Linux/main.c +1 -1
@@ -199,7 +199,7 @@ void *__wrap_malloc(int size)return __real_malloc (size); else if (size <= UM_KERN_PAGE_SIZE)/* finding contiguous pages can be hard*/ - ret =kmalloc (size,UM_GFP_KERNEL ); + ret =uml_kmalloc (size,UM_GFP_KERNEL ); else ret = vmalloc(size);/*
arch/um/os-Linux/sigio.c +2 -2
@@ -109,7 +109,7 @@ static int need_poll(struct pollfds *polls, int n)if (n <= polls->size)return 0 ; - new =kmalloc (n *sizeof (struct pollfd ),UM_GFP_ATOMIC ); + new =uml_kmalloc (n *sizeof (struct pollfd ),UM_GFP_ATOMIC );if (new ==NULL ) {printk (UM_KERN_ERR "need_poll : failed to allocate new " "pollfds\n" );
@@ -243,7 +243,7 @@ static struct pollfd *setup_initial_poll(int fd) {struct pollfd *p; - p =kmalloc (sizeof (struct pollfd ),UM_GFP_KERNEL ); + p =uml_kmalloc (sizeof (struct pollfd ),UM_GFP_KERNEL );if (p ==NULL ) {printk (UM_KERN_ERR "setup_initial_poll : failed to allocate " "poll\n" );
Signature · 12 lines
1.5.5.1 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 1 line · Jeff Dike
Quoted 1 line
From
94409ded7768e15b0d0a5a172d611073c72308deMon Sep 17 00:00:00 2001
These git commit ids don't match up to anything in Linus's tree at all :(
Can you resend these patches with the git ids of the patches already in Linus's tree so that we can properly match them up?
Oh, in the future it is simple to get patches into the -stable tree automatically, just add:
Cc: Stable <[email protected]>
to the signed-off-by: area of the patch. When it goes into Linus's tree, it will be automatically sent to us for inclusion in the next -stable release.
thanks,
greg k-h
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 5 lines · Greg KH
Quoted 1 line · Jeff Dike
Quoted 1 line
From
94409ded7768e15b0d0a5a172d611073c72308deMon Sep 17 00:00:00 2001These git commit ids don't match up to anything in Linus's tree at all :(
Hmmm, OK I'll figure out where the commit ids came from. I cherry-picked them from 2.6.26 into 2.6.25.13, so I guess they got new ids when I did that.
I'll resend with the original ids...
Quoted 6 lines
Oh, in the future it is simple to get patches into the -stable tree automatically, just add:
Cc: Stable <[email protected]>
to the signed-off-by: area of the patch. When it goes into Linus's tree, it will be automatically sent to us for inclusion in the next -stable release.
Yeah, I'll do that in future, but it was a little late for these patches.
Jeff
Signature · 11 lines
Work email - jdike at linux dot intel dot com ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
On Fri, Aug 01, 2008 at 06:41:25PM -0400, Jeff Dike wrote:
From 94409ded7768e15b0d0a5a172d611073c72308de Mon Sep 17 00:00:00 2001
Quoted 9 lines
Reintroduce
uml_kmallocfor the benefit of UML libc code. The previous tactic of declaring__kmallocso it could be called directly from the libc side of the house turned out to be getting too intimate with slab, and it doesn't work with slob.So, the
uml_kmallocwrapper is back. It calls kmalloc or whatever that translates into, and libc code calls it.
Quoted 7 lines
kfree is left alone since that still works, leaving a somewhat inconsistent API.
Signed-off-by Jeff Dike <[email protected]>Cc WANG Cong <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>
Looks good. Thanks. :)
Signature · 12 lines
The opposite of love is not hate, but indifference. --Elie Wiesel ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel