Subject: Don't call the hardware-sampling handler if the context is masked From: Kevin Corry On Cell, when we disable the PMU, if the hardware-sampling module is in use, we call the handler to copy the contents of the trace-buffer into the kernel sampling-buffer. However, if the context is already masked, that means we've previously found the sampling-buffer to be full, and we're waiting on user space to read the contents and restart the context. In this situation, if we call the hardware-sampling handler again, it will just detect a full sampling-buffer again, and add another "buffer-full" message to the context. This will eventually lead user-space to think the sampling-buffer needs to be read multiple times, with a pfm_restart() each time. After the first time, this leads to a lot of spurious errors about not being able to restart an active context. Fix this simply by not calling the hardware-sampling handler if the context is masked. Signed-off-by: Kevin Corry Acked-by: Carl Love Signed-off-by: Arnd Bergmann Index: linux-2.6/arch/powerpc/perfmon/perfmon_cell.c =================================================================== --- linux-2.6.orig/arch/powerpc/perfmon/perfmon_cell.c +++ linux-2.6/arch/powerpc/perfmon/perfmon_cell.c @@ -309,7 +309,9 @@ static void pfm_cell_disable_counters(st cbe_disable_pm(smp_processor_id()); - if (smpl_fmt && !strcmp(smpl_fmt->fmt_name, PFM_CELL_HW_SMPL_NAME)) { + if (smpl_fmt && + ctx->state != PFM_CTX_MASKED && + !strcmp(smpl_fmt->fmt_name, PFM_CELL_HW_SMPL_NAME)) { ctx->ovfl_arg.ovfl_pmd = PFM_CELL_HW_SMPL_OVFL_PMD_PARTIAL; ctx->ovfl_arg.active_set = ctx->active_set->id; smpl_fmt->fmt_handler(ctx->smpl_addr,