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

[Xen-devel] [PATCH] xen/typesafe: Force helpers to be always_inline



Clang in particular has a habit of out-of-lining these and creating multiple
local copies of _mfn() and mfn_x(), etc.  Override this behaviour.

Adjust bool_t to bool for the *_eq() helpers.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
CC: Ian Jackson <ian.jackson@xxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
CC: Juergen Gross <jgross@xxxxxxxx>

Spotted while looking at the code generation of evalute_nospec()

Semi-RFC for-4.13.  Nothing (currently un-broken) will break without this, but
it is a step on the way to being able to use Clang and Livepatch in
combination.
---
 xen/include/xen/iommu.h    |  4 ++--
 xen/include/xen/mm.h       | 16 ++++++++--------
 xen/include/xen/typesafe.h |  8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 974bd3ffe8..c77b8c1a22 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -42,12 +42,12 @@ TYPE_SAFE(uint64_t, dfn);
 #undef dfn_x
 #endif
 
-static inline dfn_t dfn_add(dfn_t dfn, unsigned long i)
+static always_inline dfn_t dfn_add(dfn_t dfn, unsigned long i)
 {
     return _dfn(dfn_x(dfn) + i);
 }
 
-static inline bool_t dfn_eq(dfn_t x, dfn_t y)
+static always_inline bool dfn_eq(dfn_t x, dfn_t y)
 {
     return dfn_x(x) == dfn_x(y);
 }
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 8d0ddfb60c..5617ecc607 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -77,22 +77,22 @@ TYPE_SAFE(unsigned long, mfn);
 #undef mfn_x
 #endif
 
-static inline mfn_t mfn_add(mfn_t mfn, unsigned long i)
+static always_inline mfn_t mfn_add(mfn_t mfn, unsigned long i)
 {
     return _mfn(mfn_x(mfn) + i);
 }
 
-static inline mfn_t mfn_max(mfn_t x, mfn_t y)
+static always_inline mfn_t mfn_max(mfn_t x, mfn_t y)
 {
     return _mfn(max(mfn_x(x), mfn_x(y)));
 }
 
-static inline mfn_t mfn_min(mfn_t x, mfn_t y)
+static always_inline mfn_t mfn_min(mfn_t x, mfn_t y)
 {
     return _mfn(min(mfn_x(x), mfn_x(y)));
 }
 
-static inline bool_t mfn_eq(mfn_t x, mfn_t y)
+static always_inline bool mfn_eq(mfn_t x, mfn_t y)
 {
     return mfn_x(x) == mfn_x(y);
 }
@@ -115,22 +115,22 @@ TYPE_SAFE(unsigned long, gfn);
 #undef gfn_x
 #endif
 
-static inline gfn_t gfn_add(gfn_t gfn, unsigned long i)
+static always_inline gfn_t gfn_add(gfn_t gfn, unsigned long i)
 {
     return _gfn(gfn_x(gfn) + i);
 }
 
-static inline gfn_t gfn_max(gfn_t x, gfn_t y)
+static always_inline gfn_t gfn_max(gfn_t x, gfn_t y)
 {
     return _gfn(max(gfn_x(x), gfn_x(y)));
 }
 
-static inline gfn_t gfn_min(gfn_t x, gfn_t y)
+static always_inline gfn_t gfn_min(gfn_t x, gfn_t y)
 {
     return _gfn(min(gfn_x(x), gfn_x(y)));
 }
 
-static inline bool_t gfn_eq(gfn_t x, gfn_t y)
+static always_inline bool gfn_eq(gfn_t x, gfn_t y)
 {
     return gfn_x(x) == gfn_x(y);
 }
diff --git a/xen/include/xen/typesafe.h b/xen/include/xen/typesafe.h
index 7ecd3b4a8d..f242500063 100644
--- a/xen/include/xen/typesafe.h
+++ b/xen/include/xen/typesafe.h
@@ -21,15 +21,15 @@
 
 #define TYPE_SAFE(_type, _name)                                         \
     typedef struct { _type _name; } _name##_t;                          \
-    static inline _name##_t _##_name(_type n) { return (_name##_t) { n }; } \
-    static inline _type _name##_x(_name##_t n) { return n._name; }
+    static always_inline _name##_t _##_name(_type n) { return (_name##_t) { n 
}; } \
+    static always_inline _type _name##_x(_name##_t n) { return n._name; }
 
 #else
 
 #define TYPE_SAFE(_type, _name)                                         \
     typedef _type _name##_t;                                            \
-    static inline _name##_t _##_name(_type n) { return n; }             \
-    static inline _type _name##_x(_name##_t n) { return n; }
+    static always_inline _name##_t _##_name(_type n) { return n; }      \
+    static always_inline _type _name##_x(_name##_t n) { return n; }
 
 #endif
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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