Project

General

Profile

Actions

Bug #2050

closed

todpc_rtcget() returns error sometimes

Added by Dan Kruchinin over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2012-01-31
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Description
todpc_rtcget() function (see usr/src/uts/i86pc/todpc_subr.c) can return error sometimes if machine is "bombed" with a lot of interrupts.
That affects the return values of gethrestime/gethrestime_sec functions (they merely return 0 as the number of seconds) and thus all subsystems and device drivers that use them for time intervals calculation.

Explanation
todpc_rtcget() call chain: clock() -> tod_get() -> todpc_rtcget()

todpc_rtcget() reads time from RTC ports with interrupts enabled. So time getting operation obviously may fail if it was interrupted.
To prevent that, todpc_rtcget() tries to get time from RTC for at most 256 times assuming that the probability of fail of all 256 attempts
is relatively low, but actually it exists and all 256 read attempts fail on a very high loaded system. Typically it's enough to run iozone -a on a dataset shared by NFS over 1G link to make todpc_rtcget() return 0 after some (probably very long) time. Note, that the problem is not 100% reproducible: sometimes you catch it, sometimes you don't.

Notes

The problem can not be reproduced on the VMWare virtual machines (at least on VMware workstation and VMware fusion). Probably they have some sort of optimization that makes RTC read operations faster than on a bare metal.

Though, it's possible to reproduce the issue on KVM, it has much slower RTC read rate.

The following tiny dtrace script may help to indicate the moment when problem happens:

#!/usr/sbin/dtrace -s

fbt::todpc_rtcget:return
/arg1 != 0/
{ trace(arg1); }

Related bugs
https://www.illumos.org/issues/1049

Actions #1

Updated by Rich Lowe over 9 years ago

  • Subject changed from todpc_rtcget() returns 0 sometimes to todpc_rtcget() returns error sometimes
Actions #2

Updated by Garrett D'Amore over 9 years ago

  • Status changed from New to Resolved
  • Assignee set to Dan Kruchinin
  • % Done changed from 0 to 100
  • Tags deleted (needs-triage)

changeset: 13596:51d528ff7e15
tag: tip
user: Dan Kruchinin <>
date: Sat Feb 04 22:28:36 2012 -0800

description:
2050 todpc_rtcget() returns error sometimes
Reviewed by: Dan McDonald <>
Reviewed by: Garrett D'Amore <>
Approved by: Garrett D'Amore <>

Actions

Also available in: Atom PDF