Re: [PATCH v3 0/4] Add BHRB Facility Support

2024-02-05 Thread Nicholas Piggin
On Tue Sep 26, 2023 at 3:43 AM AEST, Glenn Miles wrote:
> This is a series of patches for adding support for the Branch History
> Rolling Buffer (BHRB) facility.  This was added to the Power ISA
> starting with version 2.07.  Changes were subsequently made in version
> 3.1 to limit BHRB recording to instructions run in problem state only
> and to add a control bit to disable recording (MMCRA[BHRBRD]).
>
> Version 3 of this series disables branch recording on P8 and P9 due
> to a drop in performance caused by recording branches outside of
> problem state.

For this series,

Reviewed-by: Nicholas Piggin 

I finally got around to adding powerpc MMU support to kvm unit tests,
so userspace and basic BHRB tests weren't much more work. Easier than
testing it with perf in Linux!

https://gitlab.com/npiggin/kvm-unit-tests.git powerpc

Thanks,
Nick

>
> Glenn Miles (4):
>   target/ppc: Add new hflags to support BHRB
>   target/ppc: Add recording of taken branches to BHRB
>   target/ppc: Add clrbhrb and mfbhrbe instructions
>   target/ppc: Add migration support for BHRB
>
>  target/ppc/cpu.h   |  24 ++
>  target/ppc/cpu_init.c  |  39 +-
>  target/ppc/helper.h|   5 ++
>  target/ppc/helper_regs.c   |  35 +
>  target/ppc/insn32.decode   |   8 ++
>  target/ppc/machine.c   |  23 +-
>  target/ppc/misc_helper.c   |  46 +++
>  target/ppc/power8-pmu-regs.c.inc   |   5 ++
>  target/ppc/power8-pmu.c|  48 +++-
>  target/ppc/power8-pmu.h|  11 ++-
>  target/ppc/spr_common.h|   1 +
>  target/ppc/translate.c | 101 +++--
>  target/ppc/translate/bhrb-impl.c.inc   |  43 +++
>  target/ppc/translate/branch-impl.c.inc |   2 +-
>  14 files changed, 374 insertions(+), 17 deletions(-)
>  create mode 100644 target/ppc/translate/bhrb-impl.c.inc




Re: [PATCH v3 0/4] Add BHRB Facility Support

2023-11-27 Thread Nicholas Piggin
On Tue Nov 28, 2023 at 6:51 AM AEST, Miles Glenn wrote:
> On Wed, 2023-10-18 at 10:59 -0500, Miles Glenn wrote:
> > On Thu, 2023-10-19 at 01:06 +1000, Nicholas Piggin wrote:
> > > On Tue Sep 26, 2023 at 3:43 AM AEST, Glenn Miles wrote:
> > > > This is a series of patches for adding support for the Branch
> > > > History
> > > > Rolling Buffer (BHRB) facility.  This was added to the Power ISA
> > > > starting with version 2.07.  Changes were subsequently made in
> > > > version
> > > > 3.1 to limit BHRB recording to instructions run in problem state
> > > > only
> > > > and to add a control bit to disable recording (MMCRA[BHRBRD]).
> > > > 
> > > > Version 3 of this series disables branch recording on P8 and P9
> > > > due
> > > > to a drop in performance caused by recording branches outside of
> > > > problem state.
> > > 
> > > Thanks for these, they all look good to me.
> > > 
> > > With P10 CPU, Linux perf branch recording appears to work with this
> > > series, and I confirmed that Linux does disable BHRB in MMCRA at
> > > boot, so it should not take the performance hit.
> > > 
> > > It had a couple of compile bugs, no matter I fixed them, but I
> > > often
> > > trip overppc32 and user-mode when working on TCG too, so building
> > > with --target-list including ppc64-softmmu,ppc-softmmu,
> > > ppc64-linux-user,ppc64le-linux-user,ppc-linux-user is good to catch
> > > those.
> > > 
> > > Thanks,
> > > Nick
> > > 
> > 
> > Thanks, Nick.  I'll have to remember that for next time!
> > 
> > Glenn
> > 
>
> Hi Nick,
>
> Is there anything else you need me to do for this series to be merged?

Hey Glenn,

No, sorry I just missed this cycle. I have it queued up, it'll have to
go in after 8.2 release.

Thanks,
Nick



Re: [PATCH v3 0/4] Add BHRB Facility Support

2023-11-27 Thread Miles Glenn
On Wed, 2023-10-18 at 10:59 -0500, Miles Glenn wrote:
> On Thu, 2023-10-19 at 01:06 +1000, Nicholas Piggin wrote:
> > On Tue Sep 26, 2023 at 3:43 AM AEST, Glenn Miles wrote:
> > > This is a series of patches for adding support for the Branch
> > > History
> > > Rolling Buffer (BHRB) facility.  This was added to the Power ISA
> > > starting with version 2.07.  Changes were subsequently made in
> > > version
> > > 3.1 to limit BHRB recording to instructions run in problem state
> > > only
> > > and to add a control bit to disable recording (MMCRA[BHRBRD]).
> > > 
> > > Version 3 of this series disables branch recording on P8 and P9
> > > due
> > > to a drop in performance caused by recording branches outside of
> > > problem state.
> > 
> > Thanks for these, they all look good to me.
> > 
> > With P10 CPU, Linux perf branch recording appears to work with this
> > series, and I confirmed that Linux does disable BHRB in MMCRA at
> > boot, so it should not take the performance hit.
> > 
> > It had a couple of compile bugs, no matter I fixed them, but I
> > often
> > trip overppc32 and user-mode when working on TCG too, so building
> > with --target-list including ppc64-softmmu,ppc-softmmu,
> > ppc64-linux-user,ppc64le-linux-user,ppc-linux-user is good to catch
> > those.
> > 
> > Thanks,
> > Nick
> > 
> 
> Thanks, Nick.  I'll have to remember that for next time!
> 
> Glenn
> 

Hi Nick,

Is there anything else you need me to do for this series to be merged?

Thanks,

Glenn

> > > Glenn Miles (4):
> > >   target/ppc: Add new hflags to support BHRB
> > >   target/ppc: Add recording of taken branches to BHRB
> > >   target/ppc: Add clrbhrb and mfbhrbe instructions
> > >   target/ppc: Add migration support for BHRB
> > > 
> > >  target/ppc/cpu.h   |  24 ++
> > >  target/ppc/cpu_init.c  |  39 +-
> > >  target/ppc/helper.h|   5 ++
> > >  target/ppc/helper_regs.c   |  35 +
> > >  target/ppc/insn32.decode   |   8 ++
> > >  target/ppc/machine.c   |  23 +-
> > >  target/ppc/misc_helper.c   |  46 +++
> > >  target/ppc/power8-pmu-regs.c.inc   |   5 ++
> > >  target/ppc/power8-pmu.c|  48 +++-
> > >  target/ppc/power8-pmu.h|  11 ++-
> > >  target/ppc/spr_common.h|   1 +
> > >  target/ppc/translate.c | 101
> > > +++--
> > >  target/ppc/translate/bhrb-impl.c.inc   |  43 +++
> > >  target/ppc/translate/branch-impl.c.inc |   2 +-
> > >  14 files changed, 374 insertions(+), 17 deletions(-)
> > >  create mode 100644 target/ppc/translate/bhrb-impl.c.inc




Re: [PATCH v3 0/4] Add BHRB Facility Support

2023-10-18 Thread Miles Glenn
On Thu, 2023-10-19 at 01:06 +1000, Nicholas Piggin wrote:
> On Tue Sep 26, 2023 at 3:43 AM AEST, Glenn Miles wrote:
> > This is a series of patches for adding support for the Branch
> > History
> > Rolling Buffer (BHRB) facility.  This was added to the Power ISA
> > starting with version 2.07.  Changes were subsequently made in
> > version
> > 3.1 to limit BHRB recording to instructions run in problem state
> > only
> > and to add a control bit to disable recording (MMCRA[BHRBRD]).
> > 
> > Version 3 of this series disables branch recording on P8 and P9 due
> > to a drop in performance caused by recording branches outside of
> > problem state.
> 
> Thanks for these, they all look good to me.
> 
> With P10 CPU, Linux perf branch recording appears to work with this
> series, and I confirmed that Linux does disable BHRB in MMCRA at
> boot, so it should not take the performance hit.
> 
> It had a couple of compile bugs, no matter I fixed them, but I often
> trip overppc32 and user-mode when working on TCG too, so building
> with --target-list including ppc64-softmmu,ppc-softmmu,
> ppc64-linux-user,ppc64le-linux-user,ppc-linux-user is good to catch
> those.
> 
> Thanks,
> Nick
> 

Thanks, Nick.  I'll have to remember that for next time!

Glenn

> > Glenn Miles (4):
> >   target/ppc: Add new hflags to support BHRB
> >   target/ppc: Add recording of taken branches to BHRB
> >   target/ppc: Add clrbhrb and mfbhrbe instructions
> >   target/ppc: Add migration support for BHRB
> > 
> >  target/ppc/cpu.h   |  24 ++
> >  target/ppc/cpu_init.c  |  39 +-
> >  target/ppc/helper.h|   5 ++
> >  target/ppc/helper_regs.c   |  35 +
> >  target/ppc/insn32.decode   |   8 ++
> >  target/ppc/machine.c   |  23 +-
> >  target/ppc/misc_helper.c   |  46 +++
> >  target/ppc/power8-pmu-regs.c.inc   |   5 ++
> >  target/ppc/power8-pmu.c|  48 +++-
> >  target/ppc/power8-pmu.h|  11 ++-
> >  target/ppc/spr_common.h|   1 +
> >  target/ppc/translate.c | 101
> > +++--
> >  target/ppc/translate/bhrb-impl.c.inc   |  43 +++
> >  target/ppc/translate/branch-impl.c.inc |   2 +-
> >  14 files changed, 374 insertions(+), 17 deletions(-)
> >  create mode 100644 target/ppc/translate/bhrb-impl.c.inc




