NetBSD Problem Report #56616

From www@netbsd.org  Tue Jan 11 16:34:41 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 9DD9E1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 11 Jan 2022 16:34:41 +0000 (UTC)
Message-Id: <20220111163440.1532D1A923A@mollari.NetBSD.org>
Date: Tue, 11 Jan 2022 16:34:40 +0000 (UTC)
From: marietto2008@gmail.com
Reply-To: marietto2008@gmail.com
To: gnats-bugs@NetBSD.org
Subject: qemu-system-x86_64: NVMM: Mem Assist Failed [gpa=0xfffff000] ; qemu-system-x86_64: NVMM: Failed to execute a VCPU.
X-Send-Pr-Version: www-1.0

>Number:         56616
>Category:       port-amd64
>Synopsis:       qemu-system-x86_64: NVMM: Mem Assist Failed [gpa=0xfffff000] ; qemu-system-x86_64: NVMM: Failed to execute a VCPU.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 11 16:35:00 +0000 2022
>Originator:     mario zio
>Release:        9.2
>Organization:
as hobby
>Environment:
NetBSD localhost 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
I've installed NetBSD 9.2 to try if and how qemu+nvmm worked together. So,I've launched a VM with the commands below :

qemu-system-x86_64 \
-machine type=q35,accel=nvmm \
-smp cpus=1 -m 8G \
-drive if=pflash,format=raw,file=/usr/pkg/share/qemu/edk2-x86_64-code.fd \
-drive file=/mnt/WD2500BMV/impish-cuda-11-4-nvidia-470.img,if=none,id=disk0 \
-device virtio-blk-pci,drive=disk0 \
-netdev user,id=net0,hostfwd=tcp:127.0.0.1:6022-:22 \
-device virtio-net-pci,netdev=net0 \
-object rng-random,id=rng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=rng0 \
-display curses \
-vga qxl \
-spice addr=127.0.0.1,port=5900,ipv4=on,disable-ticketing=on,seamless-migration=on

and I've got this error : 

qemu-system-x86_64: NVMM: Mem Assist Failed [gpa=0xfffff000]
qemu-system-x86_64: NVMM: Failed to execute a VCPU.

I found this bug on the DFLY and then I've tried even with NetBSD and I've also found it even there. Maybe because they have the same issue, because we have almost the same NVMM and Qemu code.

Aaron Li created a bug to track the issue:

https://bugs.dragonflybsd.org/issues/3310

In addition, he figured out a patch to make UEFI boot, but itís extremely slow, which needs further investigation.
>How-To-Repeat:
simply execute this vm on your hardware :

qemu-system-x86_64 \
-machine type=q35,accel=nvmm \
-smp cpus=1 -m 8G \
-drive if=pflash,format=raw,file=/usr/pkg/share/qemu/edk2-x86_64-code.fd \
-drive file=/mnt/WD2500BMV/impish-cuda-11-4-nvidia-470.img,if=none,id=disk0 \
-device virtio-blk-pci,drive=disk0 \
-netdev user,id=net0,hostfwd=tcp:127.0.0.1:6022-:22 \
-device virtio-net-pci,netdev=net0 \
-object rng-random,id=rng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=rng0 \
-display curses \
-vga qxl \
-spice addr=127.0.0.1,port=5900,ipv4=on,disable-ticketing=on,seamless-migration=on
>Fix:
A temporary workaround is to use -bios /path/to/UEFI_CODE.fd with qemu, and it works. But this way of specifying UEFI firmware is a workaround and doesnít support persistent UEFI variables and with the patch created NVMM+QEMU is extremely slow and uses 100% CPU. It's even much slower than
TCG (i.e., without -accel nvmm).

For example: for QEMU to boot into the UEFI shell on my desktop, it takes ~12 seconds with TCG, but it takes ~170 seconds with NVMM !

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.