[PATCH 1/5] Powerpc/hw-breakpoint: Replace stale do_dabr() with do_break()

2019-06-17 Thread Ravi Bangoria
do_dabr() was renamed with do_break() long ago. But I still see some comments mentioning do_dabr(). Replace it. Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/hw_breakpoint.c | 2 +- arch/powerpc/kernel/ptrace.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH 5/5] Powerpc/Watchpoint: Fix length calculation for unaligned target

2019-06-17 Thread Ravi Bangoria
including next doubleword in the length. Watchpoint exception handler already ignores extraneous exceptions, so no changes required for that. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/hw_breakpoint.h | 7 ++-- arch/powerpc/kernel/hw_breakpoint.c | 44 +---

[PATCH 3/5] Powerpc/hw-breakpoint: Refactor set_dawr()

2019-06-17 Thread Ravi Bangoria
Remove unnecessary comments. Code itself is self explanatory. And, ISA already talks about MRD field. I Don't think we need to re-describe it. Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/process.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git

Re: [PATCH 2/5] Powerpc/hw-breakpoint: Refactor hw_breakpoint_arch_parse()

2019-06-18 Thread Ravi Bangoria
On 6/18/19 11:51 AM, Christophe Leroy wrote: > > > Le 18/06/2019 à 06:27, Ravi Bangoria a écrit : >> Move feature availability check at the start of the function. >> Rearrange comment to it's associated code. Use hw->address and >> hw->len in the 512 bytes bou

Re: [PATCH 3/5] Powerpc/hw-breakpoint: Refactor set_dawr()

2019-06-18 Thread Ravi Bangoria
On 6/18/19 11:41 AM, Michael Neuling wrote: > This is going to collide with this patch > https://patchwork.ozlabs.org/patch/1109594/ Yeah, I'm aware of the patch. I just developed this on powerpc/next. I'll rebase my patches accordingly once mpe picks up that patche.

[PATCH v2 1/2] Powerpc/Watchpoint: Fix length calculation for unaligned target

2019-07-01 Thread Ravi Bangoria
including next doubleword in the length. Watchpoint exception handler already ignores extraneous exceptions, so no changes required for that. Signed-off-by: Ravi Bangoria --- v1->v2: - v1: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-June/192162.html - No cosmetic patches. - v1 fi

[PATCH v2 2/2] Powerpc/Watchpoint: Rewrite ptrace-hwbreak.c selftest

2019-07-01 Thread Ravi Bangoria
UNALIGNED, WO, len: 6: Ok PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW UNALIGNED, RO, len: 6: Ok PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW UNALIGNED, RW, len: 6: Ok PPC_PTRACE_SETHWDEBUG, DAWR_MAX_LEN, RW, len: 512: Ok success: ptrace-hwbreak Signed-off-by: Ravi Bangoria --- .../selftests/powerpc/ptrace

Re: [RFC PATCH v2 09/12] powerpc/ptrace: split out ADV_DEBUG_REGS related functions.

2019-07-02 Thread Ravi Bangoria
On 6/28/19 9:17 PM, Christophe Leroy wrote: > diff --git a/arch/powerpc/kernel/ptrace/ptrace-adv.c > b/arch/powerpc/kernel/ptrace/ptrace-adv.c > new file mode 100644 > index ..86e71fa6c5c8 > --- /dev/null > +++ b/arch/powerpc/kernel/ptrace/ptrace-adv.c > @@ -0,0 +1,487 @@ > +/*

Re: [RFC PATCH v2 10/12] powerpc/ptrace: create ptrace_get_debugreg()

2019-07-02 Thread Ravi Bangoria
- ret = put_user(child->thread.debug.dac1, datalp); > -#else > - dabr_fake = ((child->thread.hw_brk.address & > (~HW_BRK_TYPE_DABR)) | > - (child->thread.hw_brk.type & HW_BRK_TYPE_DABR)); > - ret = put_user(dabr_fake, datalp); > -#endif > + case PTRACE_GET_DEBUGREG: > + ret = ptrace_get_debugreg(child, addr, datalp); > break; > - } > > case PTRACE_SET_DEBUGREG: > ret = ptrace_set_debugreg(child, addr, data); > Otherwise, Reviewed-by: Ravi Bangoria

Re: [RFC PATCH v2 12/12] powerpc/ptrace: move ptrace_triggered() into hw_breakpoint.c

2019-07-02 Thread Ravi Bangoria
On 6/28/19 9:18 PM, Christophe Leroy wrote: > ptrace_triggered() is declared in asm/hw_breakpoint.h and > only needed when CONFIG_HW_BREAKPOINT is set, so move it > into hw_breakpoint.c > > Signed-off-by: Christophe Leroy Reviewed-by: Ravi Bangoria

Re: [RFC PATCH v2 11/12] powerpc/ptrace: create ppc_gethwdinfo()

2019-07-02 Thread Ravi Bangoria
On 6/28/19 9:18 PM, Christophe Leroy wrote: > Create ippc_gethwdinfo() to handle PPC_PTRACE_GETHWDBGINFO and > reduce ifdef mess > > Signed-off-by: Christophe Leroy > --- Reviewed-by: Ravi Bangoria

Re: Reminder: 22 open syzbot bugs in perf subsystem

2019-07-02 Thread Ravi Bangoria
On 7/2/19 11:13 AM, Eric Biggers wrote: > > Title: possible deadlock in uprobe_clear_state > Last occurred: 164 days ago > Reported: 201 days ago > Branches: Mainline >

Re: Reminder: 22 open syzbot bugs in perf subsystem

2019-07-02 Thread Ravi Bangoria
Hi Eric, On 7/3/19 9:25 AM, Eric Biggers wrote: > On Wed, Jul 03, 2019 at 09:09:55AM +0530, Ravi Bangoria wrote: >> >> >> On 7/2/19 11:13 AM, Eric Biggers wrote: >>> >>>

Re: Reminder: 22 open syzbot bugs in perf subsystem

2019-07-02 Thread Ravi Bangoria
On 7/3/19 9:49 AM, Eric Biggers wrote: > On Wed, Jul 03, 2019 at 09:29:39AM +0530, Ravi Bangoria wrote: >> Hi Eric, >> >> On 7/3/19 9:25 AM, Eric Biggers wrote: >>> On Wed, Jul 03, 2019 at 09:09:55AM +0530, Ravi Bangoria wrote: >>>> >&g

Re: [PATCH] powerpc/hw_breakpoint: move instruction stepping out of hw_breakpoint_handler()

2019-07-03 Thread Ravi Bangoria
On 6/28/19 9:25 PM, Christophe Leroy wrote: > On 8xx, breakpoints stop after executing the instruction, so > stepping/emulation is not needed. Move it into a sub-function and > remove the #ifdefs. > > Signed-off-by: Christophe Leroy > --- Reviewed-by: Ravi Bangoria J

Re: [RFC PATCH v2 00/12] Reduce ifdef mess in ptrace

2019-07-03 Thread Ravi Bangoria
On 6/28/19 9:17 PM, Christophe Leroy wrote: > The purpose of this series is to reduce the amount of #ifdefs > in ptrace.c > > This is a first try. Most of it is done, there are still some #ifdefs that > could go away. > > Please comment and tell whether it is worth continuing in that

[PATCH] Powerpc/Watchpoint: Restore nvgprs while returning from exception

2019-06-06 Thread Ravi Bangoria
thread+0x444/0x560 kthread+0x160/0x1a0 ret_from_kernel_thread+0x5c/0x70 Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/exceptions-64s.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 9

Re: [PATCH] Powerpc/Watchpoint: Restore nvgprs while returning from exception

2019-06-06 Thread Ravi Bangoria
On 6/6/19 12:59 PM, Ravi Bangoria wrote: > Powerpc hw triggers watchpoint before executing the instruction. > To make trigger-after-execute behavior, kernel emulates the > instruction. If the instruction is 'load something into non- > volatile register', exception handler sh

Re: [PATCH] Powerpc/Watchpoint: Restore nvgprs while returning from exception

2019-06-06 Thread Ravi Bangoria
On 6/7/19 6:20 AM, Michael Neuling wrote: > On Thu, 2019-06-06 at 12:59 +0530, Ravi Bangoria wrote: >> Powerpc hw triggers watchpoint before executing the instruction. >> To make trigger-after-execute behavior, kernel emulates the >> instruction. If the instruction is 'lo

Re: [PATCH] Powerpc/Watchpoint: Restore nvgprs while returning from exception

2019-06-07 Thread Ravi Bangoria
On 6/7/19 11:20 AM, Michael Ellerman wrote: > Ravi Bangoria writes: > >> Powerpc hw triggers watchpoint before executing the instruction. >> To make trigger-after-execute behavior, kernel emulates the >> instruction. If the instruction is 'load something into n

[PATCH v2] perf ioctl: Add check for the sample_period value

2019-06-03 Thread Ravi Bangoria
erf-fuzzer). Signed-off-by: Ravi Bangoria --- kernel/events/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index abbd4b3b96c2..e44c90378940 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -5005,6 +5005,9 @@ static int perf_ev

Re: [PATCH] powerpc/hw_breakpoint: move instruction stepping out of hw_breakpoint_handler()

2019-07-07 Thread Ravi Bangoria
On 7/6/19 1:56 PM, Christophe Leroy wrote: > > > Le 03/07/2019 à 08:20, Ravi Bangoria a écrit : >> >> >> On 6/28/19 9:25 PM, Christophe Leroy wrote: >>> On 8xx, breakpoints stop after executing the instruction, so >>> stepping/emulati

Re: [PATCH 4/5] Powerpc/hw-breakpoint: Optimize disable path

2019-06-19 Thread Ravi Bangoria
On 6/18/19 11:45 AM, Michael Neuling wrote: > On Tue, 2019-06-18 at 09:57 +0530, Ravi Bangoria wrote: >> Directly setting dawr and dawrx with 0 should be enough to >> disable watchpoint. No need to reset individual bits in >> variable and then set in hw. > >

Re: [PATCH 4/5] Powerpc/hw-breakpoint: Optimize disable path

2019-06-19 Thread Ravi Bangoria
On 6/18/19 12:01 PM, Christophe Leroy wrote: >> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c >> index f002d286..265fac9fb3a4 100644 >> --- a/arch/powerpc/kernel/process.c >> +++ b/arch/powerpc/kernel/process.c >> @@ -793,10 +793,22 @@ static inline int

Re: [PATCH 5/5] Powerpc/Watchpoint: Fix length calculation for unaligned target

2019-06-19 Thread Ravi Bangoria
On 6/18/19 12:16 PM, Christophe Leroy wrote: >>   +/* Maximum len for DABR is 8 bytes and DAWR is 512 bytes */ >> +static int hw_breakpoint_validate_len(struct arch_hw_breakpoint *hw) >> +{ >> +    u16 length_max = 8; >> +    u16 final_len; > > You should be more consistent in naming. If one is

Re: [PATCH 5/5] Powerpc/Watchpoint: Fix length calculation for unaligned target

2019-06-19 Thread Ravi Bangoria
On 6/18/19 7:02 PM, Michael Neuling wrote: > On Tue, 2019-06-18 at 09:57 +0530, Ravi Bangoria wrote: >> Watchpoint match range is always doubleword(8 bytes) aligned on >> powerpc. If the given range is crossing doubleword boundary, we >> need to increase the length such

Re: [PATCH 0/5] Powerpc/hw-breakpoint: Fixes plus Code refactor

2019-06-19 Thread Ravi Bangoria
On 6/18/19 11:47 AM, Michael Neuling wrote: > On Tue, 2019-06-18 at 08:01 +0200, Christophe Leroy wrote: >> >> Le 18/06/2019 à 06:27, Ravi Bangoria a écrit : >>> patch 1-3: Code refactor >>> patch 4: Speedup disabling breakpoint >>> patch 5: Fi

Re: [PATCH 2/2] powerpc/perf: Add support for outputting extended regs in perf intr_regs

2020-05-05 Thread Ravi Bangoria
uot; + [PERF_REG_POWERPC_MMCRA] = "mmcra", + [PERF_REG_POWERPC_MMCR0] = "mmcr0", + [PERF_REG_POWERPC_MMCR1] = "mmcr1", + [PERF_REG_POWERPC_MMCR2] = "mmcr2", + Unnecesasy line. Apart from those, for the series: Reviewed-and-Tested-by: Ravi Bangoria

[PATCH] perf powerpc: Don't ignore sym-handling.c file

2020-05-09 Thread Ravi Bangoria
solidate symbol fixup issue") Reported-by: Sandipan Das Signed-off-by: Ravi Bangoria --- tools/perf/arch/powerpc/util/Build | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build index e5c9504f8586..e86e210bf514 100644 -

[PATCH v5 02/16] powerpc/watchpoint: Add SPRN macros for second DAWR

2020-05-10 Thread Ravi Bangoria
Power10 is introducing second DAWR. Add SPRN_ macros for the same. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/reg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index

[PATCH v5 01/16] powerpc/watchpoint: Rename current DAWR macros

2020-05-10 Thread Ravi Bangoria
Power10 is introducing second DAWR. Use real register names from ISA for current macros: s/SPRN_DAWR/SPRN_DAWR0/ s/SPRN_DAWRX/SPRN_DAWRX0/ Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/reg.h | 4 ++-- arch/powerpc/kernel/dawr.c

[PATCH v5 05/16] powerpc/watchpoint: Provide DAWR number to set_dawr

2020-05-10 Thread Ravi Bangoria
Introduce new parameter 'nr' to set_dawr() which indicates which DAWR should be programed. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/hw_breakpoint.h | 4 ++-- arch/powerpc/kernel/dawr.c | 15 ++- arch/powerpc/kernel

[PATCH v5 06/16] powerpc/watchpoint: Provide DAWR number to __set_breakpoint

2020-05-10 Thread Ravi Bangoria
Introduce new parameter 'nr' to __set_breakpoint() which indicates which DAWR should be programed. Also convert current_brk variable to an array. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/debug.h | 2 +- arch/powerpc/include/asm

[PATCH v5 04/16] powerpc/watchpoint/ptrace: Return actual num of available watchpoints

2020-05-10 Thread Ravi Bangoria
User can ask for num of available watchpoints(dbginfo.num_data_bps) using ptrace(PPC_PTRACE_GETHWDBGINFO). Return actual number of available watchpoints on the machine rather than hardcoded 1. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/ptrace/ptrace

[PATCH v5 00/16] powerpc/watchpoint: Preparation for more than one watchpoint

2020-05-10 Thread Ravi Bangoria
/linuxppc-dev/20200430043417.30948-1-ravi.bango...@linux.ibm.com v4->v5: - s/future power architecture/Power10/ - s/dawr/DAWR/ in commit descriptions [1]: https://www-355.ibm.com/systems/power/openpower/ Ravi Bangoria (16): powerpc/watchpoint: Rename current DAWR macros powerpc/watchpoint:

[PATCH v5 03/16] powerpc/watchpoint: Introduce function to get nr watchpoints dynamically

2020-05-10 Thread Ravi Bangoria
, which will now represent maximum number of watchpoints supported by Powerpc. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/cputable.h | 6 +- arch/powerpc/include/asm/hw_breakpoint.h | 5 + arch/powerpc/include/asm/processor.h | 2 +- arch

[PATCH v5 07/16] powerpc/watchpoint: Get watchpoint count dynamically while disabling them

2020-05-10 Thread Ravi Bangoria
Instead of disabling only one watchpoint, get num of available watchpoints dynamically and disable all of them. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/hw_breakpoint.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff

[PATCH v5 12/16] powerpc/watchpoint: Use builtin ALIGN*() macros

2020-05-10 Thread Ravi Bangoria
Currently we calculate hw aligned start and end addresses manually. Replace them with builtin ALIGN_DOWN() and ALIGN() macros. So far end_addr was inclusive but this patch makes it exclusive (by avoiding -1) for better readability. Suggested-by: Christophe Leroy Signed-off-by: Ravi Bangoria

[PATCH v5 11/16] powerpc/watchpoint: Introduce is_ptrace_bp() function

2020-05-10 Thread Ravi Bangoria
Introduce is_ptrace_bp() function and move the check inside the function. It will be utilize more in later set of patches. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/hw_breakpoint.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH v5 14/16] powerpc/watchpoint: Don't allow concurrent perf and ptrace events