Re: [PATCH v3 0/4] Add BHRB Facility Support

2023-10-18 Thread Nicholas Piggin
On Tue Sep 26, 2023 at 3:43 AM AEST, Glenn Miles wrote:
> This is a series of patches for adding support for the Branch History
> Rolling Buffer (BHRB) facility.  This was added to the Power ISA
> starting with version 2.07.  Changes were subsequently made in version
> 3.1 to limit BHRB recording to instructions run in problem state only
> and to add a control bit to disable recording (MMCRA[BHRBRD]).
>
> Version 3 of this series disables branch recording on P8 and P9 due
> to a drop in performance caused by recording branches outside of
> problem state.

Thanks for these, they all look good to me.

With P10 CPU, Linux perf branch recording appears to work with this
series, and I confirmed that Linux does disable BHRB in MMCRA at
boot, so it should not take the performance hit.

It had a couple of compile bugs, no matter I fixed them, but I often
trip overppc32 and user-mode when working on TCG too, so building
with --target-list including ppc64-softmmu,ppc-softmmu,
ppc64-linux-user,ppc64le-linux-user,ppc-linux-user is good to catch
those.

Thanks,
Nick

>
> Glenn Miles (4):
>   target/ppc: Add new hflags to support BHRB
>   target/ppc: Add recording of taken branches to BHRB
>   target/ppc: Add clrbhrb and mfbhrbe instructions
>   target/ppc: Add migration support for BHRB
>
>  target/ppc/cpu.h   |  24 ++
>  target/ppc/cpu_init.c  |  39 +-
>  target/ppc/helper.h|   5 ++
>  target/ppc/helper_regs.c   |  35 +
>  target/ppc/insn32.decode   |   8 ++
>  target/ppc/machine.c   |  23 +-
>  target/ppc/misc_helper.c   |  46 +++
>  target/ppc/power8-pmu-regs.c.inc   |   5 ++
>  target/ppc/power8-pmu.c|  48 +++-
>  target/ppc/power8-pmu.h|  11 ++-
>  target/ppc/spr_common.h|   1 +
>  target/ppc/translate.c | 101 +++--
>  target/ppc/translate/bhrb-impl.c.inc   |  43 +++
>  target/ppc/translate/branch-impl.c.inc |   2 +-
>  14 files changed, 374 insertions(+), 17 deletions(-)
>  create mode 100644 target/ppc/translate/bhrb-impl.c.inc




[PATCH v3 0/4] Add BHRB Facility Support

2023-09-25 Thread Glenn Miles
This is a series of patches for adding support for the Branch History
Rolling Buffer (BHRB) facility.  This was added to the Power ISA
starting with version 2.07.  Changes were subsequently made in version
3.1 to limit BHRB recording to instructions run in problem state only
and to add a control bit to disable recording (MMCRA[BHRBRD]).

Version 3 of this series disables branch recording on P8 and P9 due
to a drop in performance caused by recording branches outside of
problem state.

Glenn Miles (4):
  target/ppc: Add new hflags to support BHRB
  target/ppc: Add recording of taken branches to BHRB
  target/ppc: Add clrbhrb and mfbhrbe instructions
  target/ppc: Add migration support for BHRB

 target/ppc/cpu.h   |  24 ++
 target/ppc/cpu_init.c  |  39 +-
 target/ppc/helper.h|   5 ++
 target/ppc/helper_regs.c   |  35 +
 target/ppc/insn32.decode   |   8 ++
 target/ppc/machine.c   |  23 +-
 target/ppc/misc_helper.c   |  46 +++
 target/ppc/power8-pmu-regs.c.inc   |   5 ++
 target/ppc/power8-pmu.c|  48 +++-
 target/ppc/power8-pmu.h|  11 ++-
 target/ppc/spr_common.h|   1 +
 target/ppc/translate.c | 101 +++--
 target/ppc/translate/bhrb-impl.c.inc   |  43 +++
 target/ppc/translate/branch-impl.c.inc |   2 +-
 14 files changed, 374 insertions(+), 17 deletions(-)
 create mode 100644 target/ppc/translate/bhrb-impl.c.inc

-- 
2.31.1