xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Dario Faggioli <dario.faggioli@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Jennifer Herbert <jennifer.herbert@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH 06/15] xen: trace IRQ enabling/disabling
Date: Wed, 7 Jun 2017 12:16:48 +0100	[thread overview]
Message-ID: <c550c738-73c2-fc74-6610-11718e7cd016@arm.com> (raw)
In-Reply-To: <149633845700.12814.7130992212550379105.stgit@Solace.fritz.box>

Hi Dario,

On 01/06/17 18:34, Dario Faggioli wrote:
> Trace when interrupts are disabled and (re)enabled.
> Basically, we replace the IRQ disabling and enabling
> functions with helpers that does the same, but also
> output the proper trace record.
>
> For putting in the record something that will let
> us identify _where_ in the code (i.e., in what function)
> the IRQ manipulation is happening, use either:
>  - current_text_addr(),
>  - or __builtin_return_address(0).
>
> In fact, depending on whether the disabling/enabling
> happens in macros (like for local_irq_disable() and
> local_irq_enable()) or in actual functions (like in
> spin_lock_irq*()), it is either:
>  - the actual content of the instruction pointer when
>    IRQ are disabled/enabled,
>  - or the return address of the utility function where
>    IRQ are disabled/enabled,
> that will tell us what it is the actual piece of code
> that is asking for the IRQ manipulation operation.
>
> Gate this with its specific Kconfig option, and keep
> it in disabled state by default (i.e., don't build it,
> if not explicitly specified), as the impact on
> performance may be non negligible.
>
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
> ---
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Julien Grall <julien.grall@arm.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> Cc: Jennifer Herbert <jennifer.herbert@citrix.com>
> ---
>  xen/Kconfig.debug                  |   11 ++++-
>  xen/common/spinlock.c              |   16 +++++--
>  xen/common/trace.c                 |   10 +++-
>  xen/include/asm-arm/arm32/system.h |   12 +++++
>  xen/include/asm-arm/arm64/system.h |   12 +++++
>  xen/include/asm-x86/system.h       |   85 ++++++++++++++++++++++++++++++++++--
>  xen/include/public/trace.h         |    2 +
>  xen/include/xen/rwlock.h           |   33 +++++++++++---
>  8 files changed, 161 insertions(+), 20 deletions(-)
>
> diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
> index 374c1c0..81910c9 100644
> --- a/xen/Kconfig.debug
> +++ b/xen/Kconfig.debug
> @@ -98,7 +98,7 @@ config PERF_ARRAYS
>  	---help---
>  	  Enables software performance counter array histograms.
>
> -config TRACING
> +menuconfig TRACING
>  	bool "Tracing"
>  	default y
>  	---help---
> @@ -106,6 +106,15 @@ config TRACING
>  	  in per-CPU ring buffers. The 'xentrace' tool can be used to read
>  	  the buffers and dump the content on the disk.
>
> +config TRACE_IRQSOFF
> +	bool "Trace when IRQs are disabled and (re)enabled" if EXPERT = "y"
> +	default n
> +	depends on TRACING
> +	---help---
> +	  Makes it possible to generate events _every_ time IRQs are disabled
> +          and (re)enabled, with also an indication of where that happened.
> +          Note that this comes with high overead and produces huge amount of
> +          tracing data.
>
>  config VERBOSE_DEBUG
>  	bool "Verbose debug messages"
> diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
> index 2a06406..33b903e 100644
> --- a/xen/common/spinlock.c
> +++ b/xen/common/spinlock.c
> @@ -150,7 +150,9 @@ void _spin_lock(spinlock_t *lock)
>  void _spin_lock_irq(spinlock_t *lock)
>  {
>      ASSERT(local_irq_is_enabled());
> -    local_irq_disable();
> +    _local_irq_disable();
> +    if ( unlikely(tb_init_done) )

__trace_var already contain a "if ( !tb_init_done )". It sounds 
pointless to do it twice, and also I think it is not obvious to 
understand the meaning of the check (i.e what is tb_init_done).

Would it be possible to hide this check and avoid check tb_init_done twice?

> diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/asm-arm/arm32/system.h
> index c617b40..20871ad 100644
> --- a/xen/include/asm-arm/arm32/system.h
> +++ b/xen/include/asm-arm/arm32/system.h
> @@ -4,6 +4,8 @@
>
>  #include <asm/arm32/cmpxchg.h>
>
> +#include <xen/trace.h>
> +
>  #define local_irq_disable() asm volatile ( "cpsid i @ local_irq_disable\n" : : : "cc" )
>  #define local_irq_enable()  asm volatile ( "cpsie i @ local_irq_enable\n" : : : "cc" )
>
> @@ -41,6 +43,16 @@ static inline int local_irq_is_enabled(void)
>  #define local_abort_enable() __asm__("cpsie a  @ __sta\n" : : : "memory", "cc")
>  #define local_abort_disable() __asm__("cpsid a @ __sta\n" : : : "memory", "cc")
>
> +/* We do not support tracing (at all) yet */

I know that some bits are missing for ARM, but the patch #5 contradicts 
this comment as you have CONFIG_TRACE=y by default.

> +#define trace_irq_disable_ret()   do { } while ( 0 )
> +#define trace_irq_enable_ret()    do { } while ( 0 )
> +#define trace_irq_save_ret(_x)    do { } while ( 0 )
> +#define trace_irq_restore_ret(_x) do { } while ( 0 )
> +#define _local_irq_disable()      local_irq_disable()
> +#define _local_irq_enable()       local_irq_enable()
> +#define _local_irq_save(_x)       local_irq_save(_x)
> +#define _local_irq_restore(_x)    local_irq_restore(_x)
> +

This does not need to be duplicated in both asm-arm/arm{32,64}/system.h. 
You could directly implement them in asm-arm/system.h.

Also, I would prefer if you stay consistent with x86. I.e non-underscore 
versions are calling the underscore versions and not the invert.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-06-07 11:16 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 17:33 [PATCH 00/15] xen/tools: add tracing to various Xen subsystems Dario Faggioli
2017-06-01 17:33 ` [PATCH 01/15] xen: in do_softirq() sample smp_processor_id() once and for all Dario Faggioli
2017-06-07 14:38   ` Jan Beulich
2017-06-08 14:12     ` George Dunlap
2017-06-08 14:20   ` George Dunlap
2017-06-08 14:42     ` Jan Beulich
2017-06-01 17:33 ` [PATCH 02/15] xen: tracing: avoid checking tb_init_done multiple times Dario Faggioli
2017-06-01 17:53   ` Andrew Cooper
2017-06-01 23:08     ` Dario Faggioli
2017-06-07 14:46   ` Jan Beulich
2017-06-07 15:55     ` Dario Faggioli
2017-06-07 16:06       ` Jan Beulich
2017-06-08 14:34         ` George Dunlap
2017-06-08 14:37   ` George Dunlap
2017-06-01 17:33 ` [PATCH 03/15] xen/tools: tracing: several improvements on IRQs tracing Dario Faggioli
2017-06-01 18:02   ` Andrew Cooper
2017-06-01 23:12     ` Dario Faggioli
2017-06-07 15:05   ` Jan Beulich
2017-06-07 15:45     ` Dario Faggioli
2017-06-07 15:58       ` Jan Beulich
2017-06-08 14:53         ` George Dunlap
2017-06-08 15:34           ` Jan Beulich
2017-06-08 14:59   ` George Dunlap
2017-06-01 17:34 ` [PATCH 04/15] tools: xenalyze: fix dumping of PM_IDLE events Dario Faggioli
2017-06-08 15:06   ` George Dunlap
2017-06-01 17:34 ` [PATCH 05/15] xen: make it possible to disable tracing in Kconfig Dario Faggioli
2017-06-01 18:43   ` Andrew Cooper
2017-06-07 11:01     ` Julien Grall
2017-06-07 15:14   ` Jan Beulich
2017-06-08 15:16     ` George Dunlap
2017-06-08 15:35       ` Jan Beulich
2017-06-08 15:37         ` George Dunlap
2017-06-08 15:44           ` Jan Beulich
2017-06-08 15:17   ` George Dunlap
2017-06-01 17:34 ` [PATCH 06/15] xen: trace IRQ enabling/disabling Dario Faggioli
2017-06-01 19:08   ` Andrew Cooper
2017-06-01 23:42     ` Dario Faggioli
2017-06-08 15:51       ` George Dunlap
2017-06-08 16:05       ` Jan Beulich
2017-06-07 11:16   ` Julien Grall [this message]
2017-06-07 15:22     ` Dario Faggioli
2017-06-09 10:51       ` Julien Grall
2017-06-09 10:53         ` Julien Grall
2017-06-09 10:55         ` George Dunlap
2017-06-09 11:00           ` Julien Grall
2017-06-08 16:01   ` George Dunlap
2017-06-08 16:11     ` Dario Faggioli
2017-06-09 10:41   ` Jan Beulich
2017-06-01 17:34 ` [PATCH 07/15] tools: tracing: handle IRQs on/off events in xentrace and xenalyze Dario Faggioli
2017-06-13 15:58   ` George Dunlap
2017-06-01 17:34 ` [PATCH 08/15] xen: trace RCU behavior Dario Faggioli
2017-06-09 10:48   ` Jan Beulich
2017-06-13 16:05   ` George Dunlap
2017-06-01 17:34 ` [PATCH 09/15] tools: tracing: handle RCU events in xentrace and xenalyze Dario Faggioli
2017-06-13 16:12   ` George Dunlap
2017-06-01 17:34 ` [PATCH 10/15] xen: trace softirqs Dario Faggioli
2017-06-09 10:51   ` Jan Beulich
2017-06-01 17:34 ` [PATCH 11/15] tools: tracing: handle RCU events in xentrace and xenalyze Dario Faggioli
2017-06-01 17:35 ` [PATCH 12/15] xen: trace tasklets Dario Faggioli
2017-06-09 10:59   ` Jan Beulich
2017-06-09 11:17     ` Dario Faggioli
2017-06-09 11:29       ` Jan Beulich
2017-06-01 17:35 ` [PATCH 13/15] tools: tracing: handle tasklets events in xentrace and xenalyze Dario Faggioli
2017-06-01 17:35 ` [PATCH 14/15] xen: trace timers Dario Faggioli
2017-06-01 17:35 ` [PATCH 15/15] tools: tracing: handle timers events in xentrace and xenalyze Dario Faggioli
2017-06-07 14:13 ` [PATCH 00/15] xen/tools: add tracing to various Xen subsystems Konrad Rzeszutek Wilk
2017-06-08 16:45   ` Dario Faggioli
2017-06-13 16:34 ` George Dunlap

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=c550c738-73c2-fc74-6610-11718e7cd016@arm.com \
    --to=julien.grall@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jennifer.herbert@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).