2020-05-10 Thread Ravi Bangoria
range overlaps. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/hw_breakpoint.h | 2 + arch/powerpc/kernel/hw_breakpoint.c | 221 +++ kernel/events/hw_breakpoint.c| 16 ++ 3 files changed, 239 insertions(+) diff

[PATCH v5 08/16] powerpc/watchpoint: Disable all available watchpoints when !dawr_force_enable

2020-05-10 Thread Ravi Bangoria
-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/dawr.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/dawr.c b/arch/powerpc/kernel/dawr.c index 8114ad3a8574..500f52fa4711 100644 --- a/arch/powerpc/kernel/dawr.c +++ b

[PATCH v5 16/16] powerpc/watchpoint/xmon: Support 2nd DAWR

2020-05-10 Thread Ravi Bangoria
Add support for 2nd DAWR in xmon. With this, we can have two simultaneous breakpoints from xmon. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/xmon/xmon.c | 101 ++- 1 file changed, 69 insertions(+), 32 deletions(-) diff --git

[PATCH v5 09/16] powerpc/watchpoint: Convert thread_struct->hw_brk to an array

2020-05-10 Thread Ravi Bangoria
So far powerpc hw supported only one watchpoint. But Power10 is introducing 2nd DAWR. Convert thread_struct->hw_brk into an array. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/kernel/process.c |

