Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Update x86_64 and arm64 bindings to v5.13 #42

Merged
merged 2 commits into from
Aug 3, 2021

Conversation

sboeuf
Copy link

@sboeuf sboeuf commented Jul 8, 2021

This patch is a proposal to simplify kvm-bindings crate, moving to the
latest Linux version 5.13.

First thing, instead of maintaining multiple versions (4.14, 4.20 and
now 5.13), this patch only keeps 5.13, and moving forward, we would only
keep the most up to date version.

Signed-off-by: Sebastien Boeuf [email protected]

@sboeuf sboeuf requested a review from andreeaflorescu July 8, 2021 08:16
@sboeuf
Copy link
Author

sboeuf commented Jul 8, 2021

@andreeaflorescu I know I'm removing lots of things through this PR, but I thought I'd give it a try to see what y'all think about it.

@sboeuf sboeuf force-pushed the update_bindings branch from ec2a934 to 3aca3d0 Compare July 8, 2021 09:22
@sboeuf sboeuf requested a review from jiangliu July 8, 2021 09:22
@andreeaflorescu
Copy link
Member

I was thinking we can still keep the arm & x86 bindings. I am a bit unsure who is using this crate, I saw some other dependencies on it from project I was not aware of before. Is it too much trouble to keep them?

Can you also test this with kvm-ioctls to be sure it still works? We can open an RFC PR in kvm-ioctls to patch kvm-bindings to use your fork and do a dry run of the tests.

We also need to check that this still works in the Firecracker use case, but I would assume it does.

I think it would be better to split the PR in multiple commits:

  • one that removes the features, and first just keeps v4.20
  • and one that does the update from v4.20 to v5.13
    It should be clear that way what are the changes.

@sboeuf
Copy link
Author

sboeuf commented Jul 8, 2021

I was thinking we can still keep the arm & x86 bindings. I am a bit unsure who is using this crate, I saw some other dependencies on it from project I was not aware of before. Is it too much trouble to keep them?

No worries I can keep them. That being said, I couldn't find kvm.h in the headers generated along with the kernel for arm arch. Should I simply use the one from arm64? @MrXinWang could you give some input there?

Can you also test this with kvm-ioctls to be sure it still works? We can open an RFC PR in kvm-ioctls to patch kvm-bindings to use your fork and do a dry run of the tests.

Yes I can open a draft PR in kvm-ioctls based on my fork.

We also need to check that this still works in the Firecracker use case, but I would assume it does.

Can you try this out on your side?

I think it would be better to split the PR in multiple commits:

  • one that removes the features, and first just keeps v4.20
  • and one that does the update from v4.20 to v5.13
    It should be clear that way what are the changes.

Yes that sounds like a good plan :)

@MrXinWang
Copy link

MrXinWang commented Jul 8, 2021

I was thinking we can still keep the arm & x86 bindings. I am a bit unsure who is using this crate, I saw some other dependencies on it from project I was not aware of before. Is it too much trouble to keep them?

No worries I can keep them. That being said, I couldn't find kvm.h in the headers generated along with the kernel for arm arch. Should I simply use the one from arm64? @MrXinWang could you give some input there?

Hi both, I spent some time digging into the patchwork, and found that the arm32 hypervisor support in kvm has been removed - It explains why @sboeuf cannot found the kvm.h for arm32 . See https://patchwork.kernel.org/project/kvm/cover/[email protected]/.

So I think the idea is you cannot create a 32-bit kvm host, but you always can start a 32-bit kvm guest on 64-bit host.

Therefore I think yes?

@sboeuf
Copy link
Author

sboeuf commented Jul 8, 2021

@MrXinWang thanks for checking. So I'll do the same thing we do for x86 (which means we use the same bindings for both 32 and 64 bits).

@MrXinWang
Copy link

MrXinWang commented Jul 8, 2021

As I am not familiar with x86 system (sorry...), maybe for the x86 system @andreeaflorescu can give some input or suggestions :)) Thanks!

@sboeuf
Copy link
Author

sboeuf commented Jul 8, 2021

@andreeaflorescu #43 is the first step (cleaning up 4.14).

@andreeaflorescu
Copy link
Member

I'll look into the changes, but I am going on vacation starting with Monday, and I have a few other things I need to get done by then. I'll let you know about my progress.

My plan is to:

  • do a diff to see what's changed between 4.20 and 5.13 in terms of structures (and other binding specific defines)
  • update the Firecracker's bindings
  • run tests to see if it works with the current bindings
  • check if upgrading from one version to another works

@sboeuf sboeuf force-pushed the update_bindings branch 2 times, most recently from f963d7b to 78315e8 Compare July 8, 2021 10:31
@sboeuf
Copy link
Author

sboeuf commented Jul 8, 2021

@andreeaflorescu ok this PR is up to date now, based on the previous discussions. Take your time to test it on Firecracker, and once you can confirm it is working fine, we can move forward and merge it (when you're back from your vacation).
In the meantime I'll send a draft PR on kvm-ioctls relying on this branch.

@sboeuf
Copy link
Author

sboeuf commented Jul 8, 2021

Here is the kvm-ioctls draft: rust-vmm/kvm#160

@sboeuf sboeuf force-pushed the update_bindings branch 3 times, most recently from 8c479f5 to e680485 Compare July 9, 2021 14:03
andreeaflorescu
andreeaflorescu previously approved these changes Jul 9, 2021
@sboeuf
Copy link
Author

sboeuf commented Jul 9, 2021

@andreeaflorescu if you agree I can simply close #43 and we can merge (when ready) this one directly since it includes #43.

@andreeaflorescu
Copy link
Member

Ah, I mistakenly approved this one, I meant to approve the other one. I didn't yet got to integrate the changes in Firecracker. I just did a read up on the diffs. It looks like some structures we're using in Firecracker are changing state (like the kvm_irqchip), but I believe they can be easily addressed.

@alexandruag said he'll take a look at this one as well while I am off.

@andreeaflorescu
Copy link
Member

@andreeaflorescu if you agree I can simply close #43 and we can merge (when ready) this one directly since it includes #43.

We can also do as you propose.

@andreeaflorescu andreeaflorescu dismissed their stale review July 9, 2021 16:10

Approved by mistake.

@andreeaflorescu
Copy link
Member

andreeaflorescu commented Jul 23, 2021

@sboeuf what bindgen version did you use for generating the new bindings? I think we might need to update this in the documentation as well. Locally it looks like for me it installs v0.59.0.

Looks like I am not fully back from vacation 🤣 I notice now that you're adding the version in the docs, I was just looking at the wrong PR.

Copy link
Member

@andreeaflorescu andreeaflorescu left a comment

Choose a reason for hiding this comment

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

I did a re-run with the latest version of bindgen. My comments reflect the changes. I think it might be worth it to use the latest version to generate the bindings as there are quite a few more structures that can derive partialeq & debug and those are helpful when writing tests/debugging.

I also finished my analysis of changes on both x86_64 and aarch64, and I'll publish it (still need to figure out where/how 😆); tl;dr: the changes look safe.

We still need to integrate the changes with versionize & firecracker, but I am not expecting any problems.

CONTRIBUTING.md Show resolved Hide resolved
src/arm64/bindings.rs Outdated Show resolved Hide resolved
src/arm64/bindings.rs Outdated Show resolved Hide resolved
@sboeuf
Copy link
Author

sboeuf commented Jul 23, 2021

@andreeaflorescu sounds good, I'll update the PR with bindings generated from bindgen v0.59.0

This patch makes the bindings v4.20 the only available version for all
architectures. Because of this unique possibility, the code is
simplified, removing the specific Rust features to pick a specific
bindings version.

Signed-off-by: Sebastien Boeuf <[email protected]>
@sboeuf sboeuf force-pushed the update_bindings branch from e680485 to d7ef867 Compare July 26, 2021 09:16
@sboeuf
Copy link
Author

sboeuf commented Jul 26, 2021

@andreeaflorescu PR updated! Please have a look.

@AlexandruCihodaru
Copy link

Hello, I have tested it with Firecracker, so far all integration tests are passing.

Copy link
Member

@andreeaflorescu andreeaflorescu left a comment

Choose a reason for hiding this comment

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

The coverage also needs to be updated.

Once that is fixed, I think we can merge the PR.

.buildkite/pipeline.yml Outdated Show resolved Hide resolved
@andreeaflorescu
Copy link
Member

Hello, I have tested it with Firecracker, so far all integration tests are passing.

Thanks, @AlexandruCihodaru!

Replace the v4.20 bindings with the up to date v5.13 ones. The `arm`
architecture is now covered with the `arm64` bindings the same way both
`x86` and `x86_64` are covered by the bindings from `x86_64`.

Signed-off-by: Sebastien Boeuf <[email protected]>
@sboeuf sboeuf force-pushed the update_bindings branch from d7ef867 to 639531e Compare July 29, 2021 10:04
@sboeuf
Copy link
Author

sboeuf commented Jul 29, 2021

@andreeaflorescu PR updated accordingly :)

@sboeuf
Copy link
Author

sboeuf commented Aug 3, 2021

@andreeaflorescu can we find someone else to approve and merge this PR?

Copy link
Contributor

@acatangiu acatangiu left a comment

Choose a reason for hiding this comment

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

Changes look good!

Copy link
Contributor

@alexandruag alexandruag left a comment

Choose a reason for hiding this comment

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

Looks good, apologies for the delay.

@alexandruag alexandruag merged commit 441a9a8 into rust-vmm:master Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants