video: hyperv: hyperv_fb: Support deferred IO for Hyper-V frame buffer driver
Wei Hu
maintainerPATCH v6 1/1 video: hyperv: hyperv_fb: Support deferred IO for Hyper-V frame buffer driver
Without deferred IO support, hyperv_fb driver informs the host to refresh the entire guest frame buffer at fixed rate, e.g. at 20Hz, no matter there is screen update or not. This patch supports deferred IO for screens in graphics mode and also enables the frame buffer on-demand refresh. The highest refresh rate is still set at 20Hz.
Currently Hyper-V only takes a physical address from guest as the starting address of frame buffer. This implies the guest must allocate contiguous physical memory for frame buffer. In addition, Hyper-V Gen 2 VMs only accept address from MMIO region as frame buffer address. Due to these limitations on Hyper-V host, we keep a shadow copy of frame buffer in the guest. This means one more copy of the dirty rectangle inside guest when doing the on-demand refresh. This can be optimized in the future with help from host. For now the host performance gain from deferred IO outweighs the shadow copy impact in the guest.
---
v2: Incorporated review comments from Michael Kelley
- Increased dirty rectangle by one row in deferred IO case when sending to Hyper-V.
- Corrected the dirty rectangle size in the text mode.
- Added more comments.
- Other minor code cleanups.
v3: Incorporated more review comments
- Removed a few unnecessary variable tests
v4: Incorporated test and review feedback from Dexuan Cui
- Not disable interrupt while acquiring docopy_lock in hvfb_update_work(). This avoids significant bootup delay in large vCPU count VMs.
v5: Completely remove the unnecessary docopy_lock after discussing with Dexuan Cui.
v6: Do not request host refresh when the VM guest screen is closed or minimized.
drivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/hyperv_fb.c | 210 ++++++++++++++++++++++++++++---- 2 files changed, 190 insertions(+), 21 deletions(-)
drivers/video/fbdev/Kconfig +1 -0
@@ -2241,6 +2241,7 @@ config FB_HYPERV select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_DEFERRED_IO help This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
drivers/video/fbdev/hyperv_fb.c +189 -21
357 lines not on this page · raw message
Signature · 1 line
2.20.1
Quoted 6 lines
From: Wei Hu <[email protected]>
Sent: Tuesday, September 17, 2019 11:03 PM
[...]
---
v6: Do not request host refresh when the VM guest screen is closed or minimized.
Looks good to me. Thanks!
From: Wei Hu <[email protected]> Sent: Tuesday, September 17, 2019 11:03 PM
Quoted 37 lines
Without deferred IO support,
hyperv_fbdriver informs the host to refresh the entire guest frame buffer at fixed rate, e.g. at 20Hz, no matter there is screen update or not. This patch supports deferred IO for screens in graphics mode and also enables the frame buffer on-demand refresh. The highest refresh rate is still set at 20Hz.Currently Hyper-V only takes a physical address from guest as the starting address of frame buffer. This implies the guest must allocate contiguous physical memory for frame buffer. In addition, Hyper-V Gen 2 VMs only accept address from MMIO region as frame buffer address. Due to these limitations on Hyper-V host, we keep a shadow copy of frame buffer in the guest. This means one more copy of the dirty rectangle inside guest when doing the on-demand refresh. This can be optimized in the future with help from host. For now the host performance gain from deferred IO outweighs the shadow copy impact in the guest.
Signed-off-by Wei Hu <[email protected]>---
v2: Incorporated review comments from Michael Kelley
- Increased dirty rectangle by one row in deferred IO case when sending to Hyper-V.
- Corrected the dirty rectangle size in the text mode.
- Added more comments.
- Other minor code cleanups.v3: Incorporated more review comments
- Removed a few unnecessary variable testsv4: Incorporated test and review feedback from Dexuan Cui
- Not disable interrupt while acquiringdocopy_lockinhvfb_update_work(). This avoids significant bootup delay in large vCPU count VMs.v5: Completely remove the unnecessary
docopy_lockafter discussing with Dexuan Cui.
Quoted 7 lines
v6: Do not request host refresh when the VM guest screen is closed or minimized.
drivers/video/fbdev/Kconfig | 1 + drivers/video/fbdev/hyperv_fb.c | 210 ++++++++++++++++++++++++++++---- 2 files changed, 190 insertions(+), 21 deletions(-)
From: Michael Kelley <[email protected]> Sent: Wednesday, September 18, 2019 2:48 PM
Quoted 17 lines
Quoted 17 lines
Without deferred IO support,
hyperv_fbdriver informs the host to refresh the entire guest frame buffer at fixed rate, e.g. at 20Hz, no matter there is screen update or not. This patch supports deferred IO for screens in graphics mode and also enables the frame buffer on-demand refresh. The highest refresh rate is still set at 20Hz.Currently Hyper-V only takes a physical address from guest as the starting address of frame buffer. This implies the guest must allocate contiguous physical memory for frame buffer. In addition, Hyper-V Gen 2 VMs only accept address from MMIO region as frame buffer address. Due to these limitations on Hyper-V host, we keep a shadow copy of frame buffer in the guest. This means one more copy of the dirty rectangle inside guest when doing the on-demand refresh. This can be optimized in the future with help from host. For now the host performance gain from deferred IO outweighs the shadow copy impact in the guest.
Quoted 1 line
Quoted 1 line
Signed-off-by Wei Hu <[email protected]>
Sasha -- this patch and one other from Wei Hu for the Hyper-V frame buffer driver should be ready. Both patches affect only the Hyper-V frame buffer driver so can go through the Hyper-V tree. Can you pick these up? Thx.
Michael
Quoted 18 lines · Michael Kelley
From: Michael Kelley <[email protected]> Sent: Wednesday, September 18, 2019 2:48 PM
Quoted 17 lines
Quoted 17 lines
Without deferred IO support,
hyperv_fbdriver informs the host to refresh the entire guest frame buffer at fixed rate, e.g. at 20Hz, no matter there is screen update or not. This patch supports deferred IO for screens in graphics mode and also enables the frame buffer on-demand refresh. The highest refresh rate is still set at 20Hz.Currently Hyper-V only takes a physical address from guest as the starting address of frame buffer. This implies the guest must allocate contiguous physical memory for frame buffer. In addition, Hyper-V Gen 2 VMs only accept address from MMIO region as frame buffer address. Due to these limitations on Hyper-V host, we keep a shadow copy of frame buffer in the guest. This means one more copy of the dirty rectangle inside guest when doing the on-demand refresh. This can be optimized in the future with help from host. For now the host performance gain from deferred IO outweighs the shadow copy impact in the guest.
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Wei Hu <[email protected]>Sasha -- this patch and one other from Wei Hu for the Hyper-V frame buffer driver should be ready. Both patches affect only the Hyper-V frame buffer driver so can go through the Hyper-V tree. Can you pick these up? Thx.
I can't get this to apply anywhere, what tree is it based on?
--
Thanks,
Sasha
Dexuan Cui
maintainerQuoted 31 lines
-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, October 1, 2019 11:48 AMQuoted 1 line · Michael Kelley
From: Michael Kelley <[email protected]> Sent: Wednesday,
September 18, 2019 2:48 PM
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Without deferred IO support,
hyperv_fbdriver informs the host to refresh the entire guest frame buffer at fixed rate, e.g. at 20Hz, no matter there is screen update or not. This patch supports deferred IO for screens in graphics mode and also enables the frame buffer on-demand refresh. The highest refresh rate is still set at 20Hz.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Currently Hyper-V only takes a physical address from guest as the starting address of frame buffer. This implies the guest must allocate contiguous physical memory for frame buffer. In addition, Hyper-V Gen 2 VMs only accept address from MMIO region as frame buffer address. Due to these limitations on Hyper-V host, we keep a shadow copy of frame buffer in the guest. This means one more copy of the dirty rectangle inside guest when doing the on-demand refresh. This can be optimized in the future with help from host. For now the host performance gain from
deferred
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
IO outweighs the shadow copy impact in the guest.
Signed-off-by Wei Hu <[email protected]>Sasha -- this patch and one other from Wei Hu for the Hyper-V frame buffer driver should be ready. Both patches affect only the Hyper-V frame buffer driver so can go through the Hyper-V tree. Can you pick these up? Thx.
Quoted 5 lines
I can't get this to apply anywhere, what tree is it based on?
--
Thanks,
Sasha
Hi Sasha,
Today's hyperv/linux.git's hyperv-next branch's top commit is
48b72a2697d5 ("hv_netvsc: Add the support of hibernation").Please pick up two patches from Wei Hu:
#1: [PATCH v4] video: hyperv: hyperv_fb: Obtain screen resolution from Hyper-V host #2: [PATHC v6] video: hyperv: hyperv_fb: Support deferred IO for Hyper-V frame buffer driver
I can apply the 2 patches on the hyperv-next branch (the top commit is 48b72a2697d5):
[decui@localhost linux]$ patch -p1 < 1.diff patching file drivers/video/fbdev/hyperv_fb.c Hunk #2 succeeded at 53 (offset 1 line). Hunk #3 succeeded at 95 (offset 1 line). Hunk #4 succeeded at 124 (offset 1 line). Hunk #5 succeeded at 222 (offset 1 line). Hunk #6 succeeded at 262 (offset 2 lines). Hunk #7 succeeded at 394 (offset 2 lines). Hunk #8 succeeded at 441 (offset 2 lines). Hunk #9 succeeded at 480 (offset 2 lines). Hunk #10 succeeded at 558 (offset 2 lines). Hunk #11 succeeded at 590 (offset 2 lines). Hunk #12 succeeded at 785 (offset 2 lines). Hunk #13 succeeded at 823 (offset 2 lines).
[decui@localhost linux]$ patch -p1 < 2.diff patching file drivers/video/fbdev/Kconfig Hunk #1 succeeded at 2214 (offset -27 lines). patching file drivers/video/fbdev/hyperv_fb.c Hunk #1 succeeded at 238 (offset 1 line). Hunk #2 succeeded at 259 (offset 2 lines). Hunk #3 succeeded at 277 (offset 2 lines). Hunk #4 succeeded at 364 (offset 2 lines). Hunk #5 succeeded at 692 (offset 2 lines). Hunk #6 succeeded at 702 (offset 2 lines). Hunk #7 succeeded at 719 (offset 2 lines). Hunk #8 succeeded at 801 (offset 2 lines). Hunk #9 succeeded at 863 (offset 2 lines). Hunk #10 succeeded at 876 (offset 2 lines). Hunk #11 succeeded at 889 (offset 2 lines). Hunk #12 succeeded at 951 (offset 2 lines). Hunk #13 succeeded at 988 (offset 2 lines). Hunk #14 succeeded at 1007 (offset 2 lines). Hunk #15 succeeded at 1041 (offset 2 lines).
Thanks,
-- Dexuan
Quoted 37 lines · Dexuan Cui
Quoted 31 lines
-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Tuesday, October 1, 2019 11:48 AMQuoted 1 line · Michael Kelley
From: Michael Kelley <[email protected]> Sent: Wednesday,
September 18, 2019 2:48 PM
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Without deferred IO support,
hyperv_fbdriver informs the host to refresh the entire guest frame buffer at fixed rate, e.g. at 20Hz, no matter there is screen update or not. This patch supports deferred IO for screens in graphics mode and also enables the frame buffer on-demand refresh. The highest refresh rate is still set at 20Hz.Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Currently Hyper-V only takes a physical address from guest as the starting address of frame buffer. This implies the guest must allocate contiguous physical memory for frame buffer. In addition, Hyper-V Gen 2 VMs only accept address from MMIO region as frame buffer address. Due to these limitations on Hyper-V host, we keep a shadow copy of frame buffer in the guest. This means one more copy of the dirty rectangle inside guest when doing the on-demand refresh. This can be optimized in the future with help from host. For now the host performance gain from
deferred
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
IO outweighs the shadow copy impact in the guest.
Signed-off-by Wei Hu <[email protected]>Sasha -- this patch and one other from Wei Hu for the Hyper-V frame buffer driver should be ready. Both patches affect only the Hyper-V frame buffer driver so can go through the Hyper-V tree. Can you pick these up? Thx.
Quoted 5 lines
I can't get this to apply anywhere, what tree is it based on?
--
Thanks,
Sasha
Quoted 7 lines
Hi Sasha,
Today's hyperv/linux.git's hyperv-next branch's top commit is
48b72a2697d5("hv_netvsc: Add the support of hibernation").Please pick up two patches from Wei Hu:
#1: [PATCH v4] video: hyperv:hyperv_fb: Obtain screen resolution from Hyper-V host #2: [PATHC v6] video: hyperv:hyperv_fb: Support deferred IO for Hyper-V frame buffer driver
Ah, I guess I was missing the first one. I've queued both for hyperv-next, thanks!
--
Thanks,
Sasha