qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, richard.henderson@linaro.org,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH v9 00/10] PMU-EBB support for PPC64 TCG
Date: Fri, 03 Dec 2021 10:03:32 -0300	[thread overview]
Message-ID: <87r1atj0wr.fsf@linux.ibm.com> (raw)
In-Reply-To: <27d2eb41-f34a-5c2d-e1f1-977f08ac58d8@kaod.org>

Cédric Le Goater <clg@kaod.org> writes:

> Hello,
>
> On 12/1/21 16:17, Daniel Henrique Barboza wrote:
>> Hi,
>> 
>> In this new version the most significant change is in patch 6,
>> where a new hflag allows us to not call the instruction helper
>> inside translate.c unless we're absolutely certain that there
>> is an instruction count event being sampled and active in the
>> PMU. This change turned out to be a big boost in performance
>> in the PMU emulation overall, most notably when dealing with
>> cycle events that were calling the helper needlessly.
>> 
>> This and all other changes were suggested by David in his review
>> of the previous version.
>
>
> patch 1-8 look good. I still have some questions on the exception
> handling and how EBB are gated.
>
> I am asking to get the model right for the next step which should
> be to modify the XIVE interrupt controller to generate External
> EBB exceptions.
>
> One more comment, not for now, since the EBB patchset is nearly
> ready.
>
> May be, it is time to think about introducing a per-CPU model
> excp_handlers[] array indexed by POWERPC_EXCP_* exception
> numbers and to duplicate some code for the sake of clarity.
>
> Fabiano, isn't it what you had in mind ?

I had basically changed env->excp_vectors to be an array of objects of
the kind:

  struct PPCInterrupt {
      Object parent;
  
      int id;
      const char *name;
      target_ulong addr;
      ppc_intr_fn_t setup_regs;
  };

we would access it from powerpc_excp() with:

  intr = &env->excp_vectors[excp];
  if (intr->setup_regs) {
      intr->setup_regs(cpu, intr, excp_model, &regs, &ignore);
  }

I also had another series to move the exception models into QOM like
this:

  struct PPCIntrModel {
      Object parent;
  
      int id;
      const char *name;
      target_ulong hreset_vector;
      target_ulong ivor_mask;
      target_ulong ivpr_mask;
      target_ulong excp_prefix;
      PPCInterrupt excp_vectors[POWERPC_EXCP_NB];
  };

  struct PPCIntrModelClass {
      ObjectClass parent_class;
  
      bool (*intr_little_endian)(CPUPPCState *env, bool hv);
      bool (*lpar_env_selection)(CPUPPCState *env);
      target_ulong (*filter_msr)(CPUPPCState *env);
      bool (*set_sixty_four_bit_mode)(CPUPPCState *env, target_ulong *msr);
      bool (*set_ail)(CPUPPCState *env, bool mmu_all_on, bool hv_escalation,
                      bool hv, int *_ail);
      void (*prepare_tlb_miss)(PowerPCCPU *cpu, int excp, target_ulong *new_msr,
                               target_ulong *msr);
      void (*debug_software_tlb)(CPUPPCState *env, int excp);
      void (*init_excp)(PPCIntrModel *im);
  };

So the powerpc_excp() code would become:

    PPCIntrModel *intr_model = &env->im;
    PPCInterrupt *intr;
    ...

    intr = &intr_model->entry_points[excp];
    if (!intr->setup_regs) {
        cpu_abort(cs, "Raised an exception without defined vector %d\n",
                  excp);
    }

    regs.new_nip = intr->addr | intr_model->excp_prefix;
    intr->setup_regs(cpu, intr, intr_model, &regs, &ignore);

I'll rebase it all and work on reducing some of the complexity around
QOM, which was pointed out by David in the previous version:

https://lists.nongnu.org/archive/html/qemu-ppc/2021-06/msg00140.html

Any other suggestions are welcome.

>
> Thanks,
>
> C.


  reply	other threads:[~2021-12-03 13:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 15:17 [PATCH v9 00/10] PMU-EBB support for PPC64 TCG Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 01/10] target/ppc: introduce PMUEventType and PMU overflow timers Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 02/10] target/ppc: PMU basic cycle count for pseries TCG Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 03/10] target/ppc: PMU: update counters on PMCs r/w Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 04/10] target/ppc: PMU: update counters on MMCR1 write Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 05/10] target/ppc: enable PMU counter overflow with cycle events Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 06/10] target/ppc: enable PMU instruction count Daniel Henrique Barboza
2021-12-02  2:42   ` David Gibson
2021-12-01 15:17 ` [PATCH v9 07/10] target/ppc/power8-pmu.c: add PM_RUN_INST_CMPL (0xFA) event Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 08/10] PPC64/TCG: Implement 'rfebb' instruction Daniel Henrique Barboza
2021-12-01 15:17 ` [PATCH v9 09/10] target/ppc: PMU Event-Based exception support Daniel Henrique Barboza
2021-12-03  9:27   ` Cédric Le Goater
2021-12-09  1:51   ` David Gibson
2021-12-01 15:17 ` [PATCH v9 10/10] target/ppc/excp_helper.c: EBB handling adjustments Daniel Henrique Barboza
2021-12-09  1:52   ` David Gibson
2021-12-14 20:05     ` Daniel Henrique Barboza
2021-12-03  9:37 ` [PATCH v9 00/10] PMU-EBB support for PPC64 TCG Cédric Le Goater
2021-12-03 13:03   ` Fabiano Rosas [this message]
2021-12-15 16:54 ` Cédric Le Goater

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=87r1atj0wr.fsf@linux.ibm.com \
    --to=farosas@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.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).