unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47225: QEMU warning about performance
@ 2021-03-18  6:25 Leo Famulari
  2021-04-06 21:42 ` Maxim Cournoyer
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Famulari @ 2021-03-18  6:25 UTC (permalink / raw)
  To: 47225

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).




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#47225: QEMU warning about performance
  2021-03-18  6:25 bug#47225: QEMU warning about performance Leo Famulari
@ 2021-04-06 21:42 ` Maxim Cournoyer
  2021-04-06 22:15   ` Leo Famulari
  0 siblings, 1 reply; 6+ messages in thread
From: Maxim Cournoyer @ 2021-04-06 21:42 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 47225

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

Hi Leo,

Leo Famulari <leo@famulari.name> writes:

> 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!).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-system-vm-Set-a-larger-value-for-the-msize-option-of.patch --]
[-- Type: text/x-patch, Size: 1616 bytes --]

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>
---
 gnu/system/vm.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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


[-- Attachment #3: Type: text/plain, Size: 34 bytes --]


Thank you for the report,

Maxim

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#47225: QEMU warning about performance
  2021-04-06 21:42 ` Maxim Cournoyer
@ 2021-04-06 22:15   ` Leo Famulari
  2021-04-07  0:42     ` Maxim Cournoyer
  0 siblings, 1 reply; 6+ messages in thread
From: Leo Famulari @ 2021-04-06 22:15 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 47225

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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#47225: QEMU warning about performance
  2021-04-06 22:15   ` Leo Famulari
@ 2021-04-07  0:42     ` Maxim Cournoyer
  2021-04-07 17:46       ` Leo Famulari
  2021-04-08 19:17       ` Leo Famulari
  0 siblings, 2 replies; 6+ messages in thread
From: Maxim Cournoyer @ 2021-04-07  0:42 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 47225


[-- Attachment #1.1: Type: text/plain, Size: 934 bytes --]

Hi Leo!

Leo Famulari <leo@famulari.name> writes:

> 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,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-system-vm-Set-a-larger-value-for-the-msize-option-of.patch --]
[-- Type: text/x-patch, Size: 2713 bytes --]

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>
---
 gnu/system/vm.scm | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#47225: QEMU warning about performance
  2021-04-07  0:42     ` Maxim Cournoyer
@ 2021-04-07 17:46       ` Leo Famulari
  2021-04-08 19:17       ` Leo Famulari
  1 sibling, 0 replies; 6+ messages in thread
From: Leo Famulari @ 2021-04-07 17:46 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 47225

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

On Tue, Apr 06, 2021 at 08:42:38PM -0400, Maxim Cournoyer wrote:
> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#47225: QEMU warning about performance
  2021-04-07  0:42     ` Maxim Cournoyer
  2021-04-07 17:46       ` Leo Famulari
@ 2021-04-08 19:17       ` Leo Famulari
  1 sibling, 0 replies; 6+ messages in thread
From: Leo Famulari @ 2021-04-08 19:17 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 47225-done

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

On Tue, Apr 06, 2021 at 08:42:38PM -0400, Maxim Cournoyer wrote:
> 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!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-08 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-18  6:25 bug#47225: QEMU warning about performance Leo Famulari
2021-04-06 21:42 ` Maxim Cournoyer
2021-04-06 22:15   ` Leo Famulari
2021-04-07  0:42     ` Maxim Cournoyer
2021-04-07 17:46       ` Leo Famulari
2021-04-08 19:17       ` Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).