On 2019-11-26 4:16 p.m., Bart Van Assche wrote:
On 2019-11-25 21:00, Douglas Gilbert wrote:
On 2019-11-26 12:05 p.m., Bart Van Assche wrote:
- start = ktime_get();
Rather than throw away the high precision clock and resort to jiffies,
perhaps
you might try the middle road. For example: ktime_get_coarse().
Hi Doug,
Since HZ >= 100, I think that 1/HZ is more than accurate enough for a
one second timeout.
For command timeouts, yes.
I was thinking more about instrumenting a LLD to time individual SCSI commands
or get accurate averages over many similar commands (e.g. READs and WRITEs).
Those times could then be compared to similar measurements done from the
user space via the sd or sg driver. The sg driver times commands starting
from each blk_execute_rq_nowait() call to its corresponding callback. In the
current sg driver the unit of that timing is jiffies which is too coarse to
be useful, especially with flash based or faster storage. Hence the sg driver
rewrite uses ktime_get() and friends. So far I haven't seen the need to use
ktime_get_coarse() but one reviewer suggested it.
Doug Gilbert