Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Nuno Gonçalves" <nunojpg@gmail.com>
Cc: Thorsten Leemhuis <regressions@leemhuis.info>,
	Linux kernel regressions list <regressions@lists.linux.dev>,
	dri-devel@lists.freedesktop.org,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Framebuffer <linux-fbdev@vger.kernel.org>
Subject: Re: drm/fbdev-dma: regression
Date: Thu, 28 Nov 2024 16:47:08 +0100	[thread overview]
Message-ID: <da4288a6-96cc-4095-bd73-d66b68e9ed01@suse.de> (raw)
In-Reply-To: <CAEXMXLQEJPVPyqLpH6C7R6iqhhKBpdNS9QeESbEdcmxB70goSA@mail.gmail.com>

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

Hi

Am 11.11.24 um 14:42 schrieb Nuno Gonçalves:
> On Mon, Nov 11, 2024 at 1:22 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> The patch in question changes the whole memory management of the
>> affected code. It's also noteworthy that most of it has been reworked
>> for the upcoming v6.12. Maybe this already fixed the problem. Kernel
>> v6.11-rc7 added commit 5a498d4d06d6 ("drm/fbdev-dma: Only install
>> deferred I/O if necessary"), which possibly fixes the problem as well.
>>
>> But there's no explicit fix for this problem and I have not seen any
>> other related reports. Any further information is welcome.
> Issue was present since 5ab91447aa13b8b98bc11f5326f33500b0ee2c48 and
> tested until 6.12-rc3.
> Is there any suggestion on how to dig down?

Here's a first attempt to address this bug. Could you please apply the 
attached patch and report on the results? It should work against the 
upcoming v6.13-rc1 or against a recent drm-misc-next.

Best regards
Thomas

>
> Thanks

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: 0001-fbdev-dma-Support-deferred-I-O-without-smem_start.patch --]
[-- Type: text/x-patch, Size: 1886 bytes --]

From 40d481266497437ebaa5312c9af9641361b172f8 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@suse.de>
Date: Thu, 28 Nov 2024 14:25:03 +0100
Subject: [PATCH] fbdev-dma: Support deferred I/O without smem_start

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_fbdev_dma.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index b14b581c059d..6a94d1b62479 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -8,6 +8,7 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_dma_helper.h>
+#include <drm/drm_gem_framebuffer_helper.h>
 
 /*
  * struct fb_ops
@@ -124,6 +125,28 @@ static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
 	.fb_dirty = drm_fbdev_dma_helper_fb_dirty,
 };
 
+static struct page *drm_fbdev_dma_get_page(struct fb_info *info, unsigned long offset)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+	struct drm_framebuffer *fb = fb_helper->fb;
+	struct drm_gem_object *obj = drm_gem_fb_get_obj(fb, 0);
+	const void *addr = info->screen_buffer + offset;
+	struct page *page = NULL;
+
+	if (fb_WARN_ON_ONCE(info, offset > obj->size))
+		return NULL;
+
+	if (is_vmalloc_addr(addr))
+		page = vmalloc_to_page(addr);
+	else if (virt_addr_valid(addr))
+		page = virt_to_page(addr);
+
+	if (!fb_WARN_ON_ONCE(info, !page))
+		get_page(page);
+
+	return page;
+}
+
 /*
  * struct drm_fb_helper
  */
@@ -217,6 +240,7 @@ int drm_fbdev_dma_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
 	/* deferred I/O */
 	if (use_deferred_io) {
 		fb_helper->fbdefio.delay = HZ / 20;
+		fb_helper->fbdefio.get_page = drm_fbdev_dma_get_page;
 		fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io;
 
 		info->fbdefio = &fb_helper->fbdefio;
-- 
2.47.0


  parent reply	other threads:[~2024-11-28 15:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220621104617.8817-1-tzimmermann@suse.de>
     [not found] ` <CAEXMXLR55DziAMbv_+2hmLeH-jP96pmit6nhs6siB22cpQFr9w@mail.gmail.com>
2024-11-11 11:51   ` drm/fbdev-dma: regression Thorsten Leemhuis
2024-11-11 13:22     ` Thomas Zimmermann
2024-11-11 13:42       ` Nuno Gonçalves
2024-11-11 14:37         ` Thomas Zimmermann
     [not found]           ` <CAEXMXLRDDC+PB7S9VtqyMr1MUPPb7NYngwu4gcn9-K2kyHm3rQ@mail.gmail.com>
2024-11-12  8:11             ` Thomas Zimmermann
2024-11-28 15:47         ` Thomas Zimmermann [this message]
2024-11-28 23:37           ` Nuno Gonçalves
2024-12-02 11:18             ` Thomas Zimmermann
2024-12-07 22:36               ` Nuno Gonçalves
2024-12-09 13:43                 ` Thomas Zimmermann
2024-12-09 13:56                   ` Nuno Gonçalves
2024-12-11  9:07                     ` Thomas Zimmermann
2025-02-26 22:57                       ` Nuno Gonçalves
2025-02-27  9:01                         ` Thomas Zimmermann

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=da4288a6-96cc-4095-bd73-d66b68e9ed01@suse.de \
    --to=tzimmermann@suse.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nunojpg@gmail.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    /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