Re: [PATCH for-next 09/10] IB/mlx4: Add timestamp_mask and hca_core_clock to query_device

Jason Gunthorpe
2015-05-28T20:47:49Z

On Thu, May 28, 2015 at 03:34:00PM -0500, Christoph Lameter wrote:
> On Thu, 28 May 2015, Jason Gunthorpe wrote:
>
> > Second: What about wrap around? Does it even make sense to expose less
> > than 64 bits to userspace? Should the driver manage wrap around to
> > create a flat 64 bit space?
>
> The wrap around is given by the mask. Cycle registers are often shorter
> than 64 bits.

I am aware of how cycle counters work.

My point was exposing raw wrapping counters is a horrible UAPI.

Shouldn't the driver software extend smaller counters to 64 bits?
That would take a single or and an unlikely branch, so don't say
'performance' :)

> through a complete cycle. But that is the nature of these counters. And
> thats what you see when you look into the kernel timer subsystem for
> example.

Very little in the kernel is exposed to that wrapping, the timer
subsystem takes care of it. Certainly, userspace never sees it.

Jason