All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Ian Campbell <ian.campbell@citrix.com>, xen-devel@lists.xen.org
Cc: tim@xen.org, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH] xen: arm: enable perf counters
Date: Thu, 15 May 2014 15:53:37 +0100	[thread overview]
Message-ID: <5374D4F1.2080104@linaro.org> (raw)
In-Reply-To: <1400163427-6310-1-git-send-email-ian.campbell@citrix.com>

On 05/15/2014 03:17 PM, Ian Campbell wrote:
> As well as the existing common perf counters add a bunch of ARM specifics,
> including the various trap types, vuart/vgic/vtimer accesses and different
> types of interrupt.

Performance counters in vgic don't make sense for me as we need to trap
it in any case.

But we might want perf counter in p2m_lookup because this function is
costly.

I would also add one in flush_tlb_* functions, such as flush_tlb_domain.
It will help us optimizing TLBs.

>      PSCI_RESULT_REG(regs) = psci_call(PSCI_ARGS(regs));
>  }
>  
> @@ -1135,15 +1138,19 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr,
>      register_t orig_pc = regs->pc;
>  #endif
>  
> +    BUILD_BUG_ON(NR_hypercalls < ARRAY_SIZE(arm_hypercall_table) );
> +
>      if ( iss != XEN_HYPERCALL_TAG )
>          domain_crash_synchronous();
>  
>      if ( *nr >= ARRAY_SIZE(arm_hypercall_table) )
>      {
> +        perfc_incr(invalid_hypercalls);
>          HYPERCALL_RESULT_REG(regs) = -ENOSYS;
>          return;
>      }
>  
> +    perfc_incra(hypercalls, *nr);
>      call = arm_hypercall_table[*nr].fn;
>      if ( call == NULL )
>      {
> @@ -1283,8 +1290,10 @@ static int check_conditional_instr(struct cpu_user_regs *regs, union hsr hsr)
>      cpsr_cond = cpsr >> 28;
>  
>      if ( !((cc_map[cond] >> cpsr_cond) & 1) )
> +    {
> +        perfc_incr(trap_uncond);

trap_uncond alone doesn't have much meaning. Can you add a perf_counter
to count the number of call for this function (i.e check_conditional_instr)?

>          return 0;
> -
> +    }
>      return 1;
>  }
>  
> @@ -1664,6 +1673,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
>  
>      switch (hsr.ec) {
>      case HSR_EC_WFI_WFE:
> +        perfc_incr(trap_wfi_wfe);

Can you add a perf counter to count the number of WFI and WFE? (actually
the last one is not trap for now).

>          if ( !check_conditional_instr(regs, hsr) )
>          {
>              advance_pc(regs, hsr);
> @@ -1684,38 +1694,51 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
>      case HSR_EC_CP15_32:
>          if ( !is_32bit_domain(current->domain) )
>              goto bad_trap;
> +        perfc_incr(trap_cp15_32);
>          do_cp15_32(regs, hsr);
>          break;
>      case HSR_EC_CP15_64:
>          if ( !is_32bit_domain(current->domain) )
>              goto bad_trap;
> +        perfc_incr(trap_cp15_32);

Did you mean trap_cp15_64?

[..]

>      case HSR_EC_HVC32:
> +        perfc_incr(trap_hvc32);
>  #ifndef NDEBUG
>          if ( (hsr.iss & 0xff00) == 0xff00 )
>              return do_debug_trap(regs, hsr.iss & 0x00ff);
>  #endif
>          if ( hsr.iss == 0 )
>              return do_trap_psci(regs);
> +

Spurious change?

[..]

>      case HSR_EC_INSTR_ABORT_LOWER_EL:
> +        perfc_incr(trap_iabt);
>          do_trap_instr_abort_guest(regs, hsr);
>          break;
>      case HSR_EC_DATA_ABORT_LOWER_EL:
> +        perfc_incr(trap_dabt);
>          do_trap_data_abort_guest(regs, hsr);
>          break;
>      default:
>   bad_trap:
> +        perfc_incr(trap_bad);

The perfc_incr seems pointless here. Indeed, do_unexcepted_trap will
basically break the current PCPU and can be worst when it's occurs on CPU0.

[..]

> diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
> index ef291ff..0de6f7e 100644
> --- a/xen/include/asm-arm/config.h
> +++ b/xen/include/asm-arm/config.h
> @@ -178,6 +178,8 @@
>  #define PAGE_MASK           (~(PAGE_SIZE-1))
>  #define PAGE_FLAG_MASK      (~0)
>  
> +#define NR_hypercalls 64
> +

Should not it be define in common code?

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-05-15 14:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15 14:17 [PATCH] xen: arm: enable perf counters Ian Campbell
2014-05-15 14:53 ` Julien Grall [this message]
2014-05-15 15:30   ` Ian Campbell
2014-05-15 15:52     ` Julien Grall
  -- strict thread matches above, loose matches on Subject: below --
2014-05-15 15:29 Ian Campbell
2014-05-15 15:48 ` Ian Campbell

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=5374D4F1.2080104@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.