linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Corey Ashford <cjashfor@us.ibm.com>
To: linuxppc-dev@ozlabs.org, eranian@googlemail.com
Subject: Feedback requested on switching the exception wrapper used for the PMU interrupt on ppc64
Date: Tue, 13 May 2008 15:05:35 -0700	[thread overview]
Message-ID: <482A10AF.6040205@us.ibm.com> (raw)

Hello,

One of the things I've been working on is porting perfmon2 to ppc64. 
We've made a fair amount of progress on it, and support is available in 
libpfm and the perfmon2 kernel patch.

One of the things we had to work around was the "lazy interrupt 
disabling" mechanism in ppc64 Linux.  The problem was that the PMU 
exception handler (0xf00) uses the STD_EXCEPTION_PSERIES wrapper, which 
does not support lazy interrupt disabling.

This is desirable for Oprofile's use of the PMU since its handler is 
fairly simple and being able to profile interrupt protected code is 
desirable.  However, it causes problems for perfmon2, since the 
operations it performs on the thread of its PMU interrupt handler can 
cause a deadlock condition (it can end up calling spin_lock, for example).

Initially, to work around this, we created special spin_lock_irqsave and 
spin_unlock_irqrestore macros for perfmon2 which we could override for 
POWER to define them as functions which do hard disables and restores.

However, not all of the places that we need to disable interrupts were 
occurring from within the perfmon2 code.  Specifically, getting PMU 
interrupts in the middle of a schedule() call (where interrupts were 
expected to be disabled) was causing kernel hangs.

To fix this, I've gone back and removed the special spin_lock macros we 
defined in perfmon2 and have ifdef'd arch/powerpc/kernel/head_64.S file 
as follows:

/*** pSeries interrupt support ***/

         /* moved from 0xf00 */
+ #ifdef CONFIG_PERFMON
+         MASKABLE_EXCEPTION_PSERIES(., performance_monitor)
+ #else
         STD_EXCEPTION_PSERIES(., performance_monitor)
+ #endif

/*
  * An interrupt came in while soft-disabled; clear EE in SRR1,
  * clear paca->hard_enabled and return.

The downside of this change is that if someone is using Oprofile and 
they have enabled perfmon in their kernel, they will not get profile 
samples that occur in interrupt-protected regions of the kernel. 
However, they still can by configuring perfmon out of their kernel.

What do you think of this idea?  Is this something that you would object 
to when perfmon2 does go upstream to LKML?  I think we'd want to add 
some documentation somewhere that describes this side-effect of enabling 
perfmon in the ppc64 Linux kernel.  Do you have suggestions on where 
that should go?  I'm thinking perhaps in both the basic_profiling.txt 
and perfmon2.txt files in the Documentation subdirectory.

Thanks for your consideration,

- Corey

-- 
Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
Beaverton, OR
503-578-3507
cjashfor@us.ibm.com

             reply	other threads:[~2008-05-13 22:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-13 22:05 Corey Ashford [this message]
2008-05-13 22:13 ` Feedback requested on switching the exception wrapper used for the PMU interrupt on ppc64 Olof Johansson
     [not found] <OFDA580598.87E2E65B-ON87257448.007AA3F0-88257448.007AB1E1@us.ibm.com>
2008-05-13 22:26 ` Corey Ashford
2008-05-15  6:46   ` Benjamin Herrenschmidt
2008-05-15 19:41     ` Corey J Ashford
2008-05-15 22:36       ` Corey J Ashford
2008-05-15 23:36       ` Paul Mackerras
2008-05-16  0:26         ` Corey J Ashford
2008-05-16  1:02           ` Paul Mackerras
2008-05-16  2:04             ` Corey J Ashford
2008-05-16 21:25             ` Corey J Ashford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=482A10AF.6040205@us.ibm.com \
    --to=cjashfor@us.ibm.com \
    --cc=eranian@googlemail.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).