On Wed, Jun 18, 2025 at 12:50 PM Heinrich Schuchardt <
[email protected]> wrote:

> If I run the dual core inner VM via `taskset 0x03 qemu-system-riscv64
> ...`, the amd64 cores are released while the inner VM idles. But once
> the inner VM is stopped the amd64 CPU consumption sticks at 2 CPUs.
>
> `mpstat -P ALL` provides this output
> (https://paste.ubuntu.com/p/5ZDbDqJ86g/):
>
>
>     07:38:56 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft
> %steal  %guest  %gnice   %idle
>     07:38:56 PM  all    1.66    0.00    2.11    0.04    0.00    0.01
> 0.00    3.53    0.00   92.66
>     07:38:56 PM    0    1.99    0.00    5.88    0.04    0.00    0.01
> 0.00   28.11    0.00   63.98
>     07:38:56 PM    1    6.10    0.00   10.23    0.10    0.00    0.05
> 0.00   28.60    0.00   54.93
>     07:38:56 PM    2    0.89    0.00    1.63    0.01    0.00    0.01
> 0.00    0.00    0.00   97.46
>     07:38:56 PM    3    1.60    0.00    1.40    0.01    0.00    0.01
> 0.00    0.00    0.00   96.98
>     07:38:56 PM    4    0.94    0.01    1.13    0.07    0.00    0.02
> 0.00    0.00    0.00   97.82
>     07:38:56 PM    5    1.17    0.00    0.88    0.05    0.00    0.01
> 0.00    0.00    0.00   97.89
>     07:38:56 PM    6    0.82    0.00    1.04    0.01    0.00    0.01
> 0.00    0.00    0.00   98.12
>     07:38:56 PM    7    0.90    0.00    0.80    0.02    0.00    0.01
> 0.00    0.00    0.00   98.27
>     07:38:56 PM    8    2.50    0.00    1.28    0.03    0.00    0.01
> 0.00    0.00    0.00   96.18
>     07:38:56 PM    9    1.21    0.00    2.25    0.01    0.00    0.01
> 0.00    0.00    0.00   96.52
>     07:38:56 PM   10    0.90    0.00    0.90    0.01    0.00    0.01
> 0.00    0.00    0.00   98.19
>     07:38:56 PM   11    2.06    0.00    1.66    0.18    0.00    0.01
> 0.00    0.00    0.00   96.09
>     07:38:56 PM   12    1.06    0.00    0.98    0.01    0.00    0.01
> 0.00    0.00    0.00   97.94
>     07:38:56 PM   13    0.98    0.00    1.48    0.02    0.00    0.01
> 0.00    0.00    0.00   97.51
>     07:38:56 PM   14    1.81    0.00    1.01    0.02    0.00    0.01
> 0.00    0.00    0.00   97.14
>     07:38:56 PM   15    1.57    0.00    1.25    0.02    0.00    0.02
> 0.00    0.00    0.00   97.14
>
> Column %guest shows the percentage of time spent by the CPUs to run a
> virtual processor.
>
> Though the inner VM is stopped the VCPUs don't idle completely.
>
> Idling is implemented via the `wfi` opcode. Could it be that the cores
> assigned to VCPUs still receive abundant interrupts?
>
>
Yeah quite possible. Initially I thought it was a qemu tcg bug so I went
down the rabit hole and got distracted with the icount thing.
I am looking at KVM vcpu timer code first to see if it is constantly firing
timer interrupts for some reason.


> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2112578
>
> Title:
>   riscv64: KVM does not release harts
>
> Status in linux package in Ubuntu:
>   New
> Status in qemu package in Ubuntu:
>   Invalid
>
> Bug description:
>   In the 6.14.0-13-generic kernel there seems to be a problem with KVM.
>
>   On my amd64 machine I am running a riscv64 machine using QEMU 10 with
>   16 cores. Inside the VM I spin up a further machine with 2 cores. Once
>   KVM emulation is started the load of my amd64 machine rises to > 14/16
>   cores for qemu-system-riscv64. KVM seems not to release cores that
>   were ever used. Top in 1st VM shows 0.25 cores used for 2nd VM.
>
>   The usage on my amd64 machine only drops when unloading the kvm module
> in the first VM.
>   ---
>   ProblemType: Bug
>   ApportVersion: 2.32.0-0ubuntu5
>   Architecture: riscv64
>   AudioDevicesInUse:
>    USER        PID ACCESS COMMAND
>    /dev/snd/controlC0:  zfsdt      2105 F.... wireplumber
>    /dev/snd/seq:        zfsdt      2103 F.... pipewire
>   CasperMD5json:
>    {
>      "result": "skip"
>    }
>   CurrentDesktop: XFCE
>   DistroRelease: Ubuntu 25.10
>   InstallationDate: Installed on 2025-03-17 (80 days ago)
>   InstallationMedia: Ubuntu-Server 25.04 "Plucky Puffin" - Daily riscv64
> (20250316)
>   Lsusb:
>    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>    Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd QEMU Tablet
>    Bus 001 Device 003: ID 0627:0001 Adomax Technology Co., Ltd QEMU Tablet
>    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
>   MachineType: QEMU QEMU Virtual Machine
>   Package: linux (not installed)
>   ProcEnviron:
>    LANG=en_US.UTF-8
>    PATH=(custom, no user)
>    SHELL=/bin/bash
>    TERM=xterm-256color
>   ProcFB: 0 virtio_gpudrmfb
>   ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-6.14.0-13-generic
> root=UUID=af336ba2-ea81-4dd5-bada-b3e8e7fb1c58 ro
> crashkernel=2G-4G:320M,4G-32G:512M,32G-64G:1024M,64G-128G:2048M,128G-:4096M
>   ProcVersionSignature: Ubuntu 6.14.0-13.13.2-generic 6.14.0
>   PulseList: Error: command ['pacmd', 'list'] failed with exit code 1: No
> PulseAudio daemon running, or not running as session daemon.
>   RelatedPackageVersions:
>    linux-restricted-modules-6.14.0-13-generic N/A
>    linux-backports-modules-6.14.0-13-generic  N/A
>    linux-firmware                             20250317.git1d4c88ee-0ubuntu1
>   RfKill:
>
>   Tags: questing
>   Uname: Linux 6.14.0-13-generic riscv64
>   UpgradeStatus: Upgraded to questing on 2025-05-17 (19 days ago)
>   UserGroups: N/A
>   _MarkForUpload: True
>   acpidump:
>
>   dmi.bios.date: 05/13/2025
>   dmi.bios.release: 0.0
>   dmi.bios.vendor: Ubuntu distribution of EDK II
>   dmi.bios.version: 2025.02-8
>   dmi.chassis.type: 1
>   dmi.chassis.vendor: QEMU
>   dmi.chassis.version: virt
>   dmi.modalias:
> dmi:bvnUbuntudistributionofEDKII:bvr2025.02-8:bd05/13/2025:br0.0:svnQEMU:pnQEMUVirtualMachine:pvrvirt:cvnQEMU:ct1:cvrvirt:sku:
>   dmi.product.name: QEMU Virtual Machine
>   dmi.product.version: virt
>   dmi.sys.vendor: QEMU
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2112578/+subscriptions
>
>

-- 
Regards,
Atish

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2112578

Title:
  riscv64: KVM does not release harts

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2112578/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to