Esempio n. 1
0
/**
 *	handle the fault.* event
 *
 *	@result:
 *		list.* event
 */
fmd_event_t *
cpumem_handle_event(fmd_t *pfmd, fmd_event_t *e)
{
	fmd_debug;
	int ret = 0;

	/* Memory offline */
	if (strstr(e->ev_class, "fault.cpu.intel.mem_dev") != NULL ){
		ret = pages_offline(pfmd, e->ev_rscid);
		if ( ret == 0 )
			return fmd_create_listevent(e, LIST_ISOLATED_SUCCESS);
		else
			return fmd_create_listevent(e, LIST_ISOLATED_FAILED);
	}
	/* CPU offline */
	else if (strstr(e->ev_class, "fault.cpu.intel") != NULL) {
		char buf[64];
		int cpu = -1;
		cpu = topo_cpu_by_cpuid(pfmd, e->ev_rscid);					/* get CPUID */
		if (cpu < 0)
			return fmd_create_listevent(e, LIST_ISOLATED_FAILED);	

		memset(buf, 0, 64 * sizeof(char));
		sprintf(buf, "/sys/devices/system/cpu/cpu%d/online", cpu);
		if ((ret = cpu_offline(buf)) == 0)
			return fmd_create_listevent(e, LIST_ISOLATED_SUCCESS);
		else
			return fmd_create_listevent(e, LIST_ISOLATED_FAILED);
	}

	return fmd_create_listevent(e, LIST_LOG);	// TODO
}
Esempio n. 2
0
/*
 * change cpu to online/offline
 */
static int
cpr_p_online(cpu_t *cp, int state)
{
	int rc;

	ASSERT(MUTEX_HELD(&cpu_lock));

	switch (state) {
	case CPU_CPR_ONLINE:
		rc = cpu_online(cp);
		break;
	case CPU_CPR_OFFLINE:
		rc = cpu_offline(cp, CPU_FORCED);
		break;
	}
	if (rc) {
		cpr_err(CE_WARN, "Failed to change processor %d to "
		    "state %d, (errno %d)", cp->cpu_id, state, rc);
	}
	return (rc);
}