Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Nov 2012 04:10:44 -0800 (PST)
From:      "Rodney W. Grimes" <freebsd@pdx.rh.CN85.ChatUSA.com>
To:        Ian Lepore <freebsd@damnhippie.dyndns.org>
Cc:        Juli Mallett <juli@clockworksquid.com>, "freebsd-mips@FreeBSD.org" <freebsd-mips@freebsd.org>
Subject:   Re: CACHE_LINE_SIZE macro.
Message-ID:  <201211051210.qA5CAiLx094796@pdx.rh.CN85.ChatUSA.com>
In-Reply-To: <1352137087.1120.180.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
> > 
> > this is a kernel-only interface, so compile time constants are fine there.  What user-land visible interfaces are affected by this setting?  The answer should be 'none'
> > 
> > Warner
> 
> When I commented on Attilio's recent checkins concerning padding of
> locks to cache line size and the fact that the value changes per-cpu and
> we're not well-positioned to handle that right now, his main concern was
> modules matching the kernel.  I had suggested making the padding
> conditional on SMP (because apparently there's no benefit to the padding
> in a UP kernel), but then a module compiled for UP wouldn't work right
> on an SMP kernel, and vice versa.  I'm not sure why that's a problem, my
> solution to that would be "So then don't do that."
> 
> What scares me the most is the mushy definition of what CACHE_LINE_SIZE
> really means.  There's nothing about the name that says "This may not be
> the actual cache line size but it's probably close," but increasingly I
> see people talking about it as if it had such a malleable meaning.  Is
> that consistant with the existing uses in the code?  Is it a good idea?

I agree with your point Ian, one should not be abusing a constant that just
happens to fit the value needs, one should be using a new constant such
as MUTEX_ALIGN.

Interesting things can be found if one runs a find /sys/ -type f | xarges grep ALIGN

Like this pair of contradictions:
./dev/fxp/if_fxpvar.h:#define FXP_FLAG_READ_ALIGN       0x0002  /* align read access with cacheline */
./dev/fxp/if_fxpvar.h:#define FXP_FLAG_WRITE_ALIGN      0x0004  /* end write on cacheline */

Both often wrong, cause the cache line size on most x86 is much larger than 2 or 4 :-)


-- 
Rod Grimes                                                 freebsd@freebsd.org



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