From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>
Cc: quic_carlv@quicinc.com, quic_pkanojiy@quicinc.com,
ogabbay@kernel.org, linux-arm-msm@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 7/7] accel/qaic: Add QAIC_DETACH_SLICE_BO IOCTL
Date: Sun, 17 Sep 2023 10:56:46 +0200 [thread overview]
Message-ID: <20230917085646.GB441281@linux.intel.com> (raw)
In-Reply-To: <20230901172247.11410-8-quic_jhugo@quicinc.com>
On Fri, Sep 01, 2023 at 11:22:47AM -0600, Jeffrey Hugo wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
>
> Once a BO is attached with slicing configuration that BO can only be used
> for that particular setting. With this new feature user can detach slicing
> configuration off an already sliced BO and attach new slicing configuration
> using QAIC_ATTACH_SLICE_BO.
>
> This will support BO recycling.
>
> detach_slice_bo() detaches slicing configuration from a BO. This new
> helper function can also be used in release_dbc() as we are doing the
> exact same thing.
>
> Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> [jhugo: add documentation for new ioctl]
> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
<snip>
> + /* Check if BO is committed to H/W for DMA */
> + spin_lock_irqsave(&dbc->xfer_lock, flags);
> + if (bo->queued) {
> + spin_unlock_irqrestore(&dbc->xfer_lock, flags);
> + ret = -EBUSY;
> + goto unlock_ch_srcu;
> + }
> + spin_unlock_irqrestore(&dbc->xfer_lock, flags);
This looks like race condition. If some other thread will take the xfer_lock
and set bo->queued (HERE just after _unlock()) we will not return -EBUSY.
Something seems to be missing here or xfer_lock is not needed to protect
bo->queued.
Regards
Stanislaw
WARNING: multiple messages have this Message-ID (diff)
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: Jeffrey Hugo <quic_jhugo@quicinc.com>
Cc: quic_pkanojiy@quicinc.com, linux-arm-msm@vger.kernel.org,
quic_carlv@quicinc.com, ogabbay@kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 7/7] accel/qaic: Add QAIC_DETACH_SLICE_BO IOCTL
Date: Sun, 17 Sep 2023 10:56:46 +0200 [thread overview]
Message-ID: <20230917085646.GB441281@linux.intel.com> (raw)
In-Reply-To: <20230901172247.11410-8-quic_jhugo@quicinc.com>
On Fri, Sep 01, 2023 at 11:22:47AM -0600, Jeffrey Hugo wrote:
> From: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
>
> Once a BO is attached with slicing configuration that BO can only be used
> for that particular setting. With this new feature user can detach slicing
> configuration off an already sliced BO and attach new slicing configuration
> using QAIC_ATTACH_SLICE_BO.
>
> This will support BO recycling.
>
> detach_slice_bo() detaches slicing configuration from a BO. This new
> helper function can also be used in release_dbc() as we are doing the
> exact same thing.
>
> Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>
> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
> [jhugo: add documentation for new ioctl]
> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
<snip>
> + /* Check if BO is committed to H/W for DMA */
> + spin_lock_irqsave(&dbc->xfer_lock, flags);
> + if (bo->queued) {
> + spin_unlock_irqrestore(&dbc->xfer_lock, flags);
> + ret = -EBUSY;
> + goto unlock_ch_srcu;
> + }
> + spin_unlock_irqrestore(&dbc->xfer_lock, flags);
This looks like race condition. If some other thread will take the xfer_lock
and set bo->queued (HERE just after _unlock()) we will not return -EBUSY.
Something seems to be missing here or xfer_lock is not needed to protect
bo->queued.
Regards
Stanislaw
next prev parent reply other threads:[~2023-09-17 8:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-01 17:22 [PATCH 0/7] accel/qaic: Extend uAPI to support undoing ATTACH_SLICE_BO Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 1/7] accel/qaic: Remove ->size field from struct qaic_bo Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 2/7] accel/qaic: Update BO metadata in a central location Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 3/7] accel/qaic: Declare BO 'sliced' after all the operations are complete Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 4/7] accel/qaic: Undo slicing setup done in qaic_attach_slicing_bo() Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 5/7] accel/qaic: Clean up BO during flushing of transfer list Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 6/7] accel/qaic: Create a function to initialize BO Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-17 8:48 ` Stanislaw Gruszka
2023-09-17 8:48 ` Stanislaw Gruszka
2023-09-22 14:59 ` Jeffrey Hugo
2023-09-22 14:59 ` Jeffrey Hugo
2023-09-01 17:22 ` [PATCH 7/7] accel/qaic: Add QAIC_DETACH_SLICE_BO IOCTL Jeffrey Hugo
2023-09-01 17:22 ` Jeffrey Hugo
2023-09-17 8:56 ` Stanislaw Gruszka [this message]
2023-09-17 8:56 ` Stanislaw Gruszka
2023-09-22 15:16 ` Jeffrey Hugo
2023-09-22 15:16 ` Jeffrey Hugo
2023-09-17 8:58 ` [PATCH 0/7] accel/qaic: Extend uAPI to support undoing ATTACH_SLICE_BO Stanislaw Gruszka
2023-09-17 8:58 ` Stanislaw Gruszka
2023-09-22 15:17 ` Jeffrey Hugo
2023-09-22 15:17 ` Jeffrey Hugo
2023-09-22 16:04 ` Jeffrey Hugo
2023-09-22 16:04 ` Jeffrey Hugo
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=20230917085646.GB441281@linux.intel.com \
--to=stanislaw.gruszka@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=ogabbay@kernel.org \
--cc=quic_carlv@quicinc.com \
--cc=quic_jhugo@quicinc.com \
--cc=quic_pkanojiy@quicinc.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.