Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1186233

Re: [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces
Date 2015-07-16 22:50 +0200
Message-ID <pMYgp-SY-3@gated-at.bofh.it> (permalink)
References <pMlf3-3in-3@gated-at.bofh.it> <pMlf4-3in-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 14, 2015 at 08:01:50PM -0700, Sukadev Bhattiprolu wrote:
> +DEFINE_PER_CPU(int, nop_txn_flags);
> +
> +static int nop_txn_flags_get_and_clear(void)
> +{
> +	int *flagsp;
> +	int flags;
> +	
> +	flagsp = &get_cpu_var(nop_txn_flags);
> +
> +	flags = *flagsp;
> +	*flagsp = 0;
> +
> +	put_cpu_var(nop_txn_flags);
> +
> +	return flags;
> +}
> +
> +static void nop_txn_flags_set(int flags)
> +{
> +	int *flagsp;
> +	
> +	flagsp = &get_cpu_var(nop_txn_flags);
> +	*flagsp = flags;
> +	put_cpu_var(nop_txn_flags);
> +}

That's really horrible, see below:

> +static void perf_pmu_start_txn(struct pmu *pmu, int flags)
>  {
	__this_cpu_write(nop_txn_flags, flags);
> +
> +	if (flags & ~PERF_PMU_TXN_ADD)
> +		return;
> +
>  	perf_pmu_disable(pmu);
>  }
>  
>  static int perf_pmu_commit_txn(struct pmu *pmu)
>  {
	int flags = __this_cpu_read(nop_txn_flags);
	__this_cpu_write(nop_txn_flags, 0);
> +
> +	if (flags & ~PERF_PMU_TXN_ADD)
> +		return 0;
> +
>  	perf_pmu_enable(pmu);
>  	return 0;
>  }
>  
>  static void perf_pmu_cancel_txn(struct pmu *pmu)
>  {
	int flags = __this_cpu_read(nop_txn_flags);
	__this_cpu_write(nop_txn_flags, 0);
> +
> +	if (flags & ~PERF_PMU_TXN_ADD)
> +		return;
> +
>  	perf_pmu_enable(pmu);
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/8] Implement group-read of events using txn interface Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200
  [PATCH v3 4/8] perf: Split perf_event_read() and perf_event_count() Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200
  [PATCH v3 7/8] perf: Define PMU_TXN_READ interface Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200
    Re: [PATCH v3 7/8] perf: Define PMU_TXN_READ interface Peter Zijlstra <peterz@infradead.org> - 2015-07-17 00:30 +0200
      Re: [PATCH v3 7/8] perf: Define PMU_TXN_READ interface Peter Zijlstra <peterz@infradead.org> - 2015-07-22 08:00 +0200
  [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200
    Re: [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces Peter Zijlstra <peterz@infradead.org> - 2015-07-16 22:20 +0200
      Re: [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-16 23:30 +0200
    Re: [PATCH v3 3/8] perf: Add a flags parameter to pmu txn interfaces Peter Zijlstra <peterz@infradead.org> - 2015-07-16 22:50 +0200
  [PATCH v3 5/8] perf: Split perf_event_read_value() Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200
    Re: [PATCH v3 5/8] perf: Split perf_event_read_value() Peter Zijlstra <peterz@infradead.org> - 2015-07-16 23:20 +0200
      Re: [PATCH v3 5/8] perf: Split perf_event_read_value() Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-16 23:50 +0200
  [PATCH v3 1/8] powerpc/perf/hv-24x7: Whitespace - fix parameter alignment Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200
  [PATCH v3 2/8] powerpc/perf/hv-24x7: Simplify extracting counter from result buffer Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2015-07-15 05:10 +0200

csiph-web