Skip to content
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

s390x support for Luajit #395

Open
wants to merge 261 commits into
base: v2.1
Choose a base branch
from
Open

s390x support for Luajit #395

wants to merge 261 commits into from

Conversation

ketank-new
Copy link

Added necessary code to support arch s390x in Luajit.

mundaym and others added 30 commits November 15, 2016 14:44
Guesses for now based on the ELF ABI supplement for zSeries.
Stick to the default until we know what we actually need.
Added missing elif condition for s390x for GCC dependency
Removing the gcc check for now .. missed micheal's comment earlier
changed instruction opcode to 64bit
Added s390x specific condition codes
made some changes like mentioning arch from x86 to S390x
removed some x86 specific code
Added CFrame definations for S390X
values un assigned as i am unsure of the values
Referred arm dasc file have created slots wherein i have to replace them with s390x registers and instructions
Assigned general purpose register to existing macros
Added definitions to macros savereg and restreg
used Store and Load instructions 
to store and load register contents to n from memory
These are educated guesses at this point. We might need more stack space because
we don't have many free registers available.
I believe these macros obey the C calling convention, so we need to
allocate our stack frame and save all callee-save registers. We
can tune it later if it turns out we don't need all the registers.
f8-f15 are callee-saved (not f0,f2,f4 and f6). There isn't space
for them in the caller's stack frame so we need to increase the
size of the interpreter's stack frame.
Still guessing at this point. This code will need to be changed.
used MOVE LONG EXTENDED in place of mov and
MOVE LONG instead of movzx
added instructions to macros, referring macro defination of x86
for macro ins_ANDdid not find equivalent s390x replacement  instruction for 'Not' hence have currently marked the place as '????'

'????' has to be replaced with s390x complement instruction
added definations to macros to test operand type refeered x86 definations
no JUMP instruction found for s390x used BRANCH RELATIVE on CONDITION instead (brc)
Not sure how the condition will be checked , need to discuss this
The extra check for register is currently ignored, and trying to see what value does the encode function return. Its still to be worked out, how this value is used later, after decoding.
We can discuss if we need to keep it 6 bytes or 8 bytes long, Not clear enough to me as well
I have added the number depending on the number of operands, pls check for the ones which access memory.
Also For base register and displacement, should I assume that it will be passed in the same order as it is expected, since I dont have any means to see the output, I am confused a bit for those add modes.
Since we decided to test RR first, thats in progress, but would like to add others as well.
 - Fix syntax errors
 - Fix whitespace (use two-space indentation to match surrounding code)
It's convenient for sp to be a pseudonym for r15 (the stack pointer).
'or_2' doesn't need to be special cased ('or' did because it is a
keyword).
Each memory operand will be a single parameter so we also need
to update the instruction encoding nargs field.
Also sets the action list type to unsigned short (uint16_t) which
I think is the most appropriate type for s390x (x86 uses uint8_t
and other platforms use uint32_t).
@sharkcz
Copy link

sharkcz commented Apr 17, 2019

@siddhesh , if you would look for some s390x and ppc64le hw for things like CI, let me know, we can arrange that.

@jmertic
Copy link

jmertic commented Apr 17, 2019

Let me know if you need s390x hardware access for CI or testing - happy to help provide.

@sharkcz
Copy link

sharkcz commented Apr 18, 2019

I did a quick test on a zEC12 machine running Fedora 29 with "make all check bench" and all looks good.

@siddhesh
Copy link

Thanks for testing, I'll merge it into my v2.1 and work on getting it into Fedora.

@siddhesh
Copy link

Hi, I have now merged the s390x port into my tree in v2.1 branch and also pushed the patch into Fedora rawhide[1]. F30 is already branched so this will automatically go into F31, but I'll also check with Igor to see if he is comfortable backporting the patches to F30.

I've started pushing my branch patches into Debian, which is a bit slow going (since I am less familiar with Debian processes than Fedora) but the maintainer has agreed in principle to accept patches.

[1] https://koji.fedoraproject.org/koji/buildinfo?buildID=1254116

@sharkcz
Copy link

sharkcz commented Apr 24, 2019

Sounds good, I suppose there is a plan for long term maintenance of the fork, right?

@siddhesh
Copy link

Sounds good, I suppose there is a plan for long term maintenance of the fork, right?

For now my goal is to try and regain the lost momentum on the project by cherry-picking PRs into my fork and them pushing them into distributions and staying in sync with this repo at the same time. Please get in touch with me on siddhesh at gotplt dot org to continue the discussion on the fork since this PR may not be the best place to do that.

@kamiyaa
Copy link

kamiyaa commented Jan 31, 2020

Any updates on if this will be merged?

@yselkowitz
Copy link

yselkowitz commented Mar 25, 2020

I'm having an issue building lyaml with this patchset. If you install gcc, git, libyaml-devel, and the patched luajit, checkout lyaml, and run luajit build-aux/luke, I get:

luke: fatal: no modules table in 'lukefile', nothing to build

I don't see this with lua on s390x, or with (patched) luajit on other arches that I have tried.

@iii-i
Copy link

iii-i commented Mar 31, 2020

lyaml issue is fixed by moonjit#107

@ccorley
Copy link

ccorley commented Oct 8, 2020

We also would like to run Kong on s390x, which requires LuaJIT. @MikePall could you please shed some light on what it would take to get PR #395 merged?

@rinaldou
Copy link

Hi ccorley!
I was able to build kong on s390x (RHEL 8).
Check this one https://github.com/openresty/luajit2/pull/89/files
After I corrected this file, I was able to build lyaml on s390x.
On kong, run kong build tools to create the appropriate requirements.
Good luck!

@ccorley
Copy link

ccorley commented Oct 15, 2020

Thanks, rinaldou! After I pulled that fix in, I was able to build as well. For anyone else that runs into this, I created a LuaJIT patch for that 2-line change from the OpenResty 1.17.8.2 source, then applied the patch during the kong-build-tools package-kong step. Also important, I used the kong 'next' source branch.

@skriesch
Copy link

skriesch commented Feb 1, 2021

What is the status here?
If you require any test environment, you can use the LinuxONE Community Cloud. The usage is free for Open-Source Developers:
https://developer.ibm.com/components/ibm-linuxone/gettingstarted/

@jmertic
Copy link

jmertic commented Feb 1, 2021 via email

@siddhesh
Copy link

siddhesh commented Feb 1, 2021

From my understanding, they have an instance for testing. Not sure what other blockers exist

That's me (moonjit) who has that instance, which is different from LuaJIT/LuaJIT. Given that I'm not actively involved in either project, please feel free to take that instance back and offer it to Mike. I don't have anything to salvage from that instance.

@membphis
Copy link

need to resolve the conflicting files first

@iii-i
Copy link

iii-i commented Feb 22, 2021

@membphis FWIW I submitted a rebased version here: #631

@LuaJIT LuaJIT deleted a comment from jmertic Feb 23, 2021
@Sarah-Kriesch
Copy link

Thank you for this engagement! We would be happy about this enablement.

@teward
Copy link

teward commented Apr 3, 2022

The Lua module for nginx now requires luajit to function. As a result, it is now impossible to build nginx for s390x arch in Debian because there is zero support for s390x in LuaJIT. Can this get put in a higher priority list for the LuaJIT team?

@LoganDark
Copy link

Considering the fact that this PR has been sitting for over 4 years with absolutely zero response from LuaJIT or anyone even remotely connected to LuaJIT (not members or even contributors), I have doubts that this will ever be merged or even acknowledged.

The best course of action here is to abandon all hope of getting this merged upstream, and make a high-quality third-party package/distribution that everyone can depend on.

@glaubitz
Copy link

This PR needs some clean-up. I don't think it's reasonable to merge it with 261 individual commits.

@nealef
Copy link

nealef commented May 12, 2022

I am working with the Open Mainframe Project (part of the Linux Foundation) to get this cleaned up and to address the concerns in #395 (comment). We hope to get this done over the next couple of months and to generate a PR that is more acceptable.

@Bisht13
Copy link

Bisht13 commented Jun 21, 2022

I'm currently working with the Open Mainframe Project under @nealef on cleaning this PR, resolving merge conflicts and addressing any other concerns with a goal of merging it in couple of months.

I'll be splitting this PR into 2 or more PRs for easier reviewing purposes.

@skriesch
Copy link

skriesch commented Aug 8, 2023

The mentorship program by the Linux Foundation is finished and the s390x support is provided by #891 .
Linux distributions are waiting for a working Luajit for s390x! Can you accept the PR, please?

You can receive a Linux vm for verification for free for 120 days on a mainframe via this link: https://developer.ibm.com/articles/get-started-with-ibm-linuxone/

If you want to receive long-term access as an Open Source Community Member, you can use this form with a reference to the special open source project: https://www.ibm.com/community/z/open-source/virtual-machines-request/

Choosable Linux distributions: SLES (upgradable to openSUSE), RHEL, Ubuntu, debian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet