[PATCH v1] [powerpc] Remove 512 bytes region limit if using 2nd DAWR.

Ulrich Weigand uweigand@de.ibm.com
Tue Nov 10 10:21:59 GMT 2020


On Mon, Nov 09, 2020 at 10:08:09AM -0300, Rogerio Alves wrote:
> On 11/9/20 7:24 AM, Ulrich Weigand wrote:
> > On Sun, Nov 08, 2020 at 11:12:04PM -0300, Rogerio Alves wrote:
> >> Power 10 introduces the 2nd DAWR (second watchpoint) and also removed
> >> a restriction that limit the watch region to 512 bytes.
> >>
> >> 2020-11-08  Rogerio A. Cardoso  <rcardoso@linux.ibm.com>
> >>
> >> gdb/
> >>
> >> * ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define.
> >> (region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before set
> >> region.
> > 
> > This doesn't look correct, the patch not only removes the alignment
> > requirement but actually removes support for 512 bytes ranges itself!
> > 
> 
> The patch doesn't remove the support. If we are using the second 
> watchpoint (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31) we don't limit the 
> region_size to 512 (region_size = 512) instead we use 
> hwdebug_info.data_bp_alignment right? Isn't region_size that create a 
> 512-byte bondary?

hwdebug_info.data_bp_alignment is the required *alignment*, which
remains 8 for Power10.

I think the problem is that until now, the maximum size was always
equal to the required alignment (on Power8: alignment 8, size 8;
on Power9: alignment 512, size 512), but on Power10 they are now
different: alignment 8, size 512.

> > I think for P10 we need to continue to allow watched ranges up to
> > 512 bytes in size, but they only need to be 8 byte aligned now and
> > may cross a 512-byte boundary.
> > 
> 
> Since the else case is region_size = hwdebug_info.data_bp_alignment;
> I guess this is what it do unless I am missing something here.

We'll probably have to use two different variables for size and
alignment now, update the test accordingly, and set the values as
above.

Given the size and alignment value, and given a range start address,
the maximum allowable end can be found by rounding the start address
*down* to the required alignment, and then adding the maximum size.

For example, if we have a start address of 0x1234, then the maximum
end address on P9 is 0x1400, but on P10 it would be 0x1430.

(With your patch as-is, it would reset to the P8 values, where the
maximum end address is only 0x1238.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


More information about the Gdb-patches mailing list