New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8252324: Signal related code should be shared among POSIX platforms #157
Conversation
👋 Welcome back gziemski! A progress list of the required criteria for merging this PR into |
@gerard-ziemski The following label will be automatically applied to this pull request: When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing list. If you would like to change these labels, use the |
@gerard-ziemski the test group 8252324 does not exist |
@gerard-ziemski you need to get approval to run the tests in tier1 for commits up until 4bc34bc1 |
Webrevs
|
Mailing list message from Doerr, Martin on hotspot-runtime-dev: Hi Gerard, sorry for the long delay. It took time to get our nightly tests working again on AIX. Note that there's still unused code left in os_aix.cpp (see below). Best regards, diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp -//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// |
Mailing list message from Doerr, Martin on hotspot-runtime-dev: Sorry, Gerard's email address was wrong.
|
I will take another look at AIX changes to see if I missed something.
Thank you for the diff, I'll use it and update the webrev. |
I took another look at the changes and I have concerns over the following methods: PosixSignals::SR_handler They seem to differ substantially in parts from the other POSIX platforms. In my early webrevs I have accounted for those changes using "#if defined(AIX)", but during pre-reviews you asked me to revert to the common POSIX code. Can you please take a look again and tell me if you are OK with the following SA related changes:
I will upload, what I think (based only on the code diffs between the platforms as I lack AIX platform understanding) the AIX platform needs here. |
I believe the reason for not using POSIX semaphores was that it is not supported on as400 PASE which we don't support in OpenJDK. I'm not aware of any problems when using this common POSIX code on AIX 7.2. |
Mailing list message from Thomas St��fe on hotspot-runtime-dev: Hi Gerard, first off, have said it already, but great work! This is a really good About your last commit ( https://bugs.openjdk.java.net/browse/JDK-8005849 It introduces also those "RANDOMLY_.." variables and uses them in Linux and -- Weirdly enough, that exact version for JDK-8005849 I cannot even find in changeset: 18025:b7bcf7497f93 But that one seems to be already the later version, not the initial one I -- Anyway, I think all that coding is not needed for AIX. The fact that it --https://bugs.openjdk.java.net/browse/JDK-8005849 Also, if you feel like it, you also can remove the remaining unused -- I wish you had done the move to a new file (os_posix -> signals_posix) in a For all I see this seems fine. I think roll back the last commit and let us test the final version for a Thanks, Thomas On Wed, Sep 23, 2020 at 9:17 PM Gerard Ziemski <gziemski at openjdk.java.net> |
Reverted the last commit. Thank you for taking a look and testing - please let me know how it goes. I have already tested this change here at Oracle a while ago, but I will do so once again... |
Mach5 hs-tier1,2,3,4,5,6,7 testing looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Gerard,
Thank you for tackling this long overdue cleanup and conciliation of the the signal management code! Great work on a tedious task.
Overall this looks okay but I confess it is very hard to compare each previous platform version with the new shared version. I'm glad the AIX folk have take an indepth look there.
I have a few minor comments in specific files below.
I would also suggest naming the file posixSignal.cpp/hpp as that is the more common naming pattern.
Future cleanup: do we really need JVM_handle_<os>_signal to be cpu specific? I can imagine one copy of this with a few ifdefs or newly introduced os::pd_* functions.
Thanks,
David
@gerard-ziemski this pull request can not be integrated into git checkout JDK-8252324
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Tests on AIX look good so far. Maybe we should re-check after conflict resolution, but basically, I think it can get pushed when reviews are done. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gerard, thank you for doing this! Thank you to Martin and Thomas for looking at the AIX code.
Thank you for the review! |
Sorry about that, I do understand how hard it was to review it and really appreciate it!
Me too!
I based the name on the other files in that directory, i.e.: jvm_posix.cpp so I introduced: signals_posix.cpp
Thank you David very much for catching the merge issues and review! |
I will merge again with current, review the changes again looking for weird merge issue, push here, then re-test... |
Darn, I closed it by mistake (I thought I was closing a comment), reopening. |
@gerard-ziemski This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for more details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 17 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Yes my bad. I was thinking of the class->file naming convention, but in this directory we're following the foo_<os> convention. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gerard, this is a great cleanup. I am fine with the changes.
This will make maintenance of ports easier. As we see right in this patch, platform ports can diverge over time, especially if they are closed ports which only exist downstream (as the AIX port did for a long time at SAP).
.. Thomas
Thank you Martin for the review! |
Sorry for taking so long, but this is my 1st github pr and I did not liked the merge issues that David discovered and tried to redo the merge, but I keep getting it wrong. I just forced pushed update removing the BIG merge and I keep working on it, hopefully without introducing another huge merge. If anyone has tips on how to apply local changes (i.e. rebase/stash?) without having to merge, please let me know. Once I figure this out, I will re-implement the few, non-merge, issues that David discovered and this will be ready for integration. |
@gerard-ziemski Please do not force-push any commits in an open PR as it breaks the commit history and the chain of review comments. I will not be able to see the merge issues actually fixed as a diff from the previous commit. |
This reverts commit cc13700d7d3f15927e22d92d9f5ec9a0739ef9a1.
|
Can anyone explain what this means and whether it's OK to go ahead with this pr, or should I close this one (since I made quite a mess of it) and start a new one? |
Hi Gerard, I'm afraid something is still very wrong here. I see you fixing the original merge issues in: b33d292e96a559b8a3a998641411f61bf087738f (Address David's review issues ) but then the "Fix Merge" commit 4f5d4cd49436b64dc3770e4ba1f811a76b5a09e7 applied after that seems to have reversed them again! I think it might be necessary to close this PR and create a new one. Thanks. |
Mailing list message from Thomas St��fe on hotspot-runtime-dev:
I agree. Also, then you get the new Activity-based builds and tier0 tests Cheers, Thomas Thanks. |
I'm considering this pr to be "lost cause", so I just "force pushed" to a known good state, wiping out the bad merge that backed out my fixes based on David's comments, so that I have a snapshot of what I want to become the basis of new pr. Just thought I would explain what I'm trying to do before anyone points out to me that I should not be using "push --force". |
I think I recovered this pr to the point where we could continue with reviews (all changes are in and it passes Mach5 hs-tier1,2,3,4,5 testing), but I do like the idea of Activity-based builds and tier0 tests with new pr, so I'm going to close this one, and open a new one shortly... Thank you Thomas and David for assuring me that the huge merges eventually get resolved and disappear automatically -that was the reason I started tweaking this pr and why I got it messed up. |
The new pr for this issue is #497 |
hi all,
Please review this change that refactors common POSIX code into a separate
file.
Currently there appears to be quite a bit of duplicated code among POSIX
platforms, which makes it difficult to apply single fix to the signal code.
With this fix, we will only need to touch single file for common POSIX
code fixes from now on.
The APIs which moved from os/bsd/os_bsd.cpp to to os/posix/PosixSignals.cpp:
////////////////////////////////////////////////////////////////////////////////
// signal support
void os::Bsd::signal_sets_init()
sigset_t* os::Bsd::unblocked_signals()
sigset_t* os::Bsd::vm_signals()
void os::Bsd::hotspot_sigmask(Thread* thread)
////////////////////////////////////////////////////////////////////////////////
// sun.misc.Signal support
static void UserHandler(int sig, void siginfo, void context)
void os::user_handler()
void os::signal(int signal_number, void* handler)
void os::signal_raise(int signal_number)
int os::sigexitnum_pd()
static void jdk_misc_signal_init()
void os::signal_notify(int sig)
static int check_pending_signals()
int os::signal_wait()
////////////////////////////////////////////////////////////////////////////////
// suspend/resume support
static void resume_clear_context(OSThread osthread)
static void suspend_save_context(OSThread osthread, siginfo_t siginfo, ucontext_t context)
static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context)
static int SR_initialize()
static int sr_notify(OSThread* osthread)
static bool do_suspend(OSThread* osthread)
static void do_resume(OSThread* osthread)
///////////////////////////////////////////////////////////////////////////////////
// signal handling (except suspend/resume)
static void signalHandler(int sig, siginfo_t* info, void* uc)
struct sigaction* os::Bsd::get_chained_signal_action(int sig)
static bool call_chained_handler(struct sigaction actp, int sig,
siginfo_t siginfo, void context)
bool os::Bsd::chained_handler(int sig, siginfo_t siginfo, void context)
int os::Bsd::get_our_sigflags(int sig)
void os::Bsd::set_our_sigflags(int sig, int flags)
void os::Bsd::set_signal_handler(int sig, bool set_installed)
void os::Bsd::install_signal_handlers()
static const char get_signal_handler_name(address handler,
char* buf, int buflen)
static void print_signal_handler(outputStream* st, int sig,
char* buf, size_t buflen)
void os::run_periodic_checks()
void os::Bsd::check_signal_handler(int sig)
The APIs which moved from os/posix/os_posix.cpp to os/posix/PosixSignals.cpp:
const char* os::Posix::get_signal_name(int sig, char* out, size_t outlen)
int os::Posix::get_signal_number(const char* signal_name)
int os::get_signal_number(const char* signal_name)
bool os::Posix::is_valid_signal(int sig)
bool os::Posix::is_sig_ignored(int sig)
const char* os::exception_name(int sig, char* buf, size_t size)
const char* os::Posix::describe_signal_set_short(const sigset_t* set, char* buffer, size_t buf_size)
void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set)
const char* os::Posix::describe_sa_flags(int flags, char* buffer, size_t size)
oid os::Posix::print_sa_flags(outputStream* st, int flags)
static bool get_signal_code_description(const siginfo_t* si, enum_sigcode_desc_t* out)
void os::print_siginfo(outputStream* os, const void* si0)
bool os::signal_thread(Thread* thread, int sig, const char* reason)
int os::Posix::unblock_thread_signal_mask(const sigset_t set)
address os::Posix::ucontext_get_pc(const ucontext_t ctx)
void os::Posix::ucontext_set_pc(ucontext_t* ctx, address pc)
struct sigaction* os::Posix::get_preinstalled_handler(int sig)
void os::Posix::save_preinstalled_handler(int sig, struct sigaction& oldAct)
DETAILS:
Public APIs which are now internal static PosixSignals::
sigset_t* os::Bsd::vm_signals()
struct sigaction* os::Bsd::get_chained_signal_action(int sig)
int os::Bsd::get_our_sigflags(int sig)
void os::Bsd::set_our_sigflags(int sig, int flags)
void os::Bsd::set_signal_handler(int sig, bool set_installed)
void os::Bsd::check_signal_handler(int sig)
const char* os::Posix::get_signal_name(int sig, char* out, size_t outlen)
bool os::Posix::is_valid_signal(int sig)
const char* os::Posix::describe_signal_set_short(const sigset_t* set, char* buffer, size_t buf_size)
void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set)
const char* os::Posix::describe_sa_flags(int flags, char* buffer, size_t size)
oid os::Posix::print_sa_flags(outputStream* st, int flags)
static bool get_signal_code_description(const siginfo_t* si, enum_sigcode_desc_t* out)
void os::Posix::save_preinstalled_handler(int sig, struct sigaction& oldAct)
Public APIs which moved to public PosixSignals::
void os::Bsd::signal_sets_init()
void os::Bsd::hotspot_sigmask(Thread* thread)
bool os::Bsd::chained_handler(int sig, siginfo_t* siginfo, void* context)
void os::Bsd::install_signal_handlers()
bool os::Posix::is_sig_ignored(int sig)
int os::Posix::unblock_thread_signal_mask(const sigset_t set)
address os::Posix::ucontext_get_pc(const ucontext_t ctx)
void os::Posix::ucontext_set_pc(ucontext_t* ctx, address pc)
Internal APIs which are now public in PosixSignals::
static void jdk_misc_signal_init()
static int SR_initialize()
static bool do_suspend(OSThread* osthread)
static void do_resume(OSThread* osthread)
static void print_signal_handler(outputStream* st, int sig, char* buf, size_t buflen)
New APIs in PosixSignals::
static bool are_signal_handlers_installed();
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/157/head:pull/157
$ git checkout pull/157