[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] convert inline alloc_domheap_pages to static inline


  • To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "S.ÃaÄlar Onur" <caglar@xxxxxxxxxxxxx>
  • Date: Mon, 19 Mar 2007 02:10:03 +0200
  • Delivery-date: Sun, 18 Mar 2007 17:09:41 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi;

GCC manual says it is best to use static inline to guarantee compatibility, 
and with gcc-4.2.0 RC1 xen fails to compile like following;

make[3]: Entering directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen/common'
gcc -O2 -fomit-frame-pointer -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall 
-Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -nostdinc 
-fno-builtin -fno-common -fno-strict-aliasing -iwithprefix 
include -Werror -Wno-pointer-arith -pipe 
-I/home/caglar/svn/xen-3.0.4-testing.hg/xen/include 
-I/home/caglar/svn/xen-3.0.4-testing.hg/xen/include/asm-x86/mach-generic 
-I/home/caglar/svn/xen-3.0.4-testing.hg/xen/include/asm-x86/mach-default 
-msoft-float -fno-stack-protector -g -D__XEN__ -c 
page_alloc.c -o page_alloc.o
cc1: warnings being treated as errors
page_alloc.c:744: warning: C99 inline functions are not supported; using GNU89
page_alloc.c:744: warning: to disable this warning use -fgnu89-inline or the 
gnu_inline function attribute

*** 2 errors, 0 warnings
make[3]: *** [page_alloc.o] Error 1
make[3]: Leaving directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen/common'
make[2]: *** [/home/caglar/svn/xen-3.0.4-testing.hg/xen/common/built_in.o] 
Error 2
make[2]: Leaving directory 
`/home/caglar/svn/xen-3.0.4-testing.hg/xen/arch/x86'
make[1]: *** [/home/caglar/svn/xen-3.0.4-testing.hg/xen/xen] Error 2
make[1]: Leaving directory `/home/caglar/svn/xen-3.0.4-testing.hg/xen'
make: *** [build] Error 2

This problem introduced by that [1] patch and as patch stated gcc changing its 
default behaviour. 

Following patch (against xen-3.0.4-testing) converts inline 
alloc_domheap_pages to static inline.

Signed-off-by: S.ÃaÄlar Onur <caglar@xxxxxxxxxxxxx>

diff -r 3341afbb1953 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Thu Feb 15 11:34:58 2007 +0000
+++ b/xen/common/page_alloc.c   Mon Mar 19 01:50:21 2007 +0200
@@ -739,12 +739,6 @@ struct page_info *__alloc_domheap_pages(
     return pg;
 }
 
-inline struct page_info *alloc_domheap_pages(
-    struct domain *d, unsigned int order, unsigned int flags)
-{
-    return __alloc_domheap_pages(d, smp_processor_id(), order, flags);
-}
-
 void free_domheap_pages(struct page_info *pg, unsigned int order)
 {
     int            i, drop_dom_ref;
diff -r 3341afbb1953 xen/include/xen/mm.h
--- a/xen/include/xen/mm.h      Thu Feb 15 11:34:58 2007 +0000
+++ b/xen/include/xen/mm.h      Mon Mar 19 01:54:52 2007 +0200
@@ -32,6 +32,7 @@
 #include <xen/types.h>
 #include <xen/list.h>
 #include <xen/spinlock.h>
+#include <xen/smp.h>
 
 struct domain;
 struct page_info;
@@ -61,11 +62,14 @@ void free_xenheap_pages(void *v, unsigne
 
 /* Domain suballocator. These functions are *not* interrupt-safe.*/
 void init_domheap_pages(paddr_t ps, paddr_t pe);
-struct page_info *alloc_domheap_pages(
-    struct domain *d, unsigned int order, unsigned int memflags);
 struct page_info *__alloc_domheap_pages(
     struct domain *d, unsigned int cpu, unsigned int order, 
     unsigned int memflags);
+static inline struct page_info *alloc_domheap_pages(
+    struct domain *d, unsigned int order, unsigned int memflags)
+{
+    return __alloc_domheap_pages( d, smp_processor_id(), order, memflags );
+}
 void free_domheap_pages(struct page_info *pg, unsigned int order);
 unsigned long avail_domheap_pages(void);
 unsigned long avail_heap_pages(int zone, int node);


[1] http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00702.html

Cheers
-- 
S.ÃaÄlar Onur <caglar@xxxxxxxxxxxxx>
http://cekirdek.pardus.org.tr/~caglar/

Linux is like living in a teepee. No Windows, no Gates and an Apache in house!

Attachment: pgpjJ4JYWEoU9.pgp
Description: PGP signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.