From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932505AbbEVNiw (ORCPT ); Fri, 22 May 2015 09:38:52 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:49352 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932481AbbEVNit (ORCPT ); Fri, 22 May 2015 09:38:49 -0400 Date: Fri, 22 May 2015 15:38:43 +0200 From: Peter Zijlstra To: mingo@kernel.org Cc: vincent.weaver@maine.edu, eranian@google.com, jolsa@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 11/11] perf/x86: Simplify put_exclusive_constraints Message-ID: <20150522133843.GF3644@twins.programming.kicks-ass.net> References: <20150522132905.416122812@infradead.org> <20150522133136.355195312@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150522133136.355195312@infradead.org> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2015 at 03:29:16PM +0200, Peter Zijlstra wrote: > @@ -2149,22 +2147,25 @@ static void intel_put_excl_constraints(s > } > > /* > + * If event was actually assigned, then mark the counter state as > + * unused now. > */ > + if (hwc->idx >= 0) { > + xl = &excl_cntrs->states[tid]; > + > + /* > + * put_constraint may be called from x86_schedule_events() > + * which already has the lock held so here make locking > + * conditional. > + */ > + if (!xl->sched_started) > + raw_spin_lock(&excl_cntrs->lock); > > xl->state[hwc->idx] = INTEL_EXCL_UNUSED; > > + if (!xl->sched_started) > + raw_spin_unlock(&excl_cntrs->lock); > + } > } Hmm, we could probably avoid the lock and use WRITE_ONCE() to clear this state, but I'm too tired to really think about it.