[CFR][CFT] counter(9): new API for faster and raceless counters

Brooks Davis brooks at FreeBSD.org
Wed Apr 3 19:05:35 UTC 2013

On Mon, Apr 01, 2013 at 03:51:28PM +0400, Gleb Smirnoff wrote:
> o Tiny API for counter(9):
>      counter_u64_t
>      counter_u64_alloc(int wait);
>      void
>      counter_u64_free(counter_u64_t cnt);
>      void
>      counter_u64_add(counter_u64_t cnt, uint64_t inc);
>      uint64_t
>      counter_u64_fetch(counter_u64_t cnt);

I wonder if there might be value in an interface to retrieve the per-cpu
values individually.  The use case I have in mind is interrupt counters
on our BERI CPU.  Similar to the Sibyte MIPS SoCs, our PIC always routes
each interrupt to a specific hardware thread.  I'd ideally like to be able
to look at at hardware interrupts on a per-thread basis and avoid the
cache trashing behavior we'd get if we allocated current interrupt
counters to each one, but we probably want to be able to preserve
something like the current behavior.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130403/10af3dfc/attachment.sig>

More information about the freebsd-arch mailing list