Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@michael2012z
Copy link
Member

@michael2012z michael2012z commented May 27, 2020

Splits from #1126.

To enable CH on AArch64, we need to change the process of creating and activating VCPU's.
To make it easy to review, this PR contains the modifications for X86 only, ARM code will be added later.

Between X86 and AArch64, there is some differences in booting a VM:

  • X86_64 can setup IOAPIC before creating any VCPU.
  • AArch64 have to create VCPU's before creating GIC.

The old booting process is:

  1. load_kernel()
    load kernel binary
    configure system
  2. activate_vcpus()
    create & start VCPU's

So we need to separate "activate_vcpus()" into "create_vcpus()" and "activate_vcpus()" (to start VCPUS's only). We also separate load_kernel() into "load_kernel()" and "configure system()" (GIC setup and FDT generating is included in it) to align the steps among architectures.

The new procedure is:

  1. load kernel
  2. create VCPU's
  3. configure system
  4. start VCPU's

Signed-off-by: Michael Zhao [email protected]

@michael2012z michael2012z marked this pull request as draft May 27, 2020 05:32
@michael2012z michael2012z changed the title vmm: Change booting process to cover AArch64 requirements [WIP] vmm: Change booting process to cover AArch64 requirements May 27, 2020
@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from 03030a1 to 420b8c6 Compare May 27, 2020 06:16
@michael2012z michael2012z changed the title [WIP] vmm: Change booting process to cover AArch64 requirements vmm: Change booting process to cover AArch64 requirements May 27, 2020
@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from 420b8c6 to 54afc89 Compare May 27, 2020 06:23
@sameo
Copy link
Member

sameo commented May 27, 2020

@michael2012z Does the configure_system step has to happen after the GIC creation on aarch64?

@michael2012z
Copy link
Member Author

@sameo In configure_system() we are going to generate FDT. So all devices including GIC need to be ready before it.

@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from 54afc89 to de0ec54 Compare May 27, 2020 09:45
@michael2012z
Copy link
Member Author

The integration test failure was fixed. Now the PR is ready for review.

@michael2012z michael2012z marked this pull request as ready for review May 27, 2020 10:07
Copy link
Member

@rbradford rbradford left a comment

Choose a reason for hiding this comment

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

Did you consider if you could have the same flow on x86. Where load_kernel does not call configure_system().

That might lead to less difference in the architecture paths?

Or maybe the vCPUs could be setup earlier on all architectures.

In my opinion any function that has a same name should be called at the same point in the flow, if that means you need to do further refactoring (or split configure_system) then that's fine as I think there is more value in having more similarity and commonality.

@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from de0ec54 to 7108175 Compare May 28, 2020 07:51
@michael2012z
Copy link
Member Author

michael2012z commented May 28, 2020

any function that has a same name should be called at the same point in the flow

I totally agree with this.

Now that load_kernel() includes both loading and configuring, it's ideal to divide it into two: load_kernel() loads only, configure_system() configures only. On ARM, GIC and FDT things can be placed into configure_system().

X86 and ARM align the path in this way.

@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from 7108175 to b88589e Compare May 28, 2020 08:23
@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from 39021fa to 5abf67d Compare June 1, 2020 01:32
@michael2012z michael2012z mentioned this pull request Jun 1, 2020
15 tasks
@michael2012z
Copy link
Member Author

Hi, @rbradford, @sameo , may I have more comments from you for this PR?

@sboeuf
Copy link
Member

sboeuf commented Jun 2, 2020

@michael2012z I'll have a look today.

Between X86 and AArch64, there is some difference in booting a VM:
- X86_64 can setup IOAPIC before creating any VCPU.
- AArch64 have to create VCPU's before creating GIC.

The old process is:
1. load_kernel()
    load kernel binary
    configure system
2. activate_vcpus()
    create & start VCPU's

So we need to separate "activate_vcpus" into "create_vcpus" and
"activate_vcpus" (to start vcpus only). Setup GIC and create FDT
between the 2 steps.

The new procedure is:
1. load_kernel()
    load kernel binary
    (X86_64) configure system
2. create VCPU's
3. (AArch64) setup GIC
4. (AArch64) configure system
5. start VCPU's

Signed-off-by: Michael Zhao <[email protected]>
Now the flow of both architectures are aligned to:
1. load kernel
2. create VCPU's
3. configure system
4. start VCPU's

Signed-off-by: Michael Zhao <[email protected]>
@michael2012z michael2012z force-pushed the aarch64-enable-booting-process branch from 5abf67d to 16f19dd Compare June 3, 2020 05:34
@michael2012z
Copy link
Member Author

@sboeuf , @rbradford , thank you for reviewing. I updated the code correspondingly.

Copy link
Member

@sboeuf sboeuf left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @michael2012z!

@sameo PTAL

@sboeuf sboeuf merged commit 8f7dc73 into cloud-hypervisor:master Jun 3, 2020
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.

4 participants