linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: mhkelley58@gmail.com
To: simona@ffwll.ch, deller@gmx.de, haiyangz@microsoft.com,
	kys@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	akpm@linux-foundation.org
Cc: weh@microsoft.com, tzimmermann@suse.de, hch@lst.de,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org,
	linux-mm@kvack.org
Subject: [PATCH v3 4/4] fbdev: hyperv_fb: Fix mmap of framebuffers allocated using alloc_pages()
Date: Fri, 23 May 2025 09:15:22 -0700	[thread overview]
Message-ID: <20250523161522.409504-5-mhklinux@outlook.com> (raw)
In-Reply-To: <20250523161522.409504-1-mhklinux@outlook.com>

From: Michael Kelley <mhklinux@outlook.com>

Framebuffer memory allocated using alloc_pages() was added to hyperv_fb in
commit 3a6fb6c4255c ("video: hyperv: hyperv_fb: Use physical memory for fb
on HyperV Gen 1 VMs.") in kernel version 5.6. But mmap'ing such
framebuffers into user space has never worked due to limitations in the
kind of memory that fbdev deferred I/O works with. As a result of the
limitation, hyperv_fb's usage results in memory free lists becoming corrupt
and Linux eventually panics.

With support for framebuffers allocated using alloc_pages() recently added
to fbdev deferred I/O, fix the problem by setting the flag telling fbdev
deferred I/O to use the new support.

Fixes: 3a6fb6c4255c ("video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs.")
Signed-off-by: Michael Kelley <mhklinux@outlook.com>
---
 drivers/video/fbdev/hyperv_fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 75338ffc703f..1698221f857e 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1020,6 +1020,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 			info->fix.smem_len = screen_fb_size;
 			info->screen_base = par->mmio_vp;
 			info->screen_size = screen_fb_size;
+			info->flags |= FBINFO_KMEMFB;
 
 			par->need_docopy = false;
 			goto getmem_done;
-- 
2.25.1



      parent reply	other threads:[~2025-05-23 16:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23 16:15 [PATCH v3 0/4] fbdev: Add deferred I/O support for contiguous kernel memory framebuffers mhkelley58
2025-05-23 16:15 ` [PATCH v3 1/4] mm: Export vmf_insert_mixed_mkwrite() mhkelley58
2025-05-23 16:15 ` [PATCH v3 2/4] fbdev: Add flag indicating framebuffer is allocated from kernel memory mhkelley58
2025-05-23 16:15 ` [PATCH v3 3/4] fbdev/deferred-io: Support contiguous kernel memory framebuffers mhkelley58
2025-05-24  7:28   ` kernel test robot
2025-05-26  6:54   ` Christoph Hellwig
2025-06-02  9:47   ` David Hildenbrand
2025-06-03  1:49     ` Michael Kelley
2025-06-03  6:25       ` Thomas Zimmermann
2025-06-03 17:50         ` Michael Kelley
2025-06-04  8:12           ` Thomas Zimmermann
2025-06-04 14:45             ` Simona Vetter
2025-06-04 21:43               ` Michael Kelley
2025-06-05  7:55                 ` Thomas Zimmermann
2025-06-05 15:35                 ` Thomas Zimmermann
2025-06-05 17:38                   ` Michael Kelley
2025-06-06  7:05                     ` Thomas Zimmermann
2025-06-11 23:18                     ` Michael Kelley
2025-06-12  7:25                       ` Thomas Zimmermann
2025-06-03  7:55       ` David Hildenbrand
2025-06-03 17:24         ` Michael Kelley
2025-06-04 21:58           ` Michael Kelley
2025-06-05  8:10             ` David Hildenbrand
2025-05-23 16:15 ` mhkelley58 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250523161522.409504-5-mhklinux@outlook.com \
    --to=mhkelley58@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=decui@microsoft.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=haiyangz@microsoft.com \
    --cc=hch@lst.de \
    --cc=kys@microsoft.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhklinux@outlook.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=weh@microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox