oprofile/fsl emb: Don't set MSR[PMM] until after clearing the interrupt.
On an arch 2.06 hypervisor, a pending perfmon interrupt will be delivered to the hypervisor at any point the guest is running, regardless of MSR[EE]. In order to reflect this interrupt, the hypervisor has to mask the interrupt in PMGC0 -- and set MSRP[PMMP] to intercept futher guest accesses to the PMRs to detect when to unmask (and prevent the guest from unmasking early, or seeing inconsistent state). This has the side effect of ignoring any changes the guest makes to MSR[PMM], so wait until after the interrupt is clear, and thus the hypervisor should have cleared MSRP[PMMP], before setting MSR[PMM]. The counters wil not actually run until PMGC0[FAC] is cleared in pmc_start_ctrs(), so this will not reduce the effectiveness of PMM. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This commit is contained in:
parent
4f0e332239
commit
4267ea72bb
|
@ -2,7 +2,7 @@
|
||||||
* Freescale Embedded oprofile support, based on ppc64 oprofile support
|
* Freescale Embedded oprofile support, based on ppc64 oprofile support
|
||||||
* Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
|
* Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004 Freescale Semiconductor, Inc
|
* Copyright (c) 2004, 2010 Freescale Semiconductor, Inc
|
||||||
*
|
*
|
||||||
* Author: Andy Fleming
|
* Author: Andy Fleming
|
||||||
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
* Maintainer: Kumar Gala <galak@kernel.crashing.org>
|
||||||
|
@ -321,9 +321,6 @@ static void fsl_emb_handle_interrupt(struct pt_regs *regs,
|
||||||
int val;
|
int val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* set the PMM bit (see comment below) */
|
|
||||||
mtmsr(mfmsr() | MSR_PMM);
|
|
||||||
|
|
||||||
pc = regs->nip;
|
pc = regs->nip;
|
||||||
is_kernel = is_kernel_addr(pc);
|
is_kernel = is_kernel_addr(pc);
|
||||||
|
|
||||||
|
@ -340,9 +337,13 @@ static void fsl_emb_handle_interrupt(struct pt_regs *regs,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The freeze bit was set by the interrupt. */
|
/* The freeze bit was set by the interrupt. */
|
||||||
/* Clear the freeze bit, and reenable the interrupt.
|
/* Clear the freeze bit, and reenable the interrupt. The
|
||||||
* The counters won't actually start until the rfi clears
|
* counters won't actually start until the rfi clears the PMM
|
||||||
* the PMM bit */
|
* bit. The PMM bit should not be set until after the interrupt
|
||||||
|
* is cleared to avoid it getting lost in some hypervisor
|
||||||
|
* environments.
|
||||||
|
*/
|
||||||
|
mtmsr(mfmsr() | MSR_PMM);
|
||||||
pmc_start_ctrs(1);
|
pmc_start_ctrs(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue