Project

General

Profile

Actions

Bug #5285

closed

pass in cpu_pause_func via pause_cpus

Added by Josef Sipek over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2014-11-04
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

To support CPR, cpu_pause can optionally invoke a custom callback. CPR uses this to save the processor state and power down the core. This callback is set via a global function pointer and it is up to the user of cpu-pausing to reset the function pointer to NULL to prevent future cpu-pausing from re-executing the callback. This is error prone and hard to reason about.

The callback setting can trivially be accomplished by passing the function pointer as an argument to pause_cpus. This clearly delimits the scope during which this callback is active (from the beginning of cpu-pausing to the time cpus are restarted), and it makes it impossible to not specify it and accidentally execute the last callback again.

The current callback setting can be retrieved from the global cpu_pause_info (cpu_pause_info.cp_func) in mdb.

Some notes about how cpu-pausing works:
  1. cpu_lock must be held before the call to pause_cpus, and while start_cpus is called (not between the two, but only one CPU will be running and preemption is disabled)
  2. cpu_lock serializes multiple threads attempting to pause cpus
  3. since cpu_pause_info is only used during cpu pausing, cpu_pause_info is essentially procted by it
Actions #1

Updated by Electric Monk over 6 years ago

  • Status changed from New to Closed
  • % Done changed from 70 to 100

git commit 0ed5c46e82c989cfa9726d9dae452e3d24ef83be

commit  0ed5c46e82c989cfa9726d9dae452e3d24ef83be
Author: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Date:   2014-11-11T05:19:12.000Z

    5285 pass in cpu_pause_func via pause_cpus
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Dan McDonald <danmcd@omniti.com>
    Approved by: Gordon Ross <gwr@nexenta.com>

Actions

Also available in: Atom PDF