GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — GH-139914: Handle stack growth direction on HPPA by stefanor · Pull Request #140028 · python/cpython Conversation
|
Please do so. A regression fix needs to be announced so that users know that their bug has been indeed fixed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| uintptr_t here_addr = _Py_get_machine_stack_pointer(); | ||
| _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; | ||
| #ifdef __hppa__ | ||
| if (here_addr <= _tstate->c_stack_soft_limit - margin_count * _PyOS_STACK_MARGIN_BYTES) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can't we pre-compute the bound?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The immediate answer is: No because margin_count is a function parameter.
However... This is always set to 1, so it could be removed...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant to avoid computing twice _tstate->c_stack_soft_limit - margin_count * _PyOS_STACK_MARGIN_BYTES to avoid having a double ifdef in this function.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
_Py_InitializeRecursionLimits() can change the limits if c_stack_hard_limit == 0 (I assume that's the uninitialized state)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We can pre-compute margin_count * _PyOS_STACK_MARGIN_BYTES (used 4 times in the source) potentially saving a multiply.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I assume that's the uninitialized state
That's also something I actually find weird. If we're in an uninitialized state, how come can we use the soft limit? anyway, let's leave the code as is as it could actually be less readable in the end and introduce a subtle issue if _Py_InitializeRecursionLimits could change the soft limit value at that point.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Come to think of it, we only hit that second if block if we pass the first one. Given that we're reversing the direction of the comparison, on HPPA we won't get here if c_stack_soft_limit is 0.
@markshannon: Why do we call _Py_InitializeRecursionLimits here?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Because this in an API function, and the stack limits might not have been initialized.
Maybe we are being overly conservative, but it is harmless to check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Don't we risk never reaching never reaching the initialisation check on most platforms, if c_stack_soft_limit is 0? (And possibly on HPPA too, due to underflow of an unsigned int)
It seems like this whole first if block should just be removed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The general implementation looks sound.
Rather than mysterious #ifdef __hppa__ could you #define STACK_GROWS_DOWN in the config and use #if STACK_GROWS_DOWN for clarity and to keep things tidy in case any other platform has a stack the grows up.
OOI what is hppa? Is this PA-RISC, or some new variant?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| uintptr_t here_addr = _Py_get_machine_stack_pointer(); | ||
| _PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate; | ||
| #ifdef __hppa__ | ||
| if (here_addr <= _tstate->c_stack_soft_limit - margin_count * _PyOS_STACK_MARGIN_BYTES) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Because this in an API function, and the stack limits might not have been initialized.
Maybe we are being overly conservative, but it is harmless to check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes, it is. Still going as Debian port. The newest hardware is 20 years old at this point, but the port is still alive. It'll probably keep going as long as GCC and Linux support it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thank you for upstreaming the patch! Do the tests pass on HPPA? I would think that I've sent a PR to your branch to expose This PR will conflict with #139668, which will take some time to approve as it adds new API. If this PR is not urgent, I think it's best to wait for #139668, then rebase this one and ask you to check the result. Does that sound OK? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
While looking at pythonGH-140028, I found some unrelated test regressions in the 3.14 cycle. These seem to all come from pythonGH-130317. From what I can tell, that made Python more correct than it was before. According to [0], HP PA RISC uses 1 for SNaN and thus a 0 for QNaN. [0]: https://grouper.ieee.org/groups/1788/email/msg03272.html (cherry picked from commit 76fea55) Co-authored-by: Stefano Rivera <[email protected]>
…40467) gh-130317: Fix SNaN broken tests on HP PA RISC (GH-140452) While looking at GH-140028, I found some unrelated test regressions in the 3.14 cycle. These seem to all come from GH-130317. From what I can tell, that made Python more correct than it was before. According to [0], HP PA RISC uses 1 for SNaN and thus a 0 for QNaN. [0]: https://grouper.ieee.org/groups/1788/email/msg03272.html (cherry picked from commit 76fea55) Co-authored-by: Stefano Rivera <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I just have a minor comment on a test.
@markshannon: Your concern has been addressed, _Py_STACK_GROWS_DOWN macro was added. Would you mind to review the updated PR?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
might also be good to go ahead and get a 3.14 backport ready at the same time? i would click merge - but i'm not going to take on the backport. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-141404 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yes, I have a backport already prepared. #141404 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…GH-140028) Adapted from a patch for Python 3.14 submitted to the Debian BTS by John David Anglin https://bugs.debian.org/1105111#20
…GH-140028) Adapted from a patch for Python 3.14 submitted to the Debian BTS by John David Anglin https://bugs.debian.org/1105111#20
|
Merged main and reran tests, since #139668 landed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't think those regressions are related. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…141404) * [3.14] GH-139914: Handle stack growth direction on HPPA (GH-140028) Adapted from a patch for Python 3.14 submitted to the Debian BTS by John David Anglin https://bugs.debian.org/1105111#20 * Forgot to update test_call * WTF typo
Missed in pythonGH-139914, as it was introduced around the same time and is only relevant to pydebug builds.
Missed in pythonGH-139914, as it was introduced around the same time and is only relevant to pydebug builds.
Missed in pythonGH-139914, as it was introduced around the same time and is only relevant to pydebug builds.
Missed in pythonGH-139914, as it was introduced around the same time and is only relevant to pydebug builds.
While looking at python#140028, I found some unrelated test regressions in the 3.14 cycle. These seem to all come from python#130317. From what I can tell, that made Python more correct than it was before. According to [0], HP PA RISC uses 1 for SNaN and thus a 0 for QNaN. [0]: https://grouper.ieee.org/groups/1788/email/msg03272.html
Adapted from a patch for Python 3.14 submitted to the Debian BTS by John https://bugs.debian.org/1105111#20 Co-authored-by: John David Anglin <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.