QEMU warning about performance

  • Done
  • quality assurance status badge
Details
2 participants
  • Leo Famulari
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Leo Famulari
Severity
normal
L
L
Leo Famulari wrote on 18 Mar 2021 07:25
(address . bug-guix@gnu.org)
YFLyVjT+hOYHvMS2@jasmine.lan
While using `guix system vm`, I noticed this warning. I think it's new,
maybe from the 5.2.0 update?

------
qemu-system-x86_64: warning: 9p: degraded performance: a reasonable high msize should be chosen on client/guest side (chosen msize is <= 8192). See https://wiki.qemu.org/Documentation/9psetup#msizefor details.
------

That web page suggests that we increase the virtio packet size when
declaring the 9p file-systems, I think in %linux-vm-file-systems of (gnu
system vm).
L
L
Leo Famulari wrote on 6 Apr 2021 21:45
(no subject)
(address . control@debbugs.gnu.org)
YGy6Yp2cwCqk6PKw@jasmine.lan
block 47297 with 47225
M
M
Maxim Cournoyer wrote on 6 Apr 2021 23:42
Re: bug#47225: QEMU warning about performance
(name . Leo Famulari)(address . leo@famulari.name)(address . 47225@debbugs.gnu.org)
87zgybnl8o.fsf@gmail.com
Hi Leo,

Leo Famulari <leo@famulari.name> writes:

Toggle quote (14 lines)
> While using `guix system vm`, I noticed this warning. I think it's new,
> maybe from the 5.2.0 update?
>
> ------
> qemu-system-x86_64: warning: 9p: degraded performance: a reasonable
> high msize should be chosen on client/guest side (chosen msize is <=
> 8192). See https://wiki.qemu.org/Documentation/9psetup#msize for
> details.
> ------
>
> That web page suggests that we increase the virtio packet size when
> declaring the 9p file-systems, I think in %linux-vm-file-systems of (gnu
> system vm).

The attached patch should fix it (it does for me at least!).
From c720e68229322e5c38c0321b021e8d6430636111 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Tue, 6 Apr 2021 17:37:33 -0400
Subject: [PATCH] system: vm: Set a larger value for the msize option of the 9p
file system.


* gnu/system/vm.scm (mapping->file-system): Set the msize option to a value of
100 MiB (from the default 8 KiB).

Reported-by: Leo Famulari <leo@famulari.name>
---
gnu/system/vm.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Toggle diff (23 lines)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 3d0935b3af..f9cf39ae42 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -581,7 +581,15 @@ the operating system."
(type "9p")
(flags (if writable? '() '(read-only)))
(options (string-append "trans=virtio"
- (if writable? "" ",cache=loose")))
+ (if writable? "" ",cache=loose")
+ ;; By default, the msize value is 8 KiB, which
+ ;; according to QEMU is insufficient and would
+ ;; degrade performance. The msize value should
+ ;; roughly match the bandwidth of the system's
+ ;; IO (see:
+ ;; https://wiki.qemu.org/Documentation/9psetup#msize).
+ ;; Use 100 MiB as a conservative default.
+ ",msize=104857600"))
(check? #f)
(create-mount-point? #t)))))
--
2.31.1
Thank you for the report,

Maxim
L
L
Leo Famulari wrote on 7 Apr 2021 00:15
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 47225@debbugs.gnu.org)
YGzdd2ey7wbrzN+h@jasmine.lan
On Tue, Apr 06, 2021 at 05:42:15PM -0400, Maxim Cournoyer wrote:
Toggle quote (13 lines)
> From c720e68229322e5c38c0321b021e8d6430636111 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Date: Tue, 6 Apr 2021 17:37:33 -0400
> Subject: [PATCH] system: vm: Set a larger value for the msize option of the 9p
> file system.
>
> Fixes <https://issues.guix.gnu.org/47225>.
>
> * gnu/system/vm.scm (mapping->file-system): Set the msize option to a value of
> 100 MiB (from the default 8 KiB).
>
> Reported-by: Leo Famulari <leo@famulari.name>

Thanks! I'll test and push along with the next kernel update (that's
when I noticed this warning). Feel free to push sooner if you like.
M
M
Maxim Cournoyer wrote on 7 Apr 2021 02:42
(name . Leo Famulari)(address . leo@famulari.name)(address . 47225@debbugs.gnu.org)
87v98zncw1.fsf@gmail.com
Hi Leo!

Leo Famulari <leo@famulari.name> writes:

Toggle quote (17 lines)
> On Tue, Apr 06, 2021 at 05:42:15PM -0400, Maxim Cournoyer wrote:
>> From c720e68229322e5c38c0321b021e8d6430636111 Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>> Date: Tue, 6 Apr 2021 17:37:33 -0400
>> Subject: [PATCH] system: vm: Set a larger value for the msize option of the 9p
>> file system.
>>
>> Fixes <https://issues.guix.gnu.org/47225>.
>>
>> * gnu/system/vm.scm (mapping->file-system): Set the msize option to a value of
>> 100 MiB (from the default 8 KiB).
>>
>> Reported-by: Leo Famulari <leo@famulari.name>
>
> Thanks! I'll test and push along with the next kernel update (that's
> when I noticed this warning). Feel free to push sooner if you like.

I hope I'm timely; I've made a revised version of the patch, that should
cover more cases (and actually uses 100 MiB rather than 1 MiB :-)).

Thank you,
From eb600c4ffbc8016709db9471f9dc0be1d60167a7 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Tue, 6 Apr 2021 17:37:33 -0400
Subject: [PATCH] system: vm: Set a larger value for the msize option of the 9p
file system.


* gnu/system/vm.scm (%default-msize-value): New variable.
(%linux-vm-file-systems): Use it as the value of the msize option.
(mapping->file-system): Likewise.

Reported-by: Leo Famulari <leo@famulari.name>
---
gnu/system/vm.scm | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

Toggle diff (57 lines)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 3d0935b3af..1efae7ff06 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -88,6 +88,13 @@
;;;
;;; Code:
+;; By default, the msize value is 8 KiB, which according to QEMU is
+;; insufficient and would degrade performance. The msize value should roughly
+;; match the bandwidth of the system's IO (see:
+;; https://wiki.qemu.org/Documentation/9psetup#msize). Use 100 MiB as a
+;; conservative default.
+(define %default-msize-value (* 100 (expt 2 20))) ;100 MiB
+
(define %linux-vm-file-systems
;; File systems mounted for 'derivation-in-linux-vm'. These are shared with
;; the host over 9p.
@@ -103,21 +110,23 @@
(type "9p")
(needed-for-boot? #t)
(flags '(read-only))
- (options "trans=virtio,cache=loose")
+ (options (format #f "trans=virtio,cache=loose,msize=~a"
+ %default-msize-value))
(check? #f))
(file-system
(mount-point "/xchg")
(device "xchg")
(type "9p")
(needed-for-boot? #t)
- (options "trans=virtio")
+ (options (format #f "trans=virtio,msize=~a" %default-msize-value))
(check? #f))
(file-system
(mount-point "/tmp")
(device "tmp")
(type "9p")
(needed-for-boot? #t)
- (options "trans=virtio,cache=loose")
+ (options (format #f "trans=virtio,cache=loose,msize=~a"
+ %default-msize-value))
(check? #f))))
(define not-config?
@@ -581,7 +590,8 @@ the operating system."
(type "9p")
(flags (if writable? '() '(read-only)))
(options (string-append "trans=virtio"
- (if writable? "" ",cache=loose")))
+ (if writable? "" ",cache=loose")
+ ",msize=" (number->string %default-msize-value)))
(check? #f)
(create-mount-point? #t)))))
--
2.31.1
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJ9WGpPiQCFQyn/CfEmDkZILmNWIFAmBs//8ACgkQEmDkZILm
NWJu3Q/+OpFYmW1U9vZFwWtEJKh6YAeHF1hBfMkqggTl3ca/FzvDt6NtwHRUwBHK
i7jeY358nyi0ti0zP0zT1btYXXNj5AnjcRpg1LnttOPAaH2bIucjlP1oLYprxRSx
TeZ6Keinp/kpZlrPqANN0bnEu++Y+MvYLDxzyjmeSeTwVENC4siQXvirne0s4uAL
H9+EdvVK7ph5hAhb03aWXeGdYeNsDnuGLNaEzVnXFKec7o10hX1OfM4u8zPRMqZ+
fM+aQrUvrNiI72QIKo5knI19IVRkM3L6MQRUOCH8Hhs2tFH3pp479YQu8AusGGUF
wdcNtG5rPGhEwK2qVvmdKUxoiLFepEgnsEnyK7NHCTsb0+xafuOV95xjQK+95I5S
hLrV9JG8NMo3LBIh+XGbGy4WjX4Qs/EXMpbLdEWzwkfb8l6rykMA4BHSj/avi9NH
xf94V/NUqfZvyJgrP2PvNd6x08BPUgrZpws8Mxj4LCNk96+Nuah/QeVlIwd4D/tW
MiFGX4IJ9qYnOKqV16Dr0oEhXx+8empMyuwKr216dJ76WGyrO+8zwxpgURUdhXjP
g9XixEWMlfzB0mc34Mpwwo2pAX1BdhqCQT7nj3Mt1uk0Qoi0xHvm/3f5p836b7nL
nXzn6/oaBM2NSvJtBI/GApatLgGv7lcBIn6dUBxja38vkZhcx3M=
=xKC5
-----END PGP SIGNATURE-----

L
L
Leo Famulari wrote on 7 Apr 2021 19:46
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 47225@debbugs.gnu.org)
YG3v7y5euYkA10Wz@jasmine.lan
On Tue, Apr 06, 2021 at 08:42:38PM -0400, Maxim Cournoyer wrote:
Toggle quote (3 lines)
> I hope I'm timely; I've made a revised version of the patch, that should
> cover more cases (and actually uses 100 MiB rather than 1 MiB :-)).

Yes, you're in time :) Thanks for the revised patch.
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAmBt7+4ACgkQJkb6MLrK
fwgYVw//dWh7ARURbKY0S4K24lJcY3lZ4xuJM7ZSJu50ZmVq6Xt5rhSURClduPQe
B7Q1cQwnmJ7sZamY1BfTIVz4z04bTkudJXqXK6MIFFsz1YlhHKqgaLsIEMk5+i6Y
u7104v+0BmVjUg2l1SgC6aqsudb/BB4bRoCVGR4DBOG+Zhv5PdbN1dXzWefaysNi
l/SEJUpNFsBilHb2dbW/YZrewelfKrw0q03SD6H6uRodzALIeMbDgMO/+xQf+AZ0
EpW9at+KWIvYoVJ+2lKaTCaKk2NZt+hCaWTOys64xlGZBxW/mdgoEYuqOMdwTaGI
VGKYaJdiUosnYtXTD7+CPVQHjPvzZ5tj6OcLkMY/DsSYYPZ8LKBzBxHjS5Z/0YOW
2f15LLzh51t3whnzCV42MlWoCrLwmZiyKmmt+i3X/P5TV0dg5CEZjOexuz1fbK0c
VqRT0GQw2iEni4pLCnbj5KC4vqB+0PKEDBhmNxCZujY4mtlAHLueKApAi/R39S0H
tnc/biVkf9g4NCytHJNGLN56OVK03v7wPUl38xr2bPVUIs+pV49CFxiIjmJTaG9P
TtYeZWbV3bWCJiA8VpWUz3MpUwRhDsXyzd1inOxIFC/px3da8ljES8gfMWzWzna2
diDLGLNMEuWS8oI1E2jHP6gcNnNq50xG5rOhX+boJpWWQ6Hk8t4=
=zGWY
-----END PGP SIGNATURE-----


L
L
Leo Famulari wrote on 8 Apr 2021 21:17
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 47225-done@debbugs.gnu.org)
YG9W41of3m0DysgM@jasmine.lan
On Tue, Apr 06, 2021 at 08:42:38PM -0400, Maxim Cournoyer wrote:
Toggle quote (20 lines)
> I hope I'm timely; I've made a revised version of the patch, that should
> cover more cases (and actually uses 100 MiB rather than 1 MiB :-)).
>
> Thank you,
>

> From eb600c4ffbc8016709db9471f9dc0be1d60167a7 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
> Date: Tue, 6 Apr 2021 17:37:33 -0400
> Subject: [PATCH] system: vm: Set a larger value for the msize option of the 9p
> file system.
>
> Fixes <https://issues.guix.gnu.org/47225>.
>
> * gnu/system/vm.scm (%default-msize-value): New variable.
> (%linux-vm-file-systems): Use it as the value of the msize option.
> (mapping->file-system): Likewise.
>
> Reported-by: Leo Famulari <leo@famulari.name>

Pushed as bdc96f6e0e7fbf502f368d3381297ec0b75216d7

Thanks!
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAmBvVuMACgkQJkb6MLrK
fwgddA//VN5D0B5ceaWsBqRqmnuaiQ+CSRKug8NhO+ecdIJauFdZE5xP/Mur0evd
14rbCkBAnRBNNe0do5PF+EfNCPDmXV372g0Y1ch+O4XPABKSiUBhKQWC6O3zY6x2
P4RQUKmuUDWhfIfhbcxYQZxjPBy2DhyIpFEG8CK96Wkdw+XoNs9pG2NBA9fHxukY
UGwPQR4NVMOjLIJ/qEacleTk4qaqSgNmgWaz80zKg56HOZbD/GwkRgGS7Pf+5IMf
gPLjuTnN8miJOxuljV1i+gCxz+aNEuf6Ltr3HP9NQ6YUUm4hmyn8U8QAJiM+bDMF
ZKWJhdlUmdfK/eg16SL8j3jxORrgdxZqBvfgPDfkiG9WyuRizR989BxblOdThvjV
qopCDXHm58ck4FFD3hMpSYOh6zGI0cQT2Hhy9zBaVxFDhwljM+CFUByQe/DFuM7z
iZYGuMp85mtqf6UgErO5FoxEZ6FNtLnDxJSrd42v5ieb64cpvLGhzmPjKWCKsRGF
JGIFSoJ09PUbi1p1HVbhTOH7TXQP2b2K5/HwRV/agtEWatGcgdIGydaLQrImLIKc
Cg8adS11LJczblDRqYO80hFnGe8K11MQmoD7YUtjlUS63tHDcNSILtKGJablYJXw
MGxisVk9i1zuUnsNpww6Dto+D/6wMv3e24ZJ9CBrv7kRUfMLvAw=
=ueau
-----END PGP SIGNATURE-----


Closed
?