From: Olof Johansson <olof@austin.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: akpm@osdl.org, Anton Blanchard <anton@samba.org>,
Maynard Johnson <mpjohn@us.ibm.com>,
linuxppc64-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PPC64] Functions to reserve performance monitor hardware
Date: Mon, 10 Jan 2005 16:23:40 -0600 [thread overview]
Message-ID: <20050110222340.GA13731@austin.ibm.com> (raw)
In-Reply-To: <20050110180127.GD22101@localhost.localdomain>
On Tue, Jan 11, 2005 at 05:01:27AM +1100, David Gibson wrote:
> This patch creates functions to reserve and release the performance
> monitor hardware (including its interrupt), and makes oprofile use
> them.
I don't see where you make oprofile use the functions? op_model_*
changes aren't included in the patch.
> +int reserve_pmc_hardware(perf_irq_t new_perf_irq)
> +{
> + int err = -EBUSY;;
Keeping an extra semicolon around in case you need one in a hurry? :)
> + spin_lock(&pmc_owner_lock);
> +
> + if (pmc_owner_caller) {
> + printk(KERN_WARNING "reserve_pmc_hardware: "
> + "PMC hardware busy (reserved by caller %p)\n",
> + pmc_owner_caller);
> + goto out;
> + }
> +
> + pmc_owner_caller = __builtin_return_address(0);
> + perf_irq = new_perf_irq ? : dummy_perf;
> +
> + err = 0;
Maybe I'm the only one with such an opinion, but I find it more readable
to set the error code in the error case (if section above) instead of
defaulting to error and clearing it before returning. :)
> + pmc_owner_caller = NULL;
> + perf_irq = dummy_perf;
> +
> + spin_unlock(&pmc_owner_lock);
Current oprofile code has an implicit mb(); after restoring perf_irq. I
think the implied lwsync in spin_unlock is sufficient, but I wanted to
mention it.
How do you expect the function to be used, will there really be users
reserving the hardware without registering the interrupt handler? If
there are no such users then it could be nice to reserve using the
handler instead of the return address.
-Olof
next prev parent reply other threads:[~2005-01-10 22:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-10 18:01 [PPC64] Functions to reserve performance monitor hardware David Gibson
2005-01-10 22:23 ` Olof Johansson [this message]
2005-01-11 10:57 ` David Gibson
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=20050110222340.GA13731@austin.ibm.com \
--to=olof@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=david@gibson.dropbear.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@ozlabs.org \
--cc=mpjohn@us.ibm.com \
/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