From: Ioana Ciocoi Radulescu <ruxandra.radulescu@nxp.com>
To: "Frank Li" <frank.li@nxp.com>, "Oded Gabbay" <ogabbay@kernel.org>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Shawn Guo" <shawnguo@kernel.org>,
"Christian König" <christian.koenig@amd.com>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
Jiwei Fu <jiwei.fu@nxp.com>, Forrest Shi <xuelin.shi@nxp.com>,
Alexandru Iulian Taran <alexandru.taran@nxp.com>,
Daniel Baluta <daniel.baluta@nxp.com>
Subject: RE: [PATCH v2 7/9] accel/neutron: Add job submission IOCTL
Date: Tue, 24 Mar 2026 13:38:41 +0000 [thread overview]
Message-ID: <PAXPR04MB94245DA907F655FDA17C74989448A@PAXPR04MB9424.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20260306170259.296712-1-Frank.Li@nxp.com>
On Friday, March 6, 2026 at 7:03 PM, Frank Li wrote:
> > + if (appstatus & APPSTATUS_FAULTCAUSE_MASK) {
> > + dev_err(ndev->dev, "Neutron halted due to fault: 0x%lx\n",
> > + FIELD_GET(APPSTATUS_FAULTCAUSE_MASK,
> appstatus));
> > + return neutron_job_err_handler(ndev);
>
> AI: neutron_job_err_handler() returns void, not int. Remove 'return'.
Ok, will fix.
>
> > + ret = drm_sched_job_init(&job->base, &npriv->sched_entity, 1, NULL,
> > + filp->client_id);
> > + if (ret)
> > + goto out_put_syncobj;
> > +
> > + ret = neutron_push_job(job, syncobj);
> > + if (ret)
> > + goto out_sched_cleanup;
> > +
> > + neutron_put_job(job);
> > + drm_syncobj_put(syncobj);
> > +
> > + return 0;
> > +
> > +out_sched_cleanup:
> > + drm_sched_job_cleanup(&job->base);
> > +out_put_syncobj:
> > + drm_syncobj_put(syncobj);
> > +out_put_gem:
> > + drm_gem_object_put(job->bo);
>
> AI: In the success path, neutron_put_job(job) is called which decrements
> refcnt. But if neutron_push_job() fails and we hit out_sched_cleanup, the job
> refcnt is never decremented. This leaks the job structure.
> Consider: if neutron_push_job() succeeds, it calls kref_get() inside sched_lock.
> If it fails, no kref_get() happens, so don't call
>
> (Need owner do judgment. Not sure if AI said correctly.)
I don't see an issue here, kref_get() is called at a point where
neutron_push_job() can't fail anymore. And if neutron_push_job() fails
earlier, error path looks clean, it frees everything in reverse order,
including the job struct.
Btw, what agent did you use for review?
Thanks,
Ioana
>
> Frank
next prev parent reply other threads:[~2026-03-24 13:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 13:27 [PATCH v2 0/9] accel: New driver for NXP's Neutron NPU Ioana Ciocoi-Radulescu
2026-03-06 13:27 ` [PATCH v2 1/9] drm/gem-dma: Add flag for bidirectional mapping of non-coherent GEM DMA buffers Ioana Ciocoi-Radulescu
2026-03-06 13:27 ` [PATCH v2 2/9] accel/neutron: Add documentation for NXP Neutron accelerator driver Ioana Ciocoi-Radulescu
2026-03-06 13:27 ` [PATCH v2 3/9] dt-bindings: npu: Add NXP Neutron Ioana Ciocoi-Radulescu
2026-03-06 14:17 ` Krzysztof Kozlowski
2026-03-06 13:27 ` [PATCH v2 4/9] accel/neutron: Add driver for NXP Neutron NPU Ioana Ciocoi-Radulescu
2026-03-06 14:21 ` Krzysztof Kozlowski
2026-03-24 13:36 ` Ioana Ciocoi Radulescu
2026-03-06 13:27 ` [PATCH v2 5/9] accel/neutron: Add GEM buffer object support Ioana Ciocoi-Radulescu
2026-03-06 13:27 ` [PATCH v2 6/9] accel/neutron: Add mailbox support Ioana Ciocoi-Radulescu
2026-03-06 13:27 ` [PATCH v2 7/9] accel/neutron: Add job submission IOCTL Ioana Ciocoi-Radulescu
2026-03-06 17:02 ` Frank Li
2026-03-24 13:38 ` Ioana Ciocoi Radulescu [this message]
2026-03-06 13:27 ` [PATCH v2 8/9] accel/neutron: Add logging support Ioana Ciocoi-Radulescu
2026-03-06 13:27 ` [PATCH v2 9/9] arm64: dts: imx95: Add Neutron node Ioana Ciocoi-Radulescu
2026-03-21 17:19 ` [PATCH v2 0/9] accel: New driver for NXP's Neutron NPU Tomeu Vizoso
2026-03-24 12:12 ` Ioana Ciocoi Radulescu
[not found] ` <CAPsqS2QXcgbi9_e4QmCn1Cgkr-bOVsY-E9qpZsFw3WYWWLugEw@mail.gmail.com>
2026-03-26 7:18 ` Ioana Ciocoi Radulescu
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=PAXPR04MB94245DA907F655FDA17C74989448A@PAXPR04MB9424.eurprd04.prod.outlook.com \
--to=ruxandra.radulescu@nxp.com \
--cc=airlied@gmail.com \
--cc=alexandru.taran@nxp.com \
--cc=christian.koenig@amd.com \
--cc=conor+dt@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=frank.li@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jiwei.fu@nxp.com \
--cc=krzk+dt@kernel.org \
--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=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ogabbay@kernel.org \
--cc=robh@kernel.org \
--cc=shawnguo@kernel.org \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=tzimmermann@suse.de \
--cc=xuelin.shi@nxp.com \
/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