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

From: Christophe Leroy
Date: Wed Apr 01 2020 - 03:05:44 EST




Le 01/04/2020 Ã 08:50, Ravi Bangoria a ÃcritÂ:


On 4/1/20 11:59 AM, Christophe Leroy wrote:


Le 01/04/2020 Ã 08:12, Ravi Bangoria a ÃcritÂ:
So far we had only one watchpoint, so we have hardcoded HBP_NUM to 1.
But future Power architecture is introducing 2nd DAWR and thus kernel
should be able to dynamically find actual number of watchpoints
supported by hw it's running on. Introduce function for the same.
Also convert HBP_NUM macro to HBP_NUM_MAX, which will now represent
maximum number of watchpoints supported by Powerpc.


Everywhere else in the code, it is called 'breakpoint', not 'watchpoint'.

Wouldn't it be more consistent to call the function nr_bp_slots() instead of nr_wp_slots() ?

Especially as we are likely going to extend your changes to support DABR2 in addition to DABR on BOOK3S/32.

Sure. I don't have strong onion for nr_wp_slots() and I can rename it to
nr_bp_slots(). but...

Even though existing code uses breakpoint and watchpoint interchangeably,
I'm using wp/watchpoint to represent data-breakpoint, to distinguish it
from instruction-breakpoint (CIABR). So IMHO, nr_wp_slots() should return
number DAWRs/DABRs and nr_bp_slots() should return number of CIABRs. Is
that okay?



Yes that makes sense too. Up to you.

Christophe