Re: [PATCH v3 1/2] powerpc: Emulation support for load/store instructions on LE

From: Ravi Bangoria
Date: Tue Feb 14 2017 - 06:37:26 EST


Thanks Michael,

On Tuesday 14 February 2017 03:50 PM, Michael Ellerman wrote:
> Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxxxxxxx> writes:
>
>> emulate_step() uses a number of underlying kernel functions that were
>> initially not enabled for LE. This has been rectified since.
> When exactly? ie. which commit.

I found couple of commits:

6506b4718b ("powerpc: Fix Unaligned Loads and Stores")
dbc2fbd7c2 ("powerpc: Fix Unaligned LE Floating Point Loads and Stores")

There may be more.

Patch2 is to test emulate_step() for basic load/store instructions and it
seems to be working fine on LE.

>
> Should we backport this? ie. is it actually a bug people are hitting in
> the real world much?

Yes, we should backport this. kernel-space hw-breakpoint feature is broken
on LE without this. This is on ppc64le:

$ sudo cat /proc/kallsyms | grep pid_max
c00000000116998c D pid_max

$ sudo ./perf record -a --event=mem:0xc00000000116998c sleep 10


Before patch:
It does not record any data and throws below warning.

$ dmesg
[ 817.895573] Unable to handle hardware breakpoint. Breakpoint at 0xc00000000116998c will be disabled.
[ 817.895581] ------------[ cut here ]------------
[ 817.895588] WARNING: CPU: 24 PID: 2032 at arch/powerpc/kernel/hw_breakpoint.c:277 hw_breakpoint_handler+0x124/0x230
...

After patch:
It records data properly.

$ sudo ./perf report --stdio
...
# Samples: 36 of event 'mem:0xc00000000116998c'
# Event count (approx.): 36
#
# Overhead Command Shared Object Symbol
# ........ ............. ................ .............
#
63.89% kdumpctl [kernel.vmlinux] [k] alloc_pid
27.78% opal_errd [kernel.vmlinux] [k] alloc_pid
5.56% kworker/u97:4 [kernel.vmlinux] [k] alloc_pid
2.78% systemd [kernel.vmlinux] [k] alloc_pid



>
> cheers
>