Magenheimer, Dan (HP Labs Fort Collins)
2005-Apr-09 20:42 UTC
[Xen-devel] Suggested changes to xen/include from recent Linux
As I mentioned at the xummit (spelling intended :-), a Xen/ia64 contributor from SGI (Greg Edwards) is updating the Xen/ia64 Linux dependencies from 2.6.7 to 2.6.11. This is now working, but he identified a couple places where it would make sense to modify common (include/xen) files. So, rather than just "fix" them in ia64-specific files, I thought I would publish them for comment and to see if they might/should go into include/xen: 1) In include/xen/spinlock.h: Linux has started using the following define: #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED I see that the construct could be used throughout xen/arch/x86 as well... indeed there are TWO C files where a similar macro is defined but called DECLARE_MUTEX. I propose adding the macro. 2) In include/xen/types.h: Starting in 2.6.9, there are some new type-checking attributes and the following lines have been added to include/linux/types.h. There''s some explanation of it here: http://kerneltrap.org/node/3848 (search for __bitwise) Since Jimi mentioned a need for bi-endian support in Xen/ppc, I thought these might be added eventually anyway, so they could be added now to include/xen/type.s. I propose adding the lines (possibly including the comment verbatim?) /* * Below are truly Linux-specific types that should never collide with * any application/library that wants linux/types.h. */ #ifdef __CHECKER__ #define __bitwise __attribute__((bitwise)) #else #define __bitwise #endif typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; typedef __u32 __bitwise __be32; #if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; #endif _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hollis Blanchard
2005-Apr-11 19:12 UTC
Re: [Xen-devel] Suggested changes to xen/include from recent Linux
On Sat, 2005-04-09 at 13:42 -0700, Magenheimer, Dan (HP Labs Fort Collins) wrote:> As I mentioned at the xummit (spelling intended :-), a > Xen/ia64 contributor from SGI (Greg Edwards) is updating > the Xen/ia64 Linux dependencies from 2.6.7 to 2.6.11. > This is now working, but he identified a couple places > where it would make sense to modify common (include/xen) > files. So, rather than just "fix" them in ia64-specific > files, I thought I would publish them for comment and to > see if they might/should go into include/xen:I agree, there should be a minimum of "fixing" generic code in arch-specific files.> 1) In include/xen/spinlock.h: > > Linux has started using the following define: > > #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED > > I see that the construct could be used throughout xen/arch/x86 > as well... indeed there are TWO C files where a similar macro > is defined but called DECLARE_MUTEX. > > I propose adding the macro.In general I don''t see the need to cling to Linux code, but I can see how your copy-and-patch scheme makes you more sensitive to this. I don''t see the harm in this particular case.> 2) In include/xen/types.h: > > Starting in 2.6.9, there are some new type-checking attributes and > the following lines have been added to include/linux/types.h. There''s > some explanation of it here: > > http://kerneltrap.org/node/3848 (search for __bitwise) > > Since Jimi mentioned a need for bi-endian support in Xen/ppc, I thought > these might be added eventually anyway, so they could be added now > to include/xen/type.s.Apparently this was actually a statement about x86-64. LE support on PPC is a second-class citizen, and current rumors aside I think only WinNT has used it.> I propose adding the lines (possibly including the comment verbatim?) > > /* > * Below are truly Linux-specific types that should never collide with > * any application/library that wants linux/types.h. > */ > > #ifdef __CHECKER__ > #define __bitwise __attribute__((bitwise)) > #else > #define __bitwise > #endif > > typedef __u16 __bitwise __le16; > typedef __u16 __bitwise __be16; > typedef __u32 __bitwise __le32; > typedef __u32 __bitwise __be32; > #if defined(__GNUC__) && !defined(__STRICT_ANSI__) > typedef __u64 __bitwise __le64; > typedef __u64 __bitwise __be64; > #endifMaybe this could be added along with the first users of these types? -- Hollis Blanchard IBM Linux Technology Center _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel