Project

General

Profile

Bug #6347

microfind is somewhat less than ideal

Added by Robert Mustacchi over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
2015-10-17
Due date:
% Done:

100%

Estimated time:
Difficulty:
Hard
Tags:
Gerrit CR:

Description

The kernel has a function, tenmicrosec(), for generating a delay of around 10 microseconds using a spin loop. When this function is used early in boot, prior to the configuration of more modern timing services, this function uses a loop count (microdata) calibrated to take about 10 microseconds to complete.

The function that calibrates microdata for the machine's CPU, microfind(), is a bit rubbish. The function is quite rough around the edges, both in code and comments, and worst of all: it does not seem to work properly.

The failure becomes particularly pronounced when the OS is booted via iPXE in a VMware guest, when the OS panics most (but not all!) times this particular method of booting is attempted. Upon inspection, it seems that our use of the i8254 Programmable Interval Timer is itself not incorrect; nor is the emulated PIT malfunctioning in any detectable way.

In order to fix the problem a simpler, better documented replacement will be substituted for the existing microfind() implementation. The replacement function will make repeated trials of delay measurement in order to smooth out jitter in the scheduling of virtual machine guests.

#1

Updated by Electric Monk over 5 years ago

  • Status changed from New to Closed

git commit 29e54759b5b8e21fb481d44ee504a764aa7b6ea2

commit  29e54759b5b8e21fb481d44ee504a764aa7b6ea2
Author: Joshua M. Clulow <jmc@joyent.com>
Date:   2015-10-24T22:23:12.000Z

    6347 microfind is somewhat less than ideal
    Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
    Approved by: Garrett D'Amore <garrett@damore.org>

Also available in: Atom PDF