/* Save and restart an expired event. Called by NMI contexts, so it has to be careful about preempting normal event ops:  */
static int intel_pmu_save_and_restart(struct perf_event *event)
/* Save and restart an expired event. Called by NMI contexts, so it has to be careful about preempting normal event ops:  */
static int intel_pmu_save_and_restart(struct perf_event *event)
{
	struct hw_perf_event *hwc = &event->hw;
	int idx = hwc->idx;
	int ret;
	x86_perf_event_update(event, hwc, idx);
	ret = x86_perf_event_set_period(event, hwc, idx);
	if (event->state == PERF_EVENT_STATE_ACTIVE)
		intel_pmu_enable_event(hwc, idx);
	return ret;
}