[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1706291239070.1861@nanos>
Date:   Thu, 29 Jun 2017 12:39:59 +0200 (CEST)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>
cc:     Anju T Sudhakar <anju@...ux.vnet.ibm.com>, mpe@...erman.id.au,
        linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        ego@...ux.vnet.ibm.com, bsingharora@...il.com, anton@...ba.org,
        sukadev@...ux.vnet.ibm.com, mikey@...ling.org,
        stewart@...ux.vnet.ibm.com, dja@...ens.net, eranian@...gle.com,
        hemant@...ux.vnet.ibm.com
Subject: Re: [PATCH v11 07/10] powerpc/perf: PMU functions for Core IMC and
 hotplugging
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
Powered by blists - more mailing lists
 
