RFR: 8328866: Add raw monitor rank support to the debug agent. [v4]

Chris Plummer cjplummer at openjdk.org
Wed May 8 22:12:54 UTC 2024


On Wed, 8 May 2024 21:44:37 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>>> A "leaf" failure is more specific than a "rank order" failure, so it is better to report it first. Each "leaf" failure is also a "rank order" failure (AFAICS).
>> 
>> It's not just a matter of which is reported first. Even if you swap the order of your two loops you get the same result. The problem is the "rank" loop does not check if any of the leaf monitors are already held. I think to fix that it would have to iterate up to NUM_DEBUG_RAW_MONITORS, which means there is overlap with the range that the "leaf" loop iterators over.
>
> In fact, I do not understand why reporting the "rank order" violation is important what "leaf rank order" is violated. I feel that I'm missing something. Let me think on it a little bit.

If the following are all true 
- you are entering is a leaf monitor
- the current thread has already entered a leaf monitor
- the rank of the monitor you are entering is lower than the rank of the monitor already held

Then you have both a rank order violation and a violation for entering a leaf monitor when you have already entered a leaf monitor. My current implementation will complain about the rank violation (although can easily be made to instead complain about the leaf violation or complain about both). Yours will complain about the leaf violation.  To make yours instead complain about the rank violation, the first loop needs to also check all the leaf monitors. Since the 2nd loop also checks all the leaf monitors (but for a different reason), this means iterating over the leaf monitors twice. Complaining about both violations would also require iterating over the leaf monitors twice.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19044#discussion_r1594757398


More information about the serviceability-dev mailing list