WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] __ia64__ ifdef in xmalloc.c: "Fix ar.unat handling forfa

To: "Rusty Russell" <rusty@xxxxxxxxxxxxxxx>, "Xen Mailing List" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-devel] __ia64__ ifdef in xmalloc.c: "Fix ar.unat handling forfast paths"
From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
Date: Tue, 22 Nov 2005 12:44:25 +0800
Cc: "Luck, Tony" <tony.luck@xxxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>, djm@xxxxxxxxxxxxxxx
Delivery-date: Tue, 22 Nov 2005 04:44:36 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcXuV4p/9uH8LJtuT4qox78BEp+sEQAvRlWw
Thread-topic: [Xen-devel] __ia64__ ifdef in xmalloc.c: "Fix ar.unat handling forfast paths"
>From: Rusty Russell
>Sent: 2005年11月21日 12:53
>Hi all,
>
>       While browsing the code, I noticed this in xmalloc.c:
>
>#ifndef __ia64__
>    BUG_ON(align > SMP_CACHE_BYTES);
>#endif
>
>       This is clearly wrong: due to header alignment we cannot give you a
>greater alignment than SMP_CACHE_BYTES.  Overriding this will cause the
>allocation to succeed, but not give the alignment requested.  It usually
>indicates the caller should be fixed.
>
>Does someone with an ia64 box know why, or want to rip it out and see
>what breaks?
>
>Thanks!
>Rusty.
>--
>A bad analogy is like a leaky screwdriver -- Richard Braakman
>

I didn't note that ifdef before, and removing it doesn't break dom0. I doubt 
the reason from following definition which is copied from Linux directly into 
Xen:

#ifdef CONFIG_SMP
# define SMP_CACHE_SHIFT        L1_CACHE_SHIFT
# define SMP_CACHE_BYTES        L1_CACHE_BYTES
#else
  /*
   * The "aligned" directive can only _increase_ alignment, so this is
   * safe and provides an easy way to avoid wasting space on a
   * uni-processor:
   */
# define SMP_CACHE_SHIFT        3
# define SMP_CACHE_BYTES        (1 << 3)
#endif

For a UP system, SMP_CACHE_BYTES is only 8 bytes to save space. Then maybe 
several months ago, there's such requirement to xmalloc a 16bytes aligned 
(legal on ia64 system like a long double) structure and then failed due to 
BUG_ON with an immediate lazy hack to add ifdef there. For now, such case seems 
disappearing after a quick test.

However I think the preferred way is to increase SMP_CACHE_SHIFT to 4 to match 
maximum allowed alignment value. But I'm not sure from the comment above why 
"3" is defined there on native linux. CC to linux-ia64 list for standard 
answer. ;-)

Thanks,
Kevin

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