Beispiel #1
0
/*
 * pserialize_destroy:
 *
 *	Destroy a passive serialization object.
 */
void
pserialize_destroy(pserialize_t psz)
{

	KASSERT(psz->psz_owner == NULL);

	kcpuset_destroy(psz->psz_target);
	kcpuset_destroy(psz->psz_pass);
	kmem_free(psz, sizeof(struct pserialize));
}
Beispiel #2
0
/*
 * Halt all running cpus, excluding current cpu.
 */
void
cpu_halt_others(void)
{
	kcpuset_t *kcp;

	// If we are the only CPU running, there's nothing to do.
	if (kcpuset_match(cpus_running, curcpu()->ci_data.cpu_kcpuset))
		return;

	// Get all running CPUs
	kcpuset_clone(&kcp, cpus_running);
	// Remove ourself
	kcpuset_remove(kcp, curcpu()->ci_data.cpu_kcpuset);
	// Remove any halted CPUs
	kcpuset_remove(kcp, cpus_halted);
	// If there are CPUs left, send the IPIs
	if (!kcpuset_iszero(kcp)) {
		cpu_multicast_ipi(kcp, IPI_HALT);
		cpu_ipi_wait("halt", cpus_halted, kcp);
	}
	kcpuset_destroy(kcp);

	/*
	 * TBD
	 * Depending on available firmware methods, other cpus will
	 * either shut down themselves, or spin and wait for us to
	 * stop them.
	 */
}
Beispiel #3
0
void
kcpuset_unuse(kcpuset_t *c, kcpuset_t **lst)
{
	if (atomic_dec_uint_nv(&c->nused) != 0)
		return;
	KASSERT(c->nused == 0);
	KASSERT(c->next == NULL);
	if (lst == NULL) {
		kcpuset_destroy(c);
		return;
	}
	c->next = *lst;
	*lst = c;
}