mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Anju T Sudhakar <anju@linux.vnet.ibm.com>,
	mpe@ellerman.id.au, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, ego@linux.vnet.ibm.com,
	bsingharora@gmail.com, anton@samba.org,
	sukadev@linux.vnet.ibm.com, mikey@neuling.org,
	stewart@linux.vnet.ibm.com, dja@axtens.net, eranian@google.com,
	hemant@linux.vnet.ibm.com
Subject: Re: [PATCH v11 07/10] powerpc/perf: PMU functions for Core IMC and hotplugging
Date: Thu, 29 Jun 2017 12:39:59 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1706291239070.1861@nanos> (raw)
In-Reply-To: <766e7d43-0ca9-1e34-2cbe-73d1cbb2ee14@linux.vnet.ibm.com>

On Thu, 29 Jun 2017, Madhavan Srinivasan wrote:
> On Thursday 29 June 2017 01:11 AM, Thomas Gleixner wrote:
> Idea is to handle multiple event session for a given core and
> yes, my bad, current implementation is racy/broken.
> But an alternate approach is to have a per-core mutex and
> per-core ref count to handle this.
> 
> event_init path:
> per-core mutex lock
>   if ( per-core[refcount] == 0) {
>        rc = opal call to start the engine;
>        if (rc on failure) {
>        per-core mutex unlock;
>        log error info;
>        return error;
>        }
>   }
>   increment the per-core[refcount];
> per-core mutex unlock;
> 
> 
> event_destroy path:
> per-core mutex lock
>   decrement the per-core[refcount];
>   if ( per-core[refcount] == 0) {
>      rc = opal call to stop the engine;
>      if (rc on failure) {
>        per-core mutex unlock;
>        log the failure;
>        return error;
>      }
>   } else if ( per-core[refcount] < 0) {
>      WARN()
>      per-core[refcount] = 0;
>   }
> per-core mutext unlock;

Yes, that works and looks about right.

Thanks,

	tglx

  reply	other threads:[~2017-06-29 10:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 18:58 [PATCH v11 05/10] powerpc/perf: IMC pmu cpumask and cpuhotplug support Anju T Sudhakar
2017-06-28 18:58 ` [PATCH v11 07/10] powerpc/perf: PMU functions for Core IMC and hotplugging Anju T Sudhakar
2017-06-28 19:41   ` Thomas Gleixner
2017-06-29  9:14     ` Madhavan Srinivasan
2017-06-29 10:39       ` Thomas Gleixner [this message]
2017-06-28 18:58 ` [PATCH v11 09/10] powerpc/perf: Thread IMC PMU functions Anju T Sudhakar

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=alpine.DEB.2.20.1706291239070.1861@nanos \
    --to=tglx@linutronix.de \
    --cc=anju@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=bsingharora@gmail.com \
    --cc=dja@axtens.net \
    --cc=ego@linux.vnet.ibm.com \
    --cc=eranian@google.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=stewart@linux.vnet.ibm.com \
    --cc=sukadev@linux.vnet.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

all inboxes | Powered by JetHome®