Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Support ARM64 hosts without GIC #848

Closed
srcman opened this issue Oct 19, 2018 · 11 comments
Closed

Support ARM64 hosts without GIC #848

srcman opened this issue Oct 19, 2018 · 11 comments

Comments

@srcman
Copy link

srcman commented Oct 19, 2018

Description of problem

Apparently Raspberry Pi 3 (arm64) doesn't have a GIC, so getHostGICVersion() in qemu_arm64.go can't find the GIC version in /proc/interrupts, and giving the gic-version=host machine option to QEMU (which is the current fallback) results in an error in this case.

Not giving the gic-version option to QEMU at all if the host doesn’t have a GIC seems to fix this problem. (The kernel_irqchip=off option could be given instead, in order to explicitly request irqchip emulation in user space, but actually that doesn’t seem to be required here.)

Expected result

VM for Kata container started successfully on, e.g., a 64-bit RPi 3 with KVM

Actual result

QEMU: "Unable to determine GIC version supported by host” (since creating a VGIC device in QEMU fails)

@jodh-intel
Copy link
Contributor

/cc @Pennyzct, @Weichen81.

@Weichen81
Copy link
Contributor

The first time when I saw the issue, I got shocked. There are having some SoCs really don't support GIC. Then I checked the RPI code, https://github.com/torvalds/linux/blob/bebc6082da0a9f5d47a1ea2edc099bf671058bd4/arch/arm/boot/dts/bcm2837.dtsi#L12.
I found it's real. RPI is using bcm2836-l1-intc as interrupt controller. I think I can send a PR to fix it.
But what I concern is that, if we use an irqchip emulation in user space, the performance should be not good. So, I think should we need to define a minimal hardware requirement for kata-containers?

@grahamwhaley
Copy link
Contributor

I think I agree - we should have the GIC case as the working default, as generally Kata is a server type thing, and you'd expect all servers to have GICs?
What we probably do want to do then is detail how to make Kata work with a GIC-less chip - detail if that needs a new kernel config/build and/or add any QEMU config options in that can be set in the kata config maybe?

@jodh-intel
Copy link
Contributor

It would be rather awesome to have kata running on a Pi. Either way, the logic to specify the minimum hardware spec should be part of the kata-check command so users can run that and it will tell them clearly whether their hardware is supported (and if not, it should explain why):

@srcman
Copy link
Author

srcman commented Oct 23, 2018

Thanks for considering GIC-less support. I guess the main purpose for running Kata Containers on a Raspberry Pi would be just experimenting, not any very serious use.

Actually leaving out the GIC parameter seemed to be pretty much the only code-level issue that needed to be addressed in order to create and start Kata instances on a 64-bit RPi 3 B+ host (that has Raspbian's 4.14.70 arm64 Linux kernel with KVM enabled, Debian Buster's base system etc., and QEMU 2.12). In this case I simply used Kata's default guest kernel config for arm64, as well as an Alpine-based initrd guest image, and launched containers through cri-containerd. Didn't do any more thorough testing so far, though.

@Weichen81
Copy link
Contributor

@srcman Don't worry, I am willing to send a PR to fix this issue. Doesn't like x86, most of Arm developers don't have real Arm servers like x86-based PC. So various kinds of PI are their debug platforms. I certainly wouldn't refuse to pay a small price for so many potential developers or users : )
Your issue just reminds us we may have ignored some points in hardware check.

@jodh-intel @grahamwhaley Maybe we can rate the kata-check to levels:
Recommend hardware requirements (All hardware virtualization accelerate technologies are ready, kata-containers can work smoothly)
Runable hardware requirements (One or more hardware features are missed, kata-containers can run, but only can be used for debug, experience)
No-workable(One or more key hardware features are missed, kata-containers can not run)

As we are using QEMU now, it is a full-functionality emulator, even supports binary translation. But for NEMU, I think most of these features, like binary translation and user space irqchip emulator would be removed. And if we support Xen and Kvmtools later, both of them don't support irqchip emulator.
So I think a rating kata-check would be better to notify users in production environment or in debug environment.

@jodh-intel
Copy link
Contributor

@Weichen81 - this sounds like an interesting idea!

By default, running sudo kata-runtime kata-check should always run all checks and fail if any expected/recommended features are missing.

However, if we recall that kata-runtime kata-check is simply an informational command for users (the runtime itself never calls the check code as part of normal operations), it seems reasonable that we could add a --permissive option. If the user specified that, kata-check would switch to checking for the minimum hardware requirements (what you've called "Runable hardware requirements"). That way, the normal flow would be:

  1. Run sudo kata-runtime kata-check.
  2. If this fails and running in a non-developer environment, get new hardware.
  3. If running on a developer / test / low-spec system, run sudo kata-runtime kata-check --permissive.
  4. If that fails, get new developer hardware 😄

/cc @sameo, @egernst, @sboeuf, @gnawux, @bergwolf, @grahamwhaley.

@sboeuf
Copy link

sboeuf commented Oct 24, 2018

@jodh-intel
--permissive sounds good to me.

@srcman
Copy link
Author

srcman commented Jun 24, 2019

As a side note regarding Kata on RPis, the newly released Raspberry Pi 4 actually seems to have a GIC (v2), if I read their bcm2711.dtsi and bcm2838.dtsi files for Linux 4.19 correctly.

@grahamwhaley
Copy link
Contributor

Nice @srcman - yeah, saw there was a new Pi :-) /cc @Pennyzct

@Pennyzct
Copy link
Contributor

Pennyzct commented Jun 25, 2019

Hi~@srcman really excited to see people running kata containers on Pi. Pi 4 is really a new generation, having cortex-A72 core.
If you want to check what gic version you have, another way is that: cat /proc/interrupts | grep -i 'gic'
BTW, since we have supported vNVDIMM, your host kernel must be v4.20+, since v5.0/v5.1 is the closest stable version, I'm highly recommend you to use v5.0/v5.1. ;)
If you have found any bug, just ping me, happy to help. o(////▽////)q

egernst pushed a commit to egernst/runtime that referenced this issue Feb 9, 2021
This function watches for uvents that match addresses stored in
s.deviceWatchers() and if there's a matching entry signals the associated
channel.

"Matching" in this instance means soem sort of comparison between the
address we're watching for and the sysfs path in the uevent.  Currently we
match any of a bunch of different cases for different types of device.
Being very specific with how we match *sounds* like a good idea, but it's
complicated, tightly coupled to other parts of the code and, ultimately,
pointless.

The user of the data we're collecting here is getDeviceName().  Before
registering a watcher it checks s.sysToDevMap in case the uevent it's
interested in has already happened.

To have consistent behaviour regardless of when the uevent arrives,
the matching that getDeviceName() uses against s.sysToDevMap must be
the same as we use in listenToUdevEvents() and right now, it's not.
So, change the matching in listenToUdevEvents() to be the same as the
much simpler version in getDeviceName().

fixes kata-containers#848

Signed-off-by: David Gibson <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants