kernel-ark/arch/ia64/kernel
Stephane Eranian 8df5a500a3 [IA64] perfmon & PAL_HALT again
The pmu_active test is based on the values of PSR.up. THIS IS THE PROBLEM as
it does not take into account the lazy restore logic which is as follow (simplified):

context switch out:
	save PMDs
	clear psr.up
	release ownership

context switch in:
	if (ctx->last_cpu == smp_processor_id() && ctx->cpu_activation == cpu_activation) {
		set psr.up
		return
	}
	restore PMD
	restore PMC
	ctx->last_cpu   = smp_processor_id();
	ctx->activation = ++cpu_activation;
	set psr.up

The key here is that on context switch out, we clear psr.up and on context switch in
we check if nobody else used the PMU on that processor since last time we came. In
that case, we assume the PMD/PMC are ours and we simply reactivate.

The Caliper problem is that between the moment we context switch out and the moment we
come back, nobody effectively used the PMU BUT the processor went idle. Normally this
would have no incidence but PAL_HALT does alter the PMU registers.  In default_idle(),
the test on psr.up is not strong enough to cover this case and we go into PAL which
trashed the PMU resgisters. When we come back we falsely assume that this is our state
yet it is corrupted. Very nasty indeed.

To avoid the problem it is necessary to forbid going to PAL_HALT as soon as perfmon
installs some valid state in the PMU registers. This happens with an application
attaches a context to a thread or CPU. It is not enough to check the psr/dcr bits.
Hence I propose the attached patch. It adds a callback in process.c to modify the
condition to enter PAL on idle. Basically, now it is conditional to pal_halt=1 AND
perfmon saying it is okay.

Signed-off-by: Tony Luck <tony.luck@intel.com>
2005-05-03 15:44:48 -07:00
..
acpi-ext.c
acpi.c [IA64] use common pxm function 2005-05-03 13:33:18 -07:00
asm-offsets.c
brl_emu.c
cyclone.c
domain.c
efi_stub.S
efi.c
entry.h
entry.S [IA64] fix typos caught by new assembler 2005-05-03 10:56:42 -07:00
fsys.S [IA64] fix ia64 syscall auditing 2005-05-03 13:45:39 -07:00
gate-data.S
gate.lds.S
gate.S
head.S [IA64] Fix build errors for !HOTPLUG case. 2005-04-22 14:46:24 -07:00
ia64_ksyms.c
init_task.c
iosapic.c [IA64] iosapic.c: typo ... s/spin_unlock_irq/spin_unlock/ 2005-04-25 13:27:48 -07:00
irq_ia64.c [IA64] vector sharing (Large I/O system support) 2005-04-25 13:26:23 -07:00
irq_lsapic.c
irq.c
ivt.S
machvec.c
Makefile
mca_asm.S [IA64] cpu hotplug: return offlined cpus to SAL 2005-04-22 14:44:40 -07:00
mca_drv_asm.S [IA64] MCA recovery improvements 2005-05-03 13:47:42 -07:00
mca_drv.c [IA64] MCA recovery improvements 2005-05-03 13:47:42 -07:00
mca_drv.h
mca.c
minstate.h
module.c
pal.S
palinfo.c
patch.c
perfmon_default_smpl.c [IA64] perfmon: make pfm_sysctl a global, and other cleanup 2005-04-25 13:08:30 -07:00
perfmon_generic.h
perfmon_itanium.h
perfmon_mckinley.h
perfmon.c [IA64] perfmon & PAL_HALT again 2005-05-03 15:44:48 -07:00
process.c [IA64] perfmon & PAL_HALT again 2005-05-03 15:44:48 -07:00
ptrace.c [PATCH] convert that currently tests _NSIG directly to use valid_signal() 2005-05-01 08:59:14 -07:00
sal.c
salinfo.c
semaphore.c
setup.c [IA64] print "siblings" before {physical,core,thread} id 2005-04-25 13:27:12 -07:00
sigframe.h
signal.c [IA64] fix ia64 syscall auditing 2005-05-03 13:45:39 -07:00
smp.c
smpboot.c [IA64] multi-core/multi-thread identification 2005-04-25 13:25:06 -07:00
sys_ia64.c [PATCH] consolidate sys_shmat 2005-05-01 08:59:12 -07:00
time.c
topology.c
traps.c
unaligned.c
unwind_decoder.c
unwind_i.h
unwind.c [IA64] Tighten up unw_unwind_to_user check 2005-04-25 11:45:26 -07:00
vmlinux.lds.S