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

Option to disable CPU template in runtime config for non-Intel support #525

Closed
jingkaihe opened this issue Jul 25, 2021 · 2 comments
Closed
Assignees

Comments

@jingkaihe
Copy link
Contributor

Hi!

Currently firecracker-containerd is enforcing CPU template as a runtime config where default T2 template is pinned in the config

CPUTemplate: string(defaultCPUTemplate),

Due to only the fact that only Intel flavored T2 and C3 instance types are supported, when I ran the quick start example on an AMD x86 machine firecracker threw

DEBU[2021-07-25T21:53:08.494627213+01:00] sending signal 9 to 2606                      jailer=noop runtime=aws.firecracker vmID=9b003085-bb35-4a68-82d8-1313e6d28a80
ERRO[2021-07-25T21:53:08.494743477+01:00] failed to create VM                           error="failed to start the VM: [PUT /actions][400] createSyncActionBadRequest  &{FaultMessage:Internal error while starting microVM: Error configuring the vcpu for boot: Cpuid error: InvalidVendor}" runtime=aws.firecracker vmID=9b003085-bb35-4a68-82d8-1313e6d28a80
DEBU[2021-07-25T21:53:08.494793305+01:00] stopVMM(): sending sigterm to firecracker     runtime=aws.firecracker
WARN[2021-07-25T21:53:08.496218704+01:00] firecracker exited: signal: killed            runtime=aws.firecracker
DEBU[2021-07-25T21:53:08.496377449+01:00] closing the exitCh 1 error occurred:
	* signal: killed
  runtime=aws.firecracker
ERRO[2021-07-25T21:53:08.496589230+01:00] shim CreateVM returned error                  error="rpc error: code = Unknown desc = failed to create VM: failed to start the VM: [PUT /actions][400] createSyncActionBadRequest  &{FaultMessage:Internal error while starting microVM: Error configuring the vcpu for boot: Cpuid error: InvalidVendor}"
DEBU[2021-07-25T21:53:08.500861255+01:00] shim has been terminated                      error="signal: killed" vmID=9b003085-bb35-4a68-82d8-1313e6d28a80
ERRO[2021-07-25T21:53:08.504788450+01:00] copy shim log                                 error="read /proc/self/fd/13: file already closed"

I believe this error is raised by:

https://github.com/firecracker-microvm/firecracker/blob/35829883994e69c807f52b9efea915c5ad42f45f/src/cpuid/src/template/intel/mod.rs#L14-L16

On the other hand it runs perfectly fine on the AMD machine when CPUTemplate is not passed into models.MachineConfiguration with something looks like:

iff --git a/runtime/helpers.go b/runtime/helpers.go
index 84a43f8..ccc7b8b 100644
--- a/runtime/helpers.go
+++ b/runtime/helpers.go
@@ -33,20 +33,15 @@ const (
 
 func machineConfigurationFromProto(cfg *config.Config, req *proto.FirecrackerMachineConfiguration) models.MachineConfiguration {
        config := models.MachineConfiguration{
-               CPUTemplate: models.CPUTemplate(cfg.CPUTemplate),
-               VcpuCount:   firecracker.Int64(defaultCPUCount),
-               MemSizeMib:  firecracker.Int64(defaultMemSizeMb),
-               HtEnabled:   firecracker.Bool(cfg.HtEnabled),
+               VcpuCount:  firecracker.Int64(defaultCPUCount),
+               MemSizeMib: firecracker.Int64(defaultMemSizeMb),
+               HtEnabled:  firecracker.Bool(cfg.HtEnabled),
        }
 
        if req == nil {
                return config
        }
 
-       if name := req.CPUTemplate; name != "" {
-               config.CPUTemplate = models.CPUTemplate(name)
-       }
-

This makes me wonder given non-Intel template isn't supported at the moment, will it be useful to provide an option in the config to enable/disable the CpuTemplate (maybe something called disable_cpu_template default to false), so that firecracker-containerd can run on AMD/Arm.

@kzys kzys self-assigned this Aug 4, 2021
@kzys
Copy link
Contributor

kzys commented Aug 4, 2021

Let me take a look. I'm doing #531 for ARM, but I need to detect AMD as well...

kzys added a commit to kzys/firecracker-containerd that referenced this issue Aug 4, 2021
It doesn't work AMD's x86_64 processors sadly.

Fixes firecracker-microvm#525.

Signed-off-by: Kazuyoshi Kato <[email protected]>
kzys added a commit to kzys/firecracker-containerd that referenced this issue Aug 4, 2021
It doesn't work AMD's x86_64 processors sadly.

Fixes firecracker-microvm#525.

Signed-off-by: Kazuyoshi Kato <[email protected]>
kzys added a commit to kzys/firecracker-containerd that referenced this issue Aug 4, 2021
It doesn't work AMD's x86_64 processors sadly.

Fixes firecracker-microvm#525.

Signed-off-by: Kazuyoshi Kato <[email protected]>
@kzys kzys closed this as completed in ee9e78b Aug 4, 2021
@jingkaihe
Copy link
Contributor Author

Working perfectly, thanks!

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

No branches or pull requests

2 participants