Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Oct 2010 14:01:20 +0000
From:      Matthew Fleming <mdf356@gmail.com>
To:        Svatopluk Kraus <onwahe@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: CACHE_LINE_SIZE too small, so struct vpglocks size alignment doesn't work
Message-ID:  <AANLkTikhwwOCsEiynN2ZFMSHx2OvwEJFyKYRwc0PzXPo@mail.gmail.com>
In-Reply-To: <AANLkTinuourO3Y6vM_xc_fLZTtLKbW0EFfahgY1%2BDjS2@mail.gmail.com>
References:  <AANLkTinuourO3Y6vM_xc_fLZTtLKbW0EFfahgY1%2BDjS2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 1, 2010 at 1:00 PM, Svatopluk Kraus <onwahe@gmail.com> wrote:
> Hallo,
>
> =A0a size of 'struct vpglocks' is padded to CACHE_LINE_SIZE size in
> 'sys/vm/vm_page.h'
> header file. I work on a 'coldfire' port where CACHE_LINE_SIZE is 16 byte=
s and
> sizeof(struct mtx) is 20 bytes thus size alignment doesn't work.
>
> =A0I solved it somehow, but I like to learn how to solve it in spirit
> of FreeBSD.
> There are a couple of possibilities:
>
> A1. Do nothing for small CACHE_LINE_SIZE.
> A2. Pad to multiple of CACHE_LINE_SIZE.
>
> B1. use #if with CACHE_LINE_SIZE
> B2. use #if with __coldfire__
>
> When I use B1 solution I need to known sizeof(struct mtx) value in
> preprocessing time.
> So, is it correct to use something like 'assym.s' magic
> (sys/i386/i386/genassym.c)
> in MI code? Or has someone another suggestion?

What about padding to CACHE_LINE_SIZE - (sizeof(struct vpglocks) &
(CACHE_LINE_SIZE-1)) ?

Some compilers will complain about 0-sized arrays, but gcc isn't one of the=
m.

Cheers,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikhwwOCsEiynN2ZFMSHx2OvwEJFyKYRwc0PzXPo>