Re: WARNING in arch_install_hw_breakpoint

Frederic Weisbecker
2019-03-28T05:27:48Z

On Wed, Mar 27, 2019 at 06:48:41PM +0100, Borislav Petkov wrote:
> On Wed, Mar 27, 2019 at 04:17:25PM +0100, Borislav Petkov wrote:
> Ok, after adding some debug output, it looks like this (newlines mine):
>
> [ 200.921625][ T8029] repro-8029 0d..4 200923254us : arch_install_hw_breakpoint: i: 0, slot: ffff888069668080
>
> [ 200.922507][ T8029] repro-8029 0d..4 200923257us : arch_install_hw_breakpoint: i: 0, slot: ffff888069668080
> [ 200.923397][ T8029] repro-8029 0d..4 200923259us : arch_install_hw_breakpoint: i: 1, slot: ffff888060200d40
>
> [ 200.924294][ T8029] repro-8029 0d..4 200923262us : arch_install_hw_breakpoint: i: 0, slot: ffff888069668080
> [ 200.925175][ T8029] repro-8029 0d..4 200923264us : arch_install_hw_breakpoint: i: 1, slot: ffff888060200d40
> [ 200.926054][ T8029] repro-8029 0d..4 200923266us : arch_install_hw_breakpoint: i: 2, slot: ffff8880602004c0
>
> [ 200.926933][ T8029] repro-8029 0d..4 200923270us : arch_install_hw_breakpoint: i: 0, slot: ffff888069668080
> [ 200.927816][ T8029] repro-8029 0d..4 200923271us : arch_install_hw_breakpoint: i: 1, slot: ffff888060200d40
> [ 200.928695][ T8029] repro-8029 0d..4 200923273us : arch_install_hw_breakpoint: i: 2, slot: ffff8880602004c0
> [ 200.929573][ T8029] repro-8029 0d..4 200923275us : arch_install_hw_breakpoint: i: 3, slot: ffff88806991ed00
>
> which basically shows how this thread adds 4 breakpoints and hits the
> warn on on the 5th.
>
> Now, that code I've seen only once or twice so I don't have a very smart
> guess but it looks to me like arch_install_hw_breakpoint() or something
> scheduling the events above that, should check HBP_NUM and not schedule
> more than 4 hw breakpoints. Or..?
>
> Frederic, I know you know this code... :-)

Ok, I finally managed to reproduce. The issue is unlikely to come from the
architecture. Perf shouldn't commit more breakpoints than possible so it's
probably perf events scheduling or hw breakpoint core constraints that are
broken. I'm investigating...

Thanks.