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

Port upstream libffi 3.4.4 for x86_64 #1

Closed
wants to merge 2 commits into from

Conversation

andreittr
Copy link
Contributor

@andreittr andreittr commented Jul 25, 2023

This change ports the parts of libffi 3.4.4 relevant to x86 to unikraft.

Part of work on Python 3.10 (unikraft/lib-python3#15).

@razvand razvand self-assigned this Aug 5, 2023
@razvand razvand added the enhancement New feature or request label Aug 5, 2023
Copy link
Member

@StefanJum StefanJum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andreittr Will we only support this on x86_64 for this release?

README.md Outdated
Comment on lines 6 to 8
Please refer to the `README.md` as well as the documentation in the
`doc/` subdirectory of the main unikraft repository for further
information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Please refer to the `README.md` as well as the documentation in the
`doc/` subdirectory of the main unikraft repository for further
information.
Please refer to the `README.md` as well as the documentation in the `doc/` subdirectory of the main unikraft repository for further information.

Use one sentence per line and one line per sentence.

README.md Outdated
Comment on lines 1 to 2
libffi for Unikraft
========================
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
libffi for Unikraft
========================
# `libffi` for Unikraft

Use md format, not rst.

@andreittr
Copy link
Contributor Author

@andreittr Will we only support this on x86_64 for this release?

Only the x86_64 work is done thus far (and getting arm done before release is unlikely); perhaps @razvand can opine whether to upstream this in current release or postpone until arm work is also done.

@andreittr
Copy link
Contributor Author

Update: made changes as discussed in unikraft/lib-python3#15.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Copy link

@mariasfiraiala mariasfiraiala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andreittr, I've tested this together with unikraft/lib-python3#15 and it builds just fine.

I am, however, reluctant to have a config option that disables something. I am aware of the usecase, but it still weirds me out; it's kinda counterintuitive to select an option in order to not have the definitions..

Anyway, it's a personal preference, I'll approve the changes once the app-python3 PR is out in order to have a run too.

@andreittr
Copy link
Contributor Author

Thanks @andreittr, I've tested this together with unikraft/lib-python3#15 and it builds just fine.

I am, however, reluctant to have a config option that disables something. I am aware of the usecase, but it still weirds me out; it's kinda counterintuitive to select an option in order to not have the definitions..

Anyway, it's a personal preference, I'll approve the changes once the app-python3 PR is out in order to have a run too.

Oh I completely agree with you on this front, negative options are always more confusing than positive ones. Pity that Kconfig does not support forcefully unselecting a value. Unless and until that becomes a thing I'm afraid we're stuck with this inelegant solution. Other alternatives off the top of my head would be

(a) Leave things as before (positive option, py3 leaves it alone); upside: no negative config options; downside: if option is default 'y' -> py3 won't build unless tweaked, if option defaults to 'n' -> libffi won't build by itself unless tweaked; either way requires documentation and/or tribal knowledge

(b) Leave things as before but check & error out in the Makefiles; upside: no negative config options; downside: we leave to manual trial-and-error something that can and should be automated, and no amount of explaining Kconfig's limitations will lessen users' frustration

(c) Keep negative option but make it invisible; upside: no user confusion by default, libs can still opt out of ffi_type_* definitions when needed; downside: blackmagic™ happends during configuration, it's not clear where to disable ffi_type_* stuff if needed for e.g. a custom lib/app

(d) hack our own fork of Kconfig that can do "select CONFIGVAL=n" (I'm ~90% joking with this one, totally not volunteering to do smth like this)

Thoughts?

@mariasfiraiala
Copy link

Now that you've laid out the options we have, @andreittr, I'd go with the black magik stuff (October it's rapidly approaching 🧙‍♀️). It's the one that has the least damaging downsides, imo. @StefanJum opinions on this?

Btw, really really nice presentation of the alternatives @andreittr 💯

@StefanJum
Copy link
Member

Oh I completely agree with you on this front, negative options are always more confusing than positive ones. Pity that Kconfig does not support forcefully unselecting a value. Unless and until that becomes a thing I'm afraid we're stuck with this inelegant solution.

Right on point. I would honestly keep the negative option as it is now. It is ugly, but at least it's clear and things work out of the box.
From the options you provided I think we could go with (c) (so everything will still work out of the box), but again, I think the current way is cleaner, as ugly as it is.

@mariasfiraiala
Copy link

We shall have it as it is then, all good!

@andreittr
Copy link
Contributor Author

I'd go with the black magik stuff

I think we could go with (c) (so everything will still work out of the box), but again, I think the current way is cleaner, as ugly as it is.

Just thought of a decent compromise between this PR and option (c): keep the option visible but rename its user prompt to a positive statement like "Allow other libraries to supply ffi_type_* definitions". Best of both worlds?

@StefanJum
Copy link
Member

Just thought of a decent compromise between this PR and option (c): keep the option visible but rename its user prompt to a positive statement like "Allow other libraries to supply ffi_type_* definitions". Best of both worlds?

Nice, I think we can do something like Use external ffi_type_* definitions and also provide a help message that will state that if the option is selected, the ffi_type_* are not defined, and are to be supplied by an external library.

This change ports the parts of libffi 3.4.4 relevant to x86 to unikraft.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Copy link

@RaduNichita RaduNichita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tested this as part of python3.10 PR series and it builds and runs fine. Thanks, @andreittr for this nice work! 🏅

I would also go for option c, I think it's the most appropriate for the reasons that @StefanJum and @mariasfiraiala have already mentioned.

Copy link
Member

@StefanJum StefanJum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @andreittr 🚀
Reviewed-by: Stefan Jumarea stefanjumarea02@gmail.com

Copy link

@mariasfiraiala mariasfiraiala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this long journey!

Reviewed-by: Maria Sfiraiala maria.sfiraiala@gmail.com

@RaduNichita RaduNichita self-requested a review August 10, 2023 21:57
Copy link

@RaduNichita RaduNichita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this. Thanks @andreittr for the contribution! 🔝

Reviewed-by: Radu Nichita radunichita99@gmail.com

Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved-by: Razvan Deaconescu razvand@unikraft.io

unikraft-bot pushed a commit that referenced this pull request Aug 11, 2023
This change ports the parts of libffi 3.4.4 relevant to x86 to unikraft.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1
@andreittr andreittr deleted the ttr/port-3.4.4-x86 branch August 11, 2023 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/merged enhancement New feature or request
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

6 participants