From owner-freebsd-current@FreeBSD.ORG Fri Oct 1 14:01:22 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11DA1106566B for ; Fri, 1 Oct 2010 14:01:22 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C8EBB8FC16 for ; Fri, 1 Oct 2010 14:01:21 +0000 (UTC) Received: by iwn34 with SMTP id 34so4738330iwn.13 for ; Fri, 01 Oct 2010 07:01:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ozUcwsl04T7HlcBQaFF53EntBwYbraDFRjF786IGBYo=; b=g/U7w/Jd4rXdsq54qatRuDDmG4xjkttYweJ15B12mgpKEfSJjeugJMt46JEddBMfnJ CP5OI8lAazyydqHS6mwcFAX5uD6yBE54dsyVya63jjdOIY84aPUupIPWJJKrE7qfP2z7 6mtZ42bfVVgzuaPUH/deo/GUClHJBrwefRpK0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=U8MMSbi+/Vb/mDqniD86gmXzzmpH/6JdOB/xZ0gIQnlLUosaR+3d9UtCSR8BntBSNI jkrAbAcTqsiuXGAi04WsAYJr8xkMWP0ixIMuy1iOfFxE6kv8ErtcR1tS87tewEo6vhP5 zhcAb4G/WriTBzQ7HXu8TC8a6jRXAv2Vy6L7U= MIME-Version: 1.0 Received: by 10.231.167.67 with SMTP id p3mr5736782iby.20.1285941680935; Fri, 01 Oct 2010 07:01:20 -0700 (PDT) Received: by 10.231.167.140 with HTTP; Fri, 1 Oct 2010 07:01:20 -0700 (PDT) In-Reply-To: References: Date: Fri, 1 Oct 2010 14:01:20 +0000 Message-ID: From: Matthew Fleming To: Svatopluk Kraus Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org Subject: Re: CACHE_LINE_SIZE too small, so struct vpglocks size alignment doesn't work X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2010 14:01:22 -0000 On Fri, Oct 1, 2010 at 1:00 PM, Svatopluk Kraus 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