From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493AbbDHMv0 (ORCPT ); Wed, 8 Apr 2015 08:51:26 -0400 Received: from casper.infradead.org ([85.118.1.10]:46893 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753089AbbDHMvY (ORCPT ); Wed, 8 Apr 2015 08:51:24 -0400 Date: Wed, 8 Apr 2015 14:51:13 +0200 From: Peter Zijlstra To: Sukadev Bhattiprolu Cc: Paul Mackerras , Arnaldo Carvalho de Melo , mingo@redhat.com, Michael Ellerman , dev@codyps.com, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v2 5/5] powerpc/perf/hv-24x7: Use PMU_TXN_READ interface Message-ID: <20150408125113.GG23123@twins.programming.kicks-ass.net> References: <1428453299-19121-1-git-send-email-sukadev@linux.vnet.ibm.com> <1428453299-19121-6-git-send-email-sukadev@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1428453299-19121-6-git-send-email-sukadev@linux.vnet.ibm.com> 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 Tue, Apr 07, 2015 at 05:34:59PM -0700, Sukadev Bhattiprolu wrote: > @@ -1213,9 +1221,47 @@ static void update_event_count(struct perf_event *event, u64 now) > static void h_24x7_event_read(struct perf_event *event) > { > u64 now; > + struct h_24x7_hw *h24x7hw; > + struct hv_24x7_request_buffer *request_buffer; > + > + /* > + * If in a READ transaction, add this counter to the list of > + * counters to read during the next HCALL (i.e commit_txn()). > + * If not in a READ transaction, go ahead and make the HCALL > + * to read this counter by itself. > + */ > + h24x7hw = &get_cpu_var(h_24x7_hw); > + if (h24x7hw->txn_err) > + goto out; > + > + if (h24x7hw->in_txn) { > + int i; > + int ret; > + > + request_buffer = (void *)get_cpu_var(hv_24x7_reqb); > + > + ret = add_event_to_24x7_request(event, request_buffer); > + if (ret) { > + h24x7hw->txn_err = ret; > + } else { > + /* > + * Assoicate the event with the HCALL request index, > + * so we can quickly find/update the count in > + * ->commit_txn(). > + */ > + i = request_buffer->num_requests - 1; > + h24x7hw->events[i] = event; > + } > + > + put_cpu_var(hv_24x7_reqb); > + goto out; > + } > > now = h_24x7_get_value(event); > update_event_count(event, now); > + > +out: > + put_cpu_var(h_24x7_hw); > } Most of the pmu ops are called with IRQs disabled, no need to use get_cpu_var()/put_cpu_var() which disable/enable preemption.