Running Windows in QEMU with LVM causes very slow disk acess

I have the problem, that whenever I try to run Windows within QEMU, it seems that disk access is becomming very slow after a short while. Surprisingly both access to the disk from within the VM as well as outside of the VM seems to become slow.

I have both my home and my QEMU windows drive on the same disk (this is a laptop, so I cannot use multiple disks), but on different LVM volumes (no qcow or anything, just the raw LV). Just after few minutes, windows becomes unusably slow, and the host also becomes slow. As soon as I disable the VM, the host becomes usable again. I have traced back the problem in windows to slow disk access using the resource monitor. But the problem seems to be in on the LVM side of the host. If I run iostat -xz I get the following:

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          17,36   10,14    5,41   38,51    0,00   28,58

Device            r/s     rkB/s   rrqm/s  %rrqm r_await rareq-sz     w/s     wkB/s   wrqm/s  %wrqm w_await wareq-sz     d/s     dkB/s   drqm/s  %drqm d_await dareq-sz  aqu-sz  %util
dm-0             7,63     82,81     0,00   0,00   84,37    10,85   22,74    209,61     0,00   0,00  121,53     9,22    0,00      0,00     0,00   0,00    0,00     0,00    3,41   3,32
dm-1             0,05      0,27     0,00   0,00    5,05     5,49    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00   0,00
dm-2             0,00      0,09     0,00   0,00    6,10    21,75    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00   0,00
dm-3             2,28      9,12     0,00   0,00   21,28     4,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,05   0,53
dm-4             0,02      0,09     0,00   0,00    4,95     4,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00   0,00
dm-5             0,00      0,00     0,00   0,00   31,64     4,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00   0,00
dm-6             0,02      0,09     0,00   0,00    4,94     4,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00   0,00
dm-7             0,00      0,09     0,00   0,00    6,85    21,75    0,00      0,00     0,00   0,00    0,00     0,00    0,00      0,00     0,00   0,00    0,00     0,00    0,00   0,00
dm-8            36,13   1454,39     0,00   0,00   46,74    40,25  528,37   2107,50     0,00   0,00  122,58     3,99    0,00      0,00     0,00   0,00    0,00     0,00   66,46  12,66
dm-9             7,63     82,77     0,00   0,00   84,49    10,85   22,74    213,86     0,00   0,00 1578,74     9,40    0,00      0,00     0,00   0,00    0,00     0,00   36,55   3,18
nvme0n1          4,49    176,13     5,82  56,45    0,19    39,26  101,54    445,00     0,07   0,07    0,95     4,38    0,00      0,00     0,00   0,00    0,00     0,00    0,07   0,38
sda             41,89   1547,29     4,19   9,10   46,21    36,93   41,60   2317,08   509,51  92,45  158,29    55,70    0,00      0,00     0,00   0,00    0,00     0,00    8,40  15,35

dm-8 is the windows LV and dm-9 is my home drive. So for some reason it seems that data is being queued for both these drives. The write speed isn’t terribly fast while the system is sluggish, somewhere around 1-5MB/s at most, which is very slow for the drive I have in the system.

CPU Usage is very low, while the VM is running (both inside the VM using resource monitor, as well as on the host). Usually, it is only around 10%.

I am using Virtio as a storage adapter and I already tried different configurations (threads, caching etc), but nothing seems to change this problem.

Is there some other configuration that I could try to get a better disk access?

Go to Source
Author: LiKao