[PATCH v5 15/16] powerpc/watchpoint/xmon: Don't allow breakpoint overwriting

2020-05-10 Thread Ravi Bangoria
Xmon allows overwriting breakpoints because it's supported by only one DAWR. But with multiple DAWRs, overwriting becomes ambiguous or unnecessary complicated. So let's not allow it. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/xmon/xmon.c | 4 1 file changed

[PATCH v5 10/16] powerpc/watchpoint: Use loop for thread_struct->ptrace_bps

2020-05-10 Thread Ravi Bangoria
it. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/hw_breakpoint.c | 7 -- arch/powerpc/kernel/process.c | 6 - arch/powerpc/kernel/ptrace/ptrace-noadv.c | 28 +-- 3 files changed, 31 insertions(+), 10 deletions

[PATCH v5 13/16] powerpc/watchpoint: Prepare handler to handle more than one watcnhpoint

2020-05-10 Thread Ravi Bangoria
is configured for readonly watchpoint and the instruction is store, this DAWR must not have caused exception. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/include/asm/sstep.h | 2 + arch/powerpc/kernel/hw_breakpoint.c

[PATCH v6 00/16] powerpc/watchpoint: Preparation for more than one watchpoint

2020-05-14 Thread Ravi Bangoria
/linuxppc-dev/20200511025911.212827-1-ravi.bango...@linux.ibm.com v5->v6: - Rebased to powerpc/next-test which has prefix-instruction support - Adopt 'struct ppc_inst' in hw-breakpoint code as well [1]: https://www-355.ibm.com/systems/power/openpower/ Ravi Bangoria (16): powerpc/watchpoint: Ren

[PATCH v6 09/16] powerpc/watchpoint: Convert thread_struct->hw_brk to an array

2020-05-14 Thread Ravi Bangoria
So far powerpc hw supported only one watchpoint. But Power10 is introducing 2nd DAWR. Convert thread_struct->hw_brk into an array. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/kernel/process.c |

[PATCH v6 01/16] powerpc/watchpoint: Rename current DAWR macros

2020-05-14 Thread Ravi Bangoria
Power10 is introducing second DAWR. Use real register names from ISA for current macros: s/SPRN_DAWR/SPRN_DAWR0/ s/SPRN_DAWRX/SPRN_DAWRX0/ Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/reg.h | 4 ++-- arch/powerpc/kernel/dawr.c

