<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello<div class="">Some numbers on performance, 100% - time of average philosophers run on repetitions 4-9 ( filtering out some too slow results), on default jdk19 without RVC</div><div class="">to make results more a less repeatable, I had to "isolate" 2 of 4 harts, from the rest of the system. These two harts can only  be assigned to the process explicitly.</div><div class="">Basically, two harts are running only java threads. Java threads are running only on these two harts. This minimizes an effect of other processes on the result ( especially on low-clocked fpga cores).</div><div class=""><br class=""></div><div class="">jdk19  - 100% +- 4%<div><div>jdk19 + JDK-8294012 - 100% +- 4%</div><div>jdk19 + unaligned access patch from Xiaolin  + JDK-8294012  -  102 % +- 2.5 %</div><div>jdk19 + unaligned access patch from Xiaolin  + JDK-8294012 + UseRVC - 95% +- 1%</div><div><br class=""></div><div><br class=""></div><div>Regards, Vladimir</div></div><div><br class=""><blockquote type="cite" class=""><div class="">16 сент. 2022 г., в 14:49, Vladimir Kempik <<a href="mailto:vladimir.kempik@gmail.com" class="">vladimir.kempik@gmail.com</a>> написал(а):</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello.<div class="">I have applied your two fixes on top of jdk19 and tested - all issues have gone, thanks.</div><div class="">Looks like the source of the issues is in my m-mode.</div><div class=""><br class=""></div><div class="">Kinds Regards, Vladimir</div><div class=""><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">16 сент. 2022 г., в 11:45, Xiaolin Zheng <<a href="mailto:yunyao.zxl@alibaba-inc.com" class="">yunyao.zxl@alibaba-inc.com</a>> написал(а):</div><br class="Apple-interchange-newline"><div class=""><div class="__aliyun_email_body_block"><div style="line-height: 1.7; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class=""><div style="clear:both;" class=""><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class="">Hi <span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">Vladimir,</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">Thank you for the newly-added hs_err and further tests. I guess it might have some relationship with the discussed [misaligned issue](<span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><a href="https://mail.openjdk.org/pipermail/riscv-port-dev/2022-July/000559.html" target="_blank" class="">https://mail.openjdk.org/pipermail/riscv-port-dev/2022-July/000559.html</a></span>) here. But just guessing. I have noticed one interesting thing that the crashed hs_err files are often like:</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">```</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">...</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">  0x0000003f7cc2f91e:   mv a0,s7</span><div style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;" class="">  0x0000003f7cc2f922:   auipc t0,0x10494</div><div style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;" class="">  0x0000003f7cc2f926:   jalr 664(t0) # 0x0000003f8d0c3bba = AdapterHandlerEntry::print_adapter_on(outputStream*) const+470   <--- ??? Misaligned address: <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; float: none; display: inline;" class="">0x0000003f7cc2f926</span></div><div style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;" class="">  0x0000003f7cc2f92a:   sd zero,704(s7)</div><div style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">  0x0000003f7cc2f92e:   sd zero,712(s7)</span></div><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">...</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">```</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">With RVC, it is certainly <span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">legal</span> to locate at a 2-byte aligned address. But, this location is relocatable, which means it will be patched.</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">So, I might doubt something weird happened when performing the patching behavior. The patching logic, referencing the instruction segment, does not care about the alignment but only performs 4-byte memory load operations, such as <span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">Assembler::patch(). On machines having the misaligned address support, it would not go wrong of course; but it seems that our FPGA board discussed lacks this support. So I guess there might be an interesting chemical reaction happening here. I have written two patches to debug this issue and released one fastdebug build only for debugging purposes, and I put it at<span class=""> </span><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><a href="https://github.com/zhengxiaolinX/jdk/releases/tag/test-unaligned" target="_blank" class="">https://github.com/zhengxiaolinX/jdk/releases/tag/test-unaligned</a></span>. The two patches fix most of the misaligned accesses to the instruction segment. I was wondering if you could have a simple test of it when you are available, to see whether this issue still exists?</span></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">I am just guessing the problem here, hope it can reveal something to us.</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">Thank you very much.</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class=""><br class=""></span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">Best,</span></div><div style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration-thickness: initial; clear: both;" class=""><span style="margin:.0px;padding:.0px;border:.0px;outline:.0px;" class="">Xiaolin</span></div></div><div style="clear:both;" class=""><br class=""></div><blockquote style="margin-right: 0px; margin-top: 0px; margin-bottom: 0px; font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class=""><div style="clear:both;" class="">------------------------------------------------------------------</div><div style="clear:both;" class="">From:Vladimir Kempik <<a href="mailto:vladimir.kempik@gmail.com" class="">vladimir.kempik@gmail.com</a>></div><div style="clear:both;" class="">Send Time:2022年9月15日(星期四) 23:25</div><div style="clear:both;" class="">To:郑孝林(云矅) <<a href="mailto:yunyao.zxl@alibaba-inc.com" class="">yunyao.zxl@alibaba-inc.com</a>></div><div style="clear:both;" class="">Cc:riscv-port-dev <<a href="mailto:riscv-port-dev-retn@openjdk.org" class="">riscv-port-dev-retn@openjdk.org</a>>; Aleksey Shipilev <<a href="mailto:shade@redhat.com" class="">shade@redhat.com</a>>; <a href="mailto:riscv-port-dev@openjdk.org" class="">riscv-port-dev@openjdk.org</a> <<a href="mailto:riscv-port-dev@openjdk.org" class="">riscv-port-dev@openjdk.org</a>></div><div style="clear:both;" class="">Subject:Re: RVC by default?</div><div style="clear:both;" class=""><br class=""></div><div class="">Hello</div>Looks pretty similar to me.<div class="">for me it was vanilla recent jdk19 <br class=""><div class="">But later, when I backported next patches to my jdk19 branch, the issue became different ( Arena alloc issue I have reported earlier):</div><div class=""><br class=""></div><div class=""><div class="">8290496: riscv: Fix build warnings-as-errors with GCC 11</div><div class="">8290280: riscv: Clean up stack and register handling in interpreter</div><div class="">8290137: riscv: small refactoring for add_memory_int32/64</div><div class="">8290164: compiler/runtime/TestConstantsInError.java fails on riscv</div><div class="">8291952: riscv: Remove PRAGMA_NONNULL_IGNORED</div><div class="">8291947: riscv: fail to build after JDK-8290840</div><div class="">8291893: riscv: remove fence.i used in user space Backport-of:...</div><div class="">8292713: Unsafe.allocateInstance should be intrinsified without UseUnalignedAccesses</div><div class="">8292867: RISC-V: Simplify weak CAS return value handling</div><div class="">8292407: Improve Weak CAS VarHandle/Unsafe tests resilience under spurious failures</div><div class="">8293100: RISC-V: Need to save and restore callee-saved FloatRegisters in...</div><div class="">8293050: RISC-V: Remove redundant non-null assertions about macro-assembler</div><div class="">8293474: RISC-V: Unify the way of moving function pointer</div><div class="">8293524: RISC-V: Use macro-assembler functions as appropriate</div><div class="">8293566: RISC-V: Clean up push and pop registers</div><div class=""><br class=""></div><div class="">I’m gonna bisect this list and find what changed the behaviour.</div></div><div class=""><br class=""></div><div class="">The workaround says - update to ubuntu 21.04, but its not clear - update runtime environment or build environment.</div><div class="">For me the runtime is ubuntu 22.04, but I build the jdk with sysroot of ubuntu 20.04 ( for better compatibility) and gcc 11.2</div><div class=""><br class=""></div><div class="">Regards, Vladimir<br class=""><div class="">15 сент. 2022 г., в 18:17, Xiaolin Zheng <<a class="" href="mailto:yunyao.zxl@alibaba-inc.com" target="_blank">yunyao.zxl@alibaba-inc.com</a>> написал(а):</div><br class="Apple-interchange-newline"><div class=""><div class="" style="line-height:1.7;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><div class="" style="clear:both;">Hi Vladimir,</div><div class="" style="clear:both;"><br class=""></div><div class="" style="clear:both;">The mailing list says my e-mail exceeds 40KB so I get rejected. But I want to send it out anyway before getting off today's work. So here is a work around:</div><div class="" style="clear:both;">Please check:</div><div class="" style="clear:both;"><span class=""><a class="" href="https://gist.github.com/zhengxiaolinX/25c32853690f7ac1c125d2fe1da19710" target="_blank">https://gist.github.com/zhengxiaolinX/25c32853690f7ac1c125d2fe1da19710</a></span></div><div class="" style="clear:both;"><br class=""></div><div class="" style="clear:both;">Looking forward to your opinions.</div><div class="" style="clear:both;"><br class=""></div><div class="" style="clear:both;">Best,</div><div class="" style="clear:both;">Xiaolin</div></div></div></div><br class=""></div></blockquote></div></div></div></blockquote></div><br class=""></div></div></div></div></div></blockquote></div><br class=""></div></body></html>