dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: "David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Brian Starkey" <Brian.Starkey@arm.com>,
	"John Stultz" <jstultz@google.com>,
	"T.J. Mercier" <tjmercier@google.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Boris Brezillon" <boris.brezillon@collabora.com>,
	"Steven Price" <steven.price@arm.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Ketil Johnsen" <ketil.johnsen@arm.com>,
	"Ketil Johnsen" <ketil.johnsen@arm.com>
Cc: dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linaro-mm-sig@lists.linaro.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 6/8] drm/panthor: Explicit expansion of locked VM region
Date: Thu, 07 May 2026 16:54:21 +0200	[thread overview]
Message-ID: <vq-4uSFHRCWR0Whm98eJ2Q@collabora.com> (raw)
In-Reply-To: <kC1hpRBAS8uGaw7vVFyW2g@collabora.com>

On Wednesday, 6 May 2026 17:14:45 Central European Summer Time Nicolas Frattaroli wrote:
> On Tuesday, 5 May 2026 16:05:12 Central European Summer Time Ketil Johnsen wrote:
> > Currently the panthor_vm_lock_region() function will implicitly expand
> > an already locked VM region. This can be problematic because the caller
> > do not reliably know if it needs to call panthor_vm_unlock_region()
> > or not.
> > 
> > Worth noting, there is currently no known issues with this as the code
> > is written today.
> > 
> > This change introduces panthor_vm_expand_region() which will only work
> > if there is already a locked VM region. This again means that the
> > original lock and unlock functions can work as a pair. This pairing is
> > needed for subsequent protected memory changes.
> > 
> > Signed-off-by: Ketil Johnsen <ketil.johnsen@arm.com>
> > ---
> >  drivers/gpu/drm/panthor/panthor_mmu.c | 69 +++++++++++++++++++--------
> >  1 file changed, 50 insertions(+), 19 deletions(-)
> > 
> 
> While trying this series, I attempted my usual
> `modprobe -r panthor && modprobe panthor protected_heap_name=default_cma_region`.
> 
> Unfortunately, it oopses when attempting to unmap the sg for a bo labeled
> "FW section" on panthor module unload, and I bisected it to this patch.

Okay, so this one is due to the iomem access rework having landed
in drm-misc-next already, but this series being based on something
before that, so now all the new gpu_read(_.*)? and gpu_write.* calls
pass a panthor_device to something that expects the iomem. Since the
iomem uses void pointers, this wasn't caught by the compiler.

So, no "real" bug here, just an incredible dice roll for luck from my side.

Kind regards
Nicolas Frattaroli