[PATCH v6 06/16] powerpc/watchpoint: Provide DAWR number to __set_breakpoint

2020-05-14 Thread Ravi Bangoria
Introduce new parameter 'nr' to __set_breakpoint() which indicates which DAWR should be programed. Also convert current_brk variable to an array. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/debug.h | 2 +- arch/powerpc/include/asm

[PATCH v6 10/16] powerpc/watchpoint: Use loop for thread_struct->ptrace_bps

2020-05-14 Thread Ravi Bangoria
it. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/hw_breakpoint.c | 7 -- arch/powerpc/kernel/process.c | 6 - arch/powerpc/kernel/ptrace/ptrace-noadv.c | 28 +-- 3 files changed, 31 insertions(+), 10 deletions

[PATCH v6 04/16] powerpc/watchpoint/ptrace: Return actual num of available watchpoints

2020-05-14 Thread Ravi Bangoria
User can ask for num of available watchpoints(dbginfo.num_data_bps) using ptrace(PPC_PTRACE_GETHWDBGINFO). Return actual number of available watchpoints on the machine rather than hardcoded 1. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/ptrace/ptrace

[PATCH v6 07/16] powerpc/watchpoint: Get watchpoint count dynamically while disabling them

2020-05-14 Thread Ravi Bangoria
Instead of disabling only one watchpoint, get num of available watchpoints dynamically and disable all of them. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/hw_breakpoint.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff

[PATCH v6 05/16] powerpc/watchpoint: Provide DAWR number to set_dawr

2020-05-14 Thread Ravi Bangoria
Introduce new parameter 'nr' to set_dawr() which indicates which DAWR should be programed. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/hw_breakpoint.h | 4 ++-- arch/powerpc/kernel/dawr.c | 15 ++- arch/powerpc/kernel

[PATCH v6 16/16] powerpc/watchpoint/xmon: Support 2nd DAWR

2020-05-14 Thread Ravi Bangoria
Add support for 2nd DAWR in xmon. With this, we can have two simultaneous breakpoints from xmon. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/xmon/xmon.c | 101 ++- 1 file changed, 69 insertions(+), 32 deletions(-) diff --git

[PATCH v6 02/16] powerpc/watchpoint: Add SPRN macros for second DAWR

2020-05-14 Thread Ravi Bangoria
Power10 is introducing second DAWR. Add SPRN_ macros for the same. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/reg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index

[PATCH v6 11/16] powerpc/watchpoint: Introduce is_ptrace_bp() function

2020-05-14 Thread Ravi Bangoria
Introduce is_ptrace_bp() function and move the check inside the function. It will be utilize more in later set of patches. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/hw_breakpoint.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH v6 03/16] powerpc/watchpoint: Introduce function to get nr watchpoints dynamically

2020-05-14 Thread Ravi Bangoria
, which will now represent maximum number of watchpoints supported by Powerpc. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/cputable.h | 6 +- arch/powerpc/include/asm/hw_breakpoint.h | 5 + arch/powerpc/include/asm/processor.h | 2 +- arch

[PATCH v6 15/16] powerpc/watchpoint/xmon: Don't allow breakpoint overwriting

2020-05-14 Thread Ravi Bangoria
Xmon allows overwriting breakpoints because it's supported by only one DAWR. But with multiple DAWRs, overwriting becomes ambiguous or unnecessary complicated. So let's not allow it. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/xmon/xmon.c | 4 1 file changed

[PATCH v6 08/16] powerpc/watchpoint: Disable all available watchpoints when !dawr_force_enable

2020-05-14 Thread Ravi Bangoria
-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/kernel/dawr.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/dawr.c b/arch/powerpc/kernel/dawr.c index 8114ad3a8574..500f52fa4711 100644 --- a/arch/powerpc/kernel/dawr.c +++ b

[PATCH v6 13/16] powerpc/watchpoint: Prepare handler to handle more than one watcnhpoint

2020-05-14 Thread Ravi Bangoria
is configured for readonly watchpoint and the instruction is store, this DAWR must not have caused exception. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/include/asm/sstep.h | 2 + arch/powerpc/kernel/hw_breakpoint.c

[PATCH v6 12/16] powerpc/watchpoint: Use builtin ALIGN*() macros

2020-05-14 Thread Ravi Bangoria
Currently we calculate hw aligned start and end addresses manually. Replace them with builtin ALIGN_DOWN() and ALIGN() macros. So far end_addr was inclusive but this patch makes it exclusive (by avoiding -1) for better readability. Suggested-by: Christophe Leroy Signed-off-by: Ravi Bangoria

[PATCH v6 14/16] powerpc/watchpoint: Don't allow concurrent perf and ptrace events

2020-05-14 Thread Ravi Bangoria
range overlaps. Signed-off-by: Ravi Bangoria Reviewed-by: Michael Neuling --- arch/powerpc/include/asm/hw_breakpoint.h | 2 + arch/powerpc/kernel/hw_breakpoint.c | 221 +++ kernel/events/hw_breakpoint.c| 16 ++ 3 files changed, 239 insertions(+) diff

[PATCH v3 1/9] powerpc/watchpoint: Fix 512 byte boundary limit

2020-07-07 Thread Ravi Bangoria
: Use builtin ALIGN*() macros") Reported-by: Milton Miller Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/hw_breakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index daf0e1da..03

[PATCH v3 4/9] powerpc/dt_cpu_ftrs: Add feature for 2nd DAWR

2020-07-07 Thread Ravi Bangoria
Add new device-tree feature for 2nd DAWR. If this feature is present, 2nd DAWR is supported, otherwise not. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/cputable.h | 7 +-- arch/powerpc/kernel/dt_cpu_ftrs.c | 7 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff

[PATCH v3 3/9] powerpc/watchpoint: Enable watchpoint functionality on power10 guest

2020-07-07 Thread Ravi Bangoria
CPU_FTR_DAWR to CPU_FTRS_POWER10. Note that this change does not enable 2nd DAWR support. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/cputable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h

[PATCH v3 2/9] powerpc/watchpoint: Fix DAWR exception constraint

2020-07-07 Thread Ravi Bangoria
985b2a640e ("powerpc/watchpoint: Don't ignore extraneous exceptions blindly") Fixes: 74c6881019b7 ("powerpc/watchpoint: Prepare handler to handle more than one watchpoint") Reported-by: Pedro Miraglia Franco de Carvalho Signed-off-by: Ravi Bangoria --- arch/power

[PATCH v3 0/9] powerpc/watchpoint: Enable 2nd DAWR on baremetal and powervm

2020-07-07 Thread Ravi Bangoria
...@linux.ibm.com/ v2->v3: - patch #2 is new. It fixes an issue with DAWR exception constraint - Rename dawr1 to debug-facilities-v31 in dt cpu feature, suggested by Nick Piggin. - Rebased to powerpc/next [1]: https://lore.kernel.org/linuxppc-dev/20200514111741.97993-1-ravi.bango...@linux.ibm.com/ R

[PATCH v3 8/9] powerpc/watchpoint: Return available watchpoints dynamically

2020-07-07 Thread Ravi Bangoria
So far Book3S Powerpc supported only one watchpoint. Power10 is introducing 2nd DAWR. Enable 2nd DAWR support for Power10. Availability of 2nd DAWR will depend on CPU_FTR_DAWR1. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/cputable.h | 4 +++- arch/powerpc/include/asm

[PATCH v3 7/9] powerpc/watchpoint: Guest support for 2nd DAWR hcall

2020-07-07 Thread Ravi Bangoria
2nd DAWR can be set/unset using H_SET_MODE hcall with resource value 5. Enable powervm guest support with that. This has no effect on kvm guest because kvm will return error if guest does hcall with resource value 5. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/hvcall.h | 1

[PATCH v3 5/9] powerpc/watchpoint: Set CPU_FTR_DAWR1 based on pa-features bit

2020-07-07 Thread Ravi Bangoria
or guests and thus this change is mostly applicable for guests only. Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/prom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 9cc49f265c86..c76c09b97bc8 100644 --- a/arch/po

[PATCH v3 6/9] powerpc/watchpoint: Rename current H_SET_MODE DAWR macro

2020-07-07 Thread Ravi Bangoria
Current H_SET_MODE hcall macro name for setting/resetting DAWR0 is H_SET_MODE_RESOURCE_SET_DAWR. Add suffix 0 to macro name as well. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/hvcall.h | 2 +- arch/powerpc/include/asm/plpar_wrappers.h | 2 +- arch/powerpc/kvm/book3s_hv.c

[PATCH v3 9/9] powerpc/watchpoint: Remove 512 byte boundary

2020-07-07 Thread Ravi Bangoria
Power10 has removed 512 bytes boundary from match criteria. i.e. The watch range can cross 512 bytes boundary. Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/hw_breakpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b

[PATCH] powerpc/watchpoint/ptrace: Introduce PPC_DEBUG_FEATURE_DATA_BP_DAWR_ARCH_31

2020-07-09 Thread Ravi Bangoria
that availability of 2nd DAWR is independent of this flag and should be checked using ppc_debug_info->num_data_bps. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/uapi/asm/ptrace.h| 1 + arch/powerpc/kernel/ptrace/ptrace-noadv.c | 5 - 2 files changed, 5 insertions(+), 1 delet

Re: [PATCH v8 00/12] Introduce CAP_PERFMON to secure system performance monitoring and observability

2020-07-10 Thread Ravi Bangoria
Hi Alexey, Currently access to perf_events, i915_perf and other performance monitoring and observability subsystems of the kernel is open only for a privileged process [1] with CAP_SYS_ADMIN capability enabled in the process effective set [2]. This patch set introduces CAP_PERFMON capability

[PATCH 1/2] libsubcmd: Fix OPT_CALLBACK_SET()

2020-06-19 Thread Ravi Bangoria
BACK_SET()") Signed-off-by: Ravi Bangoria --- tools/lib/subcmd/parse-options.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c index dbb9efbf718a..39ebf6192016 100644 --- a/tools/lib/subcmd/parse-options.c +++ b/too

[PATCH 2/2] perf record: Fix --switch-output=time documentation

2020-06-19 Thread Ravi Bangoria
perf record man page uses word 'size' while describing --switch-output=time option. Fix that. Signed-off-by: Ravi Bangoria --- tools/perf/Documentation/perf-record.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf

[PATCH v2 0/8] powerpc/watchpoint: Enable 2nd DAWR on baremetal and powervm

2020-06-03 Thread Ravi Bangoria
-1-ravi.bango...@linux.ibm.com/ [2]: https://lore.kernel.org/linuxppc-dev/20200521014341.29095-1-alist...@popple.id.au Ravi Bangoria (8): powerpc/watchpoint: Fix 512 byte boundary limit powerpc/watchpoint: Enable watchpoint functionality on power10 guest powerpc/dt_cpu_ftrs: Add feature for 2nd D

[PATCH v2 6/8] powerpc/watchpoint: Guest support for 2nd DAWR hcall

2020-06-03 Thread Ravi Bangoria
2nd DAWR can be set/unset using H_SET_MODE hcall with resource value 5. Enable powervm guest support with that. This has no effect on kvm guest because kvm will return error if guest does hcall with resource value 5. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/hvcall.h | 1

[PATCH v2 3/8] powerpc/dt_cpu_ftrs: Add feature for 2nd DAWR

2020-06-03 Thread Ravi Bangoria
Add new device-tree feature for 2nd DAWR. If this feature is present, 2nd DAWR is supported, otherwise not. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/cputable.h | 7 +-- arch/powerpc/kernel/dt_cpu_ftrs.c | 7 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff

[PATCH v2 5/8] powerpc/watchpoint: Rename current H_SET_MODE DAWR macro

2020-06-03 Thread Ravi Bangoria
Current H_SET_MODE hcall macro name for setting/resetting DAWR0 is H_SET_MODE_RESOURCE_SET_DAWR. Add suffix 0 to macro name as well. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/hvcall.h | 2 +- arch/powerpc/include/asm/plpar_wrappers.h | 2 +- arch/powerpc/kvm/book3s_hv.c

[PATCH v2 8/8] powerpc/watchpoint: Remove 512 byte boundary

2020-06-03 Thread Ravi Bangoria
Power10 has removed 512 bytes boundary from match criteria. i.e. The watch range can cross 512 bytes boundary. Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/hw_breakpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b

[PATCH v2 1/8] powerpc/watchpoint: Fix 512 byte boundary limit

2020-06-03 Thread Ravi Bangoria
iltin ALIGN*() macros") Reported-by: Milton Miller Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/hw_breakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c index daf0e1da..031e6defc

[PATCH v2 7/8] powerpc/watchpoint: Return available watchpoints dynamically

2020-06-03 Thread Ravi Bangoria
So far Book3S Powerpc supported only one watchpoint. Power10 is introducing 2nd DAWR. Enable 2nd DAWR support for Power10. Availability of 2nd DAWR will depend on CPU_FTR_DAWR1. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/cputable.h | 4 +++- arch/powerpc/include/asm

[PATCH v2 2/8] powerpc/watchpoint: Enable watchpoint functionality on power10 guest

2020-06-03 Thread Ravi Bangoria
CPU_FTR_DAWR to CPU_FTRS_POWER10. Note that this change does not enable 2nd DAWR support. Signed-off-by: Ravi Bangoria --- arch/powerpc/include/asm/cputable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h

[PATCH v2 4/8] powerpc/watchpoint: Set CPU_FTR_DAWR1 based on pa-features bit

2020-06-03 Thread Ravi Bangoria
or guests and thus this change is mostly applicable for guests only. Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/prom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 6a3bac357e24..34272cef8ae6 100644 --- a/arch/po

Re: [PATCH] perf mem/c2c: Fix perf_mem_events to support powerpc

2019-01-28 Thread Ravi Bangoria
On 1/14/19 9:44 AM, Ravi Bangoria wrote: > Powerpc hw does not have inbuilt latency filter (--ldlat) for mem-load > event and, perf_mem_events by default includes ldlat=30 which is > causing failure on powerpc. Refactor code to support perf mem/c2c on > powerpc. > >

Re: [PATCH] perf mem/c2c: Fix perf_mem_events to support powerpc

2019-01-29 Thread Ravi Bangoria
On 1/29/19 3:23 PM, Arnaldo Carvalho de Melo wrote: > I think its just a tooling side, I haven't processed it because I'm > waiting for Ravi to address Jiri's comment, after that I'm happy to put > it in my perf/urgent branch that I'm brewing to push to Ingo today or > tomorrow. Ah.. Will try

[PATCH v2] perf mem/c2c: Fix perf_mem_events to support powerpc

2019-01-29 Thread Ravi Bangoria
://lists.ozlabs.org/pipermail/linuxppc-dev/2018-December/182596.html Signed-off-by: Ravi Bangoria --- tools/perf/Documentation/perf-c2c.txt | 16 tools/perf/Documentation/perf-mem.txt | 2 +- tools/perf/arch/powerpc/util/Build| 1 + tools/perf/arch/powerpc/util/mem-events.c | 11

[PATCH] perf mem/c2c: Fix perf_mem_events to support powerpc

2019-01-13 Thread Ravi Bangoria
://lists.ozlabs.org/pipermail/linuxppc-dev/2018-December/182596.html Signed-off-by: Ravi Bangoria --- tools/perf/Documentation/perf-c2c.txt | 16 tools/perf/Documentation/perf-mem.txt | 2 +- tools/perf/arch/x86/util/Build| 1 + tools/perf/arch/x86/util/mem-events.c | 25

[PATCH] Uprobes: Fix deadlock between delayed_uprobe_lock and fs_reclaim

2019-02-03 Thread Ravi Bangoria
sh Kumar K.V Signed-off-by: Ravi Bangoria --- kernel/events/uprobes.c | 24 1 file changed, 24 insertions(+) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 8aef47ee7bfa..8be39a83d83a 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobe

Re: [PATCH v2] perf scripts python: Add Python 3 support to check-perf-trace.py

2019-01-17 Thread Ravi Bangoria
nal change. >> >> Fix indentation issue, replace spaces with tab >> >> Signed-off-by: Seeteena Thoufeek >> Reviewed-by: Ravi Bangoria > > hum, could you please add some info about testing those changes? > (or even some global into 0/.. patch) > > thi

Re: System crash with perf_fuzzer (kernel: 5.0.0-rc3)

2019-01-30 Thread Ravi Bangoria
Hi Andi, On 1/25/19 9:30 PM, Andi Kleen wrote: >> [Fri Jan 25 10:28:53 2019] perf: interrupt took too long (2501 > 2500), >> lowering kernel.perf_event_max_sample_rate to 79750 >> [Fri Jan 25 10:29:08 2019] perf: interrupt took too long (3136 > 3126), >> lowering

Re: [PATCH] Uprobes: Fix deadlock between delayed_uprobe_lock and fs_reclaim

2019-02-08 Thread Ravi Bangoria
t; fails. I don't understand binderfs code much so I'll let Sherry comment on this. > > In any case, I don't think memalloc_nofs_save() is what we need, see below. > > On 02/04, Ravi Bangoria wrote: >> >> There can be a deadlock between delayed_uprobe_

Re: [PATCH v5 06/10] Uprobes: Support SDT markers having reference count (semaphore)

2018-07-11 Thread Ravi Bangoria
Hi Oleg, On 07/10/2018 08:55 PM, Oleg Nesterov wrote: > Hi Ravi, > > On 07/04, Ravi Bangoria wrote: >> >>> Now I understand what did you mean by "for each consumer". So if we move >>> this logic >>> into install/remove_breakpoint as I tr

[PATCH 1/3] perf script: Add missing output fields in a hint

2018-06-20 Thread Ravi Bangoria
Few fields are missing in a perf script -F hint. Add them. Signed-off-by: Ravi Bangoria --- tools/perf/builtin-script.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index b3bf35512d21..4d1cee68cfd2 100644

[PATCH 0/3] perf script: Few trivial fixes

2018-06-20 Thread Ravi Bangoria
First patch fixes perf output field hint. Second and third fixes crash when used in a piped mode. Ravi Bangoria (3): perf script: Add missing output fields in a hint perf script: Fix crash because of missing evsel->priv perf script: Fix crash because of missing feat_op[] entry tools/p

[PATCH 3/3] perf script: Fix crash because of missing feat_op[] entry

2018-06-20 Thread Ravi Bangoria
: # ./perf record -o - ls | ./perf script ls 7031 4392.099856: 25 cpu-clock:uhH: 7f5e0ce7cd60 ls 7031 4392.100355: 25 cpu-clock:uhH: 7f5e0c706ef7 Signed-off-by: Ravi Bangoria Fixes: 57b5de463925 ("perf report: Support forced leader feature in pipe mode") --- tools

[PATCH 2/3] perf script: Fix crash because of missing evsel->priv

2018-06-20 Thread Ravi Bangoria
ls 2282 1031.73: 25 cpu-clock:uhH: 7effe4b3a650 Signed-off-by: Ravi Bangoria Fixes: a14390fde64e ("perf script: Allow creating per-event dump files") --- tools/perf/builtin-script.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/tools/perf/builtin-script.c

Re: [PATCH 2/3] perf script: Fix crash because of missing evsel->priv

2018-06-20 Thread Ravi Bangoria
Hi Arnaldo, On 06/20/2018 07:22 PM, Arnaldo Carvalho de Melo wrote: > Em Wed, Jun 20, 2018 at 07:00:29PM +0530, Ravi Bangoria escreveu: >> perf script in pipped mode is crashing because evsel->priv is not >> set properly. Fix it. >> >> Before: >> # ./pe

<    4   5   6   7   8   9   10   11   12   13   >