RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

Hui Shi-2
When test with -XX:+VerifyCodeCache, many tests fail due to extra_hops assertion in CodeHeap::verify. See full dump in JBS.

# Internal Error (/data/shihui/codes/shihui_jdk_master/src/hotspot/share/memory/heap.cpp:838), pid=1525697, tid=1525715
# assert((count == 0) || (extra_hops < (16 + 2*count))) failed: CodeHeap: many extra hops due to optimization. blocks: 234, extra hops: 484.
Discussion in https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-October/035508.html doesn't tell where assertion (extra_hops < (16 + 2*count) comes from.

In CodeHeap::mark_segmap_as_used wehn is_FreeBlock_join is true,  it creates extra hops in _segmap. _fragmentation_count in inced and trigger defrag_segmap when reach threshold. In my understanding, extra hop can not guarantee under (16 + 2*count).

In following extreme case, before HeapBlock free, segmap is all 0 (each blob use 1 smallest segment), suppose free action is applied from right to left. This increase 9 unnecessary hop for 1 continous HeapBlock.  assertion (extra_hops < (16 + 2*count)  is not safe.
|0|0|0|0|0|0|0|0|0|0|
after free, it will be
|0|1|1|1|1|1|1|1|1|1|

Proposed fix is assert extra hops not exceed _fragmentation_count. And if it exceeds (16 + 2 * count), give warning on two many extra hops.

fastdebug tier1, tier2 with VerifyCodeCache passing, no extra assertion found.

-------------

Commit messages:
 - 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

Changes: https://git.openjdk.java.net/jdk/pull/3212/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3212&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264223
  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3212.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3212/head:pull/3212

PR: https://git.openjdk.java.net/jdk/pull/3212
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

Jie Fu-2
On Fri, 26 Mar 2021 02:50:59 GMT, Hui Shi <[hidden email]> wrote:

> When test with -XX:+VerifyCodeCache, many tests fail due to extra_hops assertion in CodeHeap::verify. See full dump in JBS.
>
> # Internal Error (src/hotspot/share/memory/heap.cpp:838), pid=1525697, tid=1525715
> # assert((count == 0) || (extra_hops < (16 + 2*count))) failed: CodeHeap: many extra hops due to optimization. blocks: 234, extra hops: 484.
> Discussion in https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-October/035508.html doesn't tell where assertion (extra_hops < (16 + 2*count) comes from.
>
> In CodeHeap::mark_segmap_as_used wehn is_FreeBlock_join is true,  it creates extra hops in _segmap. _fragmentation_count in inced and trigger defrag_segmap when reach threshold. In my understanding, extra hop can not guarantee under (16 + 2*count).
>
> In following extreme case, before HeapBlock free, segmap is all 0 (each blob use 1 smallest segment), suppose free action is applied from right to left. This increase 9 unnecessary hop for 1 continous HeapBlock.  assertion (extra_hops < (16 + 2*count)  is not safe.
> |0|0|0|0|0|0|0|0|0|0|
> after free, it will be
> |0|1|1|1|1|1|1|1|1|1|
>
> Proposed fix is assert extra hops not exceed _fragmentation_count. And if it exceeds (16 + 2 * count), give warning on two many extra hops.
>
> fastdebug tier1, tier2 with VerifyCodeCache passed on X86_64 linux, no extra assertion found.

It would be better to add a test run with `-XX:+VerifyCodeCache` into one of the failing tests.
Thanks.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3212
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test [v2]

Hui Shi-2
In reply to this post by Hui Shi-2
> When test with -XX:+VerifyCodeCache, many tests fail due to extra_hops assertion in CodeHeap::verify. See full dump in JBS.
>
> # Internal Error (src/hotspot/share/memory/heap.cpp:838), pid=1525697, tid=1525715
> # assert((count == 0) || (extra_hops < (16 + 2*count))) failed: CodeHeap: many extra hops due to optimization. blocks: 234, extra hops: 484.
> Discussion in https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-October/035508.html doesn't tell where assertion (extra_hops < (16 + 2*count) comes from.
>
> In CodeHeap::mark_segmap_as_used wehn is_FreeBlock_join is true,  it creates extra hops in _segmap. _fragmentation_count in inced and trigger defrag_segmap when reach threshold. In my understanding, extra hop can not guarantee under (16 + 2*count).
>
> In following extreme case, before HeapBlock free, segmap is all 0 (each blob use 1 smallest segment), suppose free action is applied from right to left. This increase 9 unnecessary hop for 1 continous HeapBlock.  assertion (extra_hops < (16 + 2*count)  is not safe.
> |0|0|0|0|0|0|0|0|0|0|
> after free, it will be
> |0|1|1|1|1|1|1|1|1|1|
>
> Proposed fix is assert extra hops not exceed _fragmentation_count. And if it exceeds (16 + 2 * count), give warning on two many extra hops.
>
> fastdebug tier1, tier2 with VerifyCodeCache passed on X86_64 linux, no extra assertion found.

Hui Shi has updated the pull request incrementally with one additional commit since the last revision:

  Add test enable VerifyCodeCache for one fail test before fix

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3212/files
  - new: https://git.openjdk.java.net/jdk/pull/3212/files/a7f5368f..7955f9b5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3212&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3212&range=00-01

  Stats: 8 lines in 1 file changed: 8 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3212.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3212/head:pull/3212

PR: https://git.openjdk.java.net/jdk/pull/3212
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

Hui Shi-2
In reply to this post by Jie Fu-2
On Fri, 26 Mar 2021 02:59:58 GMT, Jie Fu <[hidden email]> wrote:

> It would be better to add a test run with `-XX:+VerifyCodeCache` into one of the failing tests.
> Thanks.

Thanks! Test is addded for one previously fail case.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3212
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test [v3]

Hui Shi-2
In reply to this post by Hui Shi-2
> When test with -XX:+VerifyCodeCache, many tests fail due to extra_hops assertion in CodeHeap::verify. See full dump in JBS.
>
> # Internal Error (src/hotspot/share/memory/heap.cpp:838), pid=1525697, tid=1525715
> # assert((count == 0) || (extra_hops < (16 + 2*count))) failed: CodeHeap: many extra hops due to optimization. blocks: 234, extra hops: 484.
> Discussion in https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2019-October/035508.html doesn't tell where assertion (extra_hops < (16 + 2*count) comes from.
>
> In CodeHeap::mark_segmap_as_used wehn is_FreeBlock_join is true,  it creates extra hops in _segmap. _fragmentation_count in inced and trigger defrag_segmap when reach threshold. In my understanding, extra hop can not guarantee under (16 + 2*count).
>
> In following extreme case, before HeapBlock free, segmap is all 0 (each blob use 1 smallest segment), suppose free action is applied from right to left. This increase 9 unnecessary hop for 1 continous HeapBlock.  assertion (extra_hops < (16 + 2*count)  is not safe.
> |0|0|0|0|0|0|0|0|0|0|
> after free, it will be
> |0|1|1|1|1|1|1|1|1|1|
>
> Proposed fix is assert extra hops not exceed _fragmentation_count. And if it exceeds (16 + 2 * count), give warning on two many extra hops.
>
> fastdebug tier1, tier2 with VerifyCodeCache passed on X86_64 linux, no extra assertion found.

Hui Shi has updated the pull request incrementally with one additional commit since the last revision:

  update copyright year

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3212/files
  - new: https://git.openjdk.java.net/jdk/pull/3212/files/7955f9b5..f9c5cf94

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3212&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3212&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3212.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3212/head:pull/3212

PR: https://git.openjdk.java.net/jdk/pull/3212
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

Jie Fu-2
In reply to this post by Hui Shi-2
On Fri, 26 Mar 2021 07:58:07 GMT, Hui Shi <[hidden email]> wrote:

> Thanks! Test is addded for one previously fail case.

Thanks for your update.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3212
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264223: CodeHeap::verify fails extra_hops assertion in fastdebug test

Daniel D.Daugherty
On Fri, 26 Mar 2021 08:31:27 GMT, Jie Fu <[hidden email]> wrote:

>>> It would be better to add a test run with `-XX:+VerifyCodeCache` into one of the failing tests.
>>> Thanks.
>>
>> Thanks! Test is addded for one previously fail case.
>
>> Thanks! Test is addded for one previously fail case.
>
> Thanks for your update.

This is a hotspot/compiler bug. This review should have gone to the hotspot-compiler
alias and not the hotspot-runtime alias.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3212