From: Bartlomiej Zolnierkiewicz Date: Wed, 15 Jan 2020 15:16:44 +0000 Subject: Re: [PATCH v4] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs. Message-Id: <5a58696d-7f23-a577-c25e-ebe748b1aef0@samsung.com> List-Id: References: <20191209075749.3804-1-weh@microsoft.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dexuan Cui Cc: "sashal@kernel.org" , "info@metux.net" , "alexandre.belloni@bootlin.com" , Stephen Hemminger , kbuild test robot , "arnd@arndb.de" , "gregkh@linuxfoundation.org" , Haiyang Zhang , "linux-fbdev@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Michael Kelley , "linux-hyperv@vger.kernel.org" , "mchehab+samsung@kernel.org" , Wei Hu , KY Srinivasan , "sam@ravnborg.org" , "hch@lst.de" , "linux-kernel@vger.kernel.org" , "m.szyprowski@samsung.com" On 1/6/20 11:37 PM, Dexuan Cui wrote: >> From: Michael Kelley >> Sent: Monday, December 9, 2019 8:33 AM >> To: Wei Hu ; b.zolnierkie@samsung.com; KY >> Srinivasan ; Haiyang Zhang ; >> Stephen Hemminger ; sashal@kernel.org; >> hch@lst.de; m.szyprowski@samsung.com; mchehab+samsung@kernel.org; >> sam@ravnborg.org; gregkh@linuxfoundation.org; >> alexandre.belloni@bootlin.com; info@metux.net; arnd@arndb.de; >> dri-devel@lists.freedesktop.org; linux-fbdev@vger.kernel.org; >> linux-kernel@vger.kernel.org; linux-hyperv@vger.kernel.org; Dexuan Cui >> >> Cc: kbuild test robot >> Subject: RE: [PATCH v4] video: hyperv: hyperv_fb: Use physical memory for >> fb on HyperV Gen 1 VMs. >> >> From: Wei Hu Sent: Sunday, December 8, 2019 11:58 >> PM >>> >>> On Hyper-V, Generation 1 VMs can directly use VM's physical memory for >>> their framebuffers. This can improve the efficiency of framebuffer and >>> overall performance for VM. The physical memory assigned to framebuffer >>> must be contiguous. We use CMA allocator to get contiguous physicial >>> memory when the framebuffer size is greater than 4MB. For size under >>> 4MB, we use alloc_pages to achieve this. >>> >>> To enable framebuffer memory allocation from CMA, supply a kernel >>> parameter to give enough space to CMA allocator at boot time. For >>> example: >>> cma0m >>> This gives 130MB memory to CAM allocator that can be allocated to >>> framebuffer. If this fails, we fall back to the old way of using >>> mmio for framebuffer. >>> >>> Reported-by: kbuild test robot >>> Signed-off-by: Wei Hu >>> --- >>> v2: Incorporated review comments form hch@lst.de, Michael Kelley >> and >>> Dexuan Cui >>> - Use dma_alloc_coherent to allocate large contiguous memory >>> - Use phys_addr_t for physical addresses >>> - Corrected a few spelling errors and minor cleanups >>> - Also tested on 32 bit Ubuntu guest >>> v3: Fixed a build issue reported by kbuild test robot and incorported >>> some review comments from Michael Kelley >>> - Add CMA check to avoid link failure >>> - Fixed small memory leak introduced by alloc_apertures >>> - Cleaned up so code >>> v4: Removed request_pages variable as it is no longer needed >>> >>> drivers/video/fbdev/Kconfig | 1 + >>> drivers/video/fbdev/hyperv_fb.c | 182 >> +++++++++++++++++++++++++------- >>> 2 files changed, 144 insertions(+), 39 deletions(-) >>> >> >> Reviewed-by: Michael Kelley > > Tested-by: Dexuan Cui > > For a Gen-1 VM running on recent Hyper-V hosts, this patch can greatly > reduce the CPU utilization because it avoids the slow data copy from the > shadow framebuffer to the MMIO framebuffer, and hence it resolves the > "blurred screen" issue when we output a lot of characters on the text-mode > ternimal (e.g. "dmesg"). Acked-by: Bartlomiej Zolnierkiewicz Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics