mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francesco Valla <francesco@valla.it>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Bjorn Andersson <andersson@kernel.org>,
	 Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
	Joakim Zhang <joakim.zhang@cixtech.com>,
	 linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] remoteproc: virtio: Decouple vdev from the parent pdev
Date: Tue, 24 Nov 2026 21:00:44 +0100	[thread overview]
Message-ID: <awXq4WK1_HLSPVeB@bywater> (raw)
In-Reply-To: <awXBjZ9jqXW1ETNZ@p14s>

Hi Mathieu,

On Tue, Nov 24, 2026 at 10:55:41AM -0600, Mathieu Poirier wrote:
> On Sat, Nov 14, 2026 at 09:06:33AM +0100, Francesco Valla wrote:
> > The rproc-virtio platform device can have a lifetime different from the
> > virtio_device it registers. During cleanup (e.g.: when a remoteproc is
> > stopped) the platform device is de-registered by the remoteproc core,
> > but the related virtio_device might be released later; if this happens,
> > rproc_virtio_dev_release() will try to de-reference a NULL pointer as
> > part of vdev_to_rvdev(). This can easily be reproduced with
> > CONFIG_DEBUG_KOBJECT_RELEASE.
> 
> Can you provide steps to reproduce this problem?  Otherwise I'm good with the
> simplifications provided by this patch.
>

This is actually very simple to reproduce, at least on the platforms I am
working on this (i.MX93 and BeagleY-AI's AM67A).

With CONFIG_DEBUG_KOBJECT_RELEASE defined and a rpmsg-enabled firmware
(I am using Zephyr's openamp_rsc_table sample, but anything would work),
stopping the remoteproc will trigger the NULL dereference.

On the BeagleY-AI:

[   73.051869] kobject: 'rpmsg' (0000000058d91be6): kobject_release, parent 0000000000000000 (delayed 250)
[   73.051906] kobject: '(null)' (00000000ee88117f): kobject_release, parent 00000000eb0302a3 (delayed 250)
[   73.051959] kobject: 'virtio1.rpmsg_ctrl.0.0' (000000007eeaaf42): kobject_release, parent 0000000000000000 (delayed 750)
[   73.052079] kobject: 'virtio1.rpmsg_ns.53.53' (000000004cd28f83): kobject_release, parent 0000000000000000 (delayed 250)
[   73.052175] kobject: 'virtio1.rpmsg-tty.-1.1024' (00000000a54df55b): kobject_release, parent 0000000000000000 (delayed 500)
[   73.052265] kobject: 'virtio1.rpmsg-client-sample.-1.1025' (00000000bf62fa8b): kobject_release, parent 0000000000000000 (delayed 750)
[   73.052420] kobject: 'virtio1.rpmsg-tty.-1.1026' (00000000063ab658): kobject_release, parent 0000000000000000 (delayed 1000)
[   73.053420] kobject: 'virtio1' (00000000a3047c6c): kobject_release, parent 0000000000000000 (delayed 1000)
[   73.053548] remoteproc remoteproc1: stopped remote processor 79000000.r5f
[   74.076813] kobject: 'rpmsg_ctrl1' (00000000eb0302a3): kobject_release, parent 0000000000000000 (delayed 750)
[   77.276843] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030
[   77.276865] Mem abort info:
[   77.276867]   ESR = 0x0000000096000004
[   77.276870]   EC = 0x25: DABT (current EL), IL = 32 bits
[   77.276875]   SET = 0, FnV = 0
[   77.276878]   EA = 0, S1PTW = 0
[   77.276880]   FSC = 0x04: level 0 translation fault
[   77.276884] Data abort info:
[   77.276886]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[   77.276889]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   77.276892]   GCS = 0, Overlay = 0, DirtyBit = 0
[   77.276896] user pgtable: 4k pages, 48-bit VAs, pgdp=00000008815c6000
[   77.276901] [0000000000000030] pgd=0000000000000000, p4d=0000000000000000
[   77.276915] Internal error: Oops: 0000000096000004 [#1]  SMP
[   77.345309] Modules linked in: <snip>
[   77.391027] CPU: 3 UID: 0 PID: 34 Comm: kworker/3:0 Not tainted 7.4.0-rc4-00002-gd6d63eabb07e #1 PREEMPT(full)
[   77.401095] Hardware name: beagle BeagleBoard.org BeagleY-AI/BeagleBoard.org BeagleY-AI, BIOS 2027.01-rc3 01/01/2027
[   77.411593] Workqueue: events kobject_delayed_cleanup
[   77.416644] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   77.423589] pc : rproc_virtio_dev_release+0x20/0x5c
[   77.428459] lr : rproc_virtio_dev_release+0x20/0x5c
[   77.433325] sp : ffff80008025bd20
[   77.436627] x29: ffff80008025bd20 x28: 0000000000000000 x27: 0000000000000000
[   77.443750] x26: ffff00087f763980 x25: 0000000000000000 x24: ffff000800044805
[   77.450874] x23: ffff0008002e7000 x22: ffff00087f763980 x21: ffff000809f8cc50
[   77.457997] x20: ffff000808920600 x19: 0000000000000000 x18: ffffa2019d699248
[   77.465120] x17: ffff000800068f80 x16: ffffa2019c2fdecc x15: 0000000000000284
[   77.472243] x14: ffff0008002e7080 x13: 0000000000000000 x12: 0000000000000011
[   77.479366] x11: 00000000000000c0 x10: 0000000000000b60 x9 : 000000000000000c
[   77.486488] x8 : ffff80008025bcc0 x7 : ffff000800002dc0 x6 : fffffdffe027e300
[   77.493611] x5 : ffffa2019cbe6e64 x4 : ffff000802654400 x3 : ffff000809f8cc00
[   77.500735] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008002e7000
[   77.507858] Call trace:
[   77.510295]  rproc_virtio_dev_release+0x20/0x5c (P)
[   77.515162]  device_release+0x3c/0xe0
[   77.518818]  kobject_delayed_cleanup+0x40/0x88
[   77.523250]  process_one_work+0x188/0x2e4
[   77.527253]  worker_thread+0x18c/0x2e0
[   77.530994]  kthread+0x110/0x12c
[   77.534216]  ret_from_fork+0x10/0x20
[   77.537787] Code: f9000bf3 f9405401 f9406833 97dc5c1b (f9401a60)
[   77.543866] ---[ end trace 0000000000000000 ]---


> 
> Thanks,
> Mathieu
>

Thank you

Regards,
Francesco


  reply	other threads:[~2026-11-24 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14  8:06 [PATCH v2 0/4] remoteproc: virtio: Fixes and cleanups in the vdev<->pdev relationship Francesco Valla
2026-11-14  8:06 ` [PATCH v2 1/4] remoteproc: virtio: Decouple vdev from the parent pdev Francesco Valla
2026-11-24 16:55   ` Mathieu Poirier
2026-11-24 20:00     ` Francesco Valla [this message]
2026-11-14  8:06 ` [PATCH v2 2/4] remoteproc: virtio: Rework memory release Francesco Valla
2026-11-14  8:06 ` [PATCH v2 3/4] remoteproc: virtio: Drop rvdevs list and associated functions Francesco Valla
2026-11-14  8:06 ` [PATCH v2 4/4] remoteproc: virtio: Stop de-referencing pdev from its children Francesco Valla

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=awXq4WK1_HLSPVeB@bywater \
    --to=francesco@valla.it \
    --cc=andersson@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=joakim.zhang@cixtech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.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

all inboxes | Powered by JetHome®