Hello!
> We have this serialization at the writes already.
> Device is always locked in some way. All that is
> proposed is to formalize this.
This is not true. Writes are serialized wrt writes and this
happens automatically now (not always correctly though, alas).
Namely, if A is updated on device irq, no need to serialize etc.
Reads are _not_ serialized wrt writes and rely on the fact that each read
will fetch a valid counter. With non-atomic types this fails.
Actually, it is not fatal flaw: even new irq protected(!!!) lock
is not required. Something sort of:
do {
x = read_low();
y = read_high();
x1 = read_low();
} while (x != x1);
(maybe wrong, but surely fixable. I used something sort of this
to get tstamp from jiffies and get_cycles() in netif_rx() and this worked)
But it is still bizarre.
> through my terabit ethernet interface since boot :-)
_Daemon_ makes this. "ifstat -d 30" is enough to fight wraps
of any kind.
But my attitide is based on another observation: to calculate rates etc.
mush shorter sampling interval is required, sort of 1-5 seconds and
"ifstat -d 5". So, disappearing of problem with wrapping is just gratuitous.
> Aside from this, I really want to move all of these statistical things
> towards netlink.
It is another question. rtnetlink really likes 32 bit numbers.
But it another issue, explained mostly by your troubles with sparc.
Well, and because u32 is a unique point where everything works:
it is identically "unsigned int", so printf, scanf and all the shit works. :-)
100% portable, no issues.
No, I do not think that string+number is good. Mixing static and dynamic
info is 100% fault. Strings must be fetchable, but separately.
Number are accessible in a faster way. I would prefer mmap,
like rtacct does.
BTW core stat counters are standard. They are defined by MIBs.
Scheme which I would propose is the following:
1. a virtual FS. Not /proc. May be driverfs, or just new one.
2. Each device has its own directory.
3. One file maps standard identifiers (copy from MIBs) to offsets.
4. Device specific extensions are separate.
5. Data is accesible both via mmap and read.
6. Counters may be even 64 bit, but their high part is to be undefined.
7. Some set of controls to allow non-standard extensions
(f.e. acenic dmas lots of very interesting statistics and
it is stupid to lose it)
Alexey
|