Run qemu-KVM on the Jetson Nano with the PREEMPT-RT patches


I have applied the PREEMPT-RT patches on my jetson nano. When I run ‘uname -a’, the result is:
Linux jetbot 4.9.201-rt134-tegra #3 SMP PREEMPT RT Wed Nov 30 02:05:35 PST 2022 aarch64 aarch64 aarch64 GNU/Linux

But the problem is, I am not able to boot my VMs as I receive the following error messages when running them with qemu+KVM:

kernel BUG at arch/arm64/kvm/…/…/…/arch/arm/kvm/arm.c:83!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
Modules linked in: vhost_net vhost macvtap macvlan xt_CHECKSUM iptable_mangle zram ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_filter ip6_tables iptable_filter overlay cfg80211 bnep binfmt_misc btusb spidev btbcm btintel btrtl nvgpu bluedroid_pm ip_tables x_tables

Do you have any idea what’s going on?

We don’t have experience about setting up this use-case. Would need other users to check and share suggestion.

I have no way to comment further, but from what I can see that point is hit because coding for KVM itself was not yet complete. By this I mean that the line of code says to only run atomic, and not be preemptable during run of that block of code, but it is still preemptable. This is the block of code:

  77 /**
  78  * kvm_arm_get_running_vcpu - get the vcpu running on the current CPU.
  79  * Must be called from non-preemptible context
  80  */
  81 struct kvm_vcpu *kvm_arm_get_running_vcpu(void)
  82 {
  83         BUG_ON(preemptible());
  84         return __this_cpu_read(kvm_arm_running_vcpu);
  85 }

Here’s the Google search for threads talking about this (it isn’t specific to a Jetson, it’s just KVM in general):

If I remove the BUG(preemptible()) check in KVM (which I have read is redundant), I can init my virtual machines without any problem!
Thank you so much for your help.

Do beware though that the BUG code is there for a reason. It is possible without this to have a fatal exception in the kernel.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.