[PATCH v11 07/10] powerpc/perf: PMU functions for Core IMC and hotplugging

Thomas Gleixner tglx at linutronix.de
Thu Jun 29 20:39:59 AEST 2017


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


More information about the Linuxppc-dev mailing list