public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	mingo@redhat.com, Michael Ellerman <mpe@ellerman.id.au>,
	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
Date: Wed, 8 Apr 2015 14:51:13 +0200	[thread overview]
Message-ID: <20150408125113.GG23123@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1428453299-19121-6-git-send-email-sukadev@linux.vnet.ibm.com>

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.

      reply	other threads:[~2015-04-08 12:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08  0:34 [PATCH v2 0/5] perf: Implement event group read using txn interface Sukadev Bhattiprolu
2015-04-08  0:34 ` [PATCH v2 1/5] perf: Add a flags parameter to pmu txn interfaces Sukadev Bhattiprolu
2015-04-08 12:19   ` Peter Zijlstra
2015-04-08 15:40     ` Sukadev Bhattiprolu
2015-04-08  0:34 ` [PATCH v2 2/5] perf: Split perf_event_read() and perf_event_count() Sukadev Bhattiprolu
2015-04-08  0:34 ` [PATCH v2 3/5] perf: Rename perf_event_read_value Sukadev Bhattiprolu
2015-04-08 12:24   ` Peter Zijlstra
2015-04-08  0:34 ` [PATCH v2 4/5] perf: Define PMU_TXN_READ interface Sukadev Bhattiprolu
2015-04-08 12:45   ` Peter Zijlstra
2015-04-09 19:10     ` Sukadev Bhattiprolu
2015-04-08  0:34 ` [PATCH v2 5/5] powerpc/perf/hv-24x7: Use " Sukadev Bhattiprolu
2015-04-08 12:51   ` Peter Zijlstra [this message]

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=20150408125113.GG23123@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=dev@codyps.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --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