> 
> The oops:
> 
> [  598.515550] Unable to handle kernel paging request at virtual address 0000000000400267
> [  598.516864] Mem abort info:
> [  598.517676]   ESR = 0x0000000096000004
> [  598.518560]   EC = 0x25: DABT (current EL), IL = 32 bits
> [  598.520414]   SET = 0, FnV = 0
> [  598.521275]   EA = 0, S1PTW = 0
> [  598.522099]   FSC = 0x04: level 0 translation fault
> [  598.523069] Data abort info:
> [  598.524311]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
> [  598.525566]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
> [  598.526850]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
> [  598.527905] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000104056000
> [  598.529019] [0000000000400267] pgd=0000000000000000, p4d=0000000000000000
> [  598.530170] Internal error: Oops: 0000000096000004 [#1]  SMP
> [  598.531158] Modules linked in: btusb btrtl btmtk btintel btbcm bluetooth ecdh_generic ecc kpp snd_soc_hdmi_codec cfg80211 r8169 rfkill_gpio pwm_fan rfkill snd_soc_es8316 rtc_hym8563 rk805_pwrkey at24 fusb302 tcpm aux_hpd_bridge display_connector snd_soc_simple_card phy_rockchip_samsung_hdptx phy_rockchip_usbdp rockchip_thermal typec phy_rockchip_naneng_combphy rockchip_saradc industrialio_triggered_buffer kfifo_buf rockchipdrm inno_hdmi dw_dp hantro_vpu rockchip_vdec dw_mipi_dsi2 v4l2_jpeg v4l2_vp9 rockchip_rga dw_mipi_dsi v4l2_h264 synopsys_hdmirx v4l2_dv_timings spi_rockchip_sfc videobuf2_dma_contig videobuf2_dma_sg v4l2_mem2mem videobuf2_memops dw_hdmi_qp onboard_usb_dev analogix_dp videobuf2_v4l2 videobuf2_common snd_soc_rockchip_i2s_tdm dw_hdmi videodev mc drm_display_helper nvme cec panthor(-) drm_gpuvm drm_exec gpu_sched drm_dp_aux_bus drm_dma_helper drm_client_lib nvme_core drm_kms_helper drm pci_endpoint_test backlight snd_soc_audio_graph_card snd_soc_simple_card_utils fuse dm_mod
> [  598.541237] CPU: 6 UID: 0 PID: 806 Comm: modprobe Not tainted 7.1.0-rc2-00726-g8ab0a3092b56-dirty #2 PREEMPT
> [  598.542733] Hardware name: Radxa ROCK 5T (DT)
> [  598.543746] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> [  598.544991] pc : dma_unmap_sg_attrs (kernel/dma/mapping.c:0)
> [  598.546021] lr : panthor_gem_free_object (include/linux/dma-mapping.h:565 drivers/gpu/drm/panthor/panthor_gem.c:308 drivers/gpu/drm/panthor/panthor_gem.c:469) panthor
> [  598.547180] sp : ffff80008835bb90
> [  598.548123] x29: ffff80008835bb90 x28: ffff00012610bf00 x27: 0000000000000000
> [  598.549412] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000
> [  598.550696] x23: ffff000127194600 x22: ffff0001271943d0 x21: ffff000118671000
> [  598.551984] x20: ffff000127194200 x19: ffff000127194600 x18: 00000000002ab980
> [  598.553273] x17: 00000000002ab980 x16: ffffa39a6b372a04 x15: 0000000000000000
> [  598.554568] x14: 0000000000000010 x13: 0000000000000000 x12: 000000000000003c
> [  598.555864] x11: 0000000000000002 x10: ffff000100a5d000 x9 : ffff000118671000
> [  598.557164] x8 : ffff000102f8b490 x7 : ffff000149569000 x6 : ffff000149569000
> [  598.558461] x5 : ffff000100faa7e8 x4 : 0000000000000000 x3 : 0000000000000000
> [  598.559763] x2 : 0000000000000010 x1 : ffff000127194000 x0 : 000000000040000f
> [  598.561069] Call trace:
> [  598.561961]  dma_unmap_sg_attrs (kernel/dma/mapping.c:0) (P)
> [  598.563038] panthor_gem_free_object (include/linux/dma-mapping.h:565 drivers/gpu/drm/panthor/panthor_gem.c:308 drivers/gpu/drm/panthor/panthor_gem.c:469) panthor
> [  598.564218] drm_gem_object_free (drivers/gpu/drm/drm_gem.c:1148) drm
> [  598.565386] panthor_kernel_bo_destroy (include/linux/kref.h:65 include/drm/drm_gem.h:565 include/drm/drm_gem.h:578 drivers/gpu/drm/panthor/panthor_gem.c:1317) panthor
> [  598.566575] panthor_fw_unplug (drivers/gpu/drm/panthor/panthor_fw.c:1306) panthor
> [  598.567705] panthor_device_unplug (drivers/gpu/drm/panthor/panthor_device.c:103) panthor
> [  598.568878] panthor_remove (drivers/gpu/drm/panthor/panthor_drv.c:1846) panthor
> [  598.569991]  platform_remove (drivers/base/platform.c:1435)
> [  598.571029]  device_release_driver_internal (drivers/base/dd.c:619 drivers/base/dd.c:1352 drivers/base/dd.c:1375)
> [  598.572209]  driver_detach (drivers/base/dd.c:1438)
> [  598.573237]  bus_remove_driver (drivers/base/bus.c:825)
> [  598.574304]  driver_unregister (drivers/base/driver.c:277)
> [  598.575363]  platform_driver_unregister (drivers/base/platform.c:920)
> [  598.576494] cleanup_module (drivers/gpu/drm/panthor/panthor_devfreq.c:134) panthor
> [  598.577617]  __arm64_sys_delete_module (kernel/module/main.c:863 kernel/module/main.c:804 kernel/module/main.c:804)
> [  598.578751]  invoke_syscall (arch/arm64/kernel/syscall.c:35 arch/arm64/kernel/syscall.c:49)
> [  598.579794]  el0_svc_common (arch/arm64/kernel/syscall.c:121)
> [  598.580842]  do_el0_svc (arch/arm64/kernel/syscall.c:140)
> [  598.581862]  el0_svc (arch/arm64/kernel/entry-common.c:723)
> [  598.582853]  el0t_64_sync_handler (arch/arm64/kernel/entry-common.c:742)
> [  598.583949]  el0t_64_sync (arch/arm64/kernel/entry.S:594)
> 
> Kind regards,
> Nicolas Frattaroli
> 
> 
> 





  reply	other threads:[~2026-05-07 14:54 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 14:05 [PATCH 0/8] drm/panthor: Protected mode support for Mali CSF GPUs Ketil Johnsen
2026-05-05 14:05 ` [PATCH 1/8] dma-heap: Add proper kref handling on dma-buf heaps Ketil Johnsen
2026-05-05 15:20   ` Boris Brezillon
2026-05-05 15:39     ` Maxime Ripard
2026-05-05 16:40       ` Boris Brezillon
2026-05-07 15:33         ` Maxime Ripard
2026-05-05 14:05 ` [PATCH 2/8] dma-heap: Provide accessors so that in-kernel drivers can allocate dmabufs from specific heaps Ketil Johnsen
2026-05-05 15:45   ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 3/8] drm/panthor: De-duplicate FW memory section sync Ketil Johnsen
2026-05-05 15:47   ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 4/8] drm/panthor: Add support for protected memory allocation in panthor Ketil Johnsen
2026-05-05 16:15   ` Boris Brezillon
2026-05-07  9:02     ` Marcin Ślusarz
2026-05-07 11:53       ` Boris Brezillon
2026-05-06 10:08   ` Maxime Ripard
2026-05-06 10:50     ` Boris Brezillon
2026-05-06 13:12       ` Maxime Ripard
2026-05-06 15:05         ` Boris Brezillon
2026-05-07 13:39           ` Thierry Reding
2026-05-06 12:43     ` Nicolas Frattaroli
2026-05-06 13:31       ` Maxime Ripard
2026-05-06 12:28   ` Nicolas Frattaroli
2026-05-05 14:05 ` [PATCH 5/8] drm/panthor: Minor scheduler refactoring Ketil Johnsen
2026-05-05 16:19   ` Boris Brezillon
2026-05-06 10:33   ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 6/8] drm/panthor: Explicit expansion of locked VM region Ketil Johnsen
2026-05-05 16:32   ` Boris Brezillon
2026-05-06 15:14   ` Nicolas Frattaroli
2026-05-07 14:54     ` Nicolas Frattaroli [this message]
2026-05-05 14:05 ` [PATCH 7/8] drm/panthor: Add support for entering and exiting protected mode Ketil Johnsen
2026-05-05 17:11   ` Boris Brezillon
2026-05-06  8:51   ` Boris Brezillon
2026-05-05 14:05 ` [PATCH 8/8] drm/panthor: Expose protected rendering features Ketil Johnsen
2026-05-06  9:14   ` Boris Brezillon
2026-05-07  8:47   ` Marcin Ślusarz

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=vq-4uSFHRCWR0Whm98eJ2Q@collabora.com \
    --to=nicolas.frattaroli@collabora.com \
    --cc=Brian.Starkey@arm.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jstultz@google.com \
    --cc=ketil.johnsen@arm.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=skhan@linuxfoundation.org \
    --cc=steven.price@arm.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tjmercier@google.com \
    --cc=tzimmermann@suse.de \
    /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