From: Eric Anholt <eric@anholt.net>
To: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Eben Upton <eben@raspberrypi.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: Re: [PATCH v8 4/4] drm/vc4: Allocate binner bo when starting to use the V3D
Date: Thu, 09 May 2019 11:39:17 -0700 [thread overview]
Message-ID: <87r2973222.fsf@anholt.net> (raw)
In-Reply-To: <20190503081242.29039-5-paul.kocialkowski@bootlin.com>
[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]
Paul Kocialkowski <paul.kocialkowski@bootlin.com> writes:
> The binner BO is not required until the V3D is in use, so avoid
> allocating it at probe and do it on the first non-dumb BO allocation.
>
> Keep track of which clients are using the V3D and liberate the buffer
> when there is none left, using a kref. Protect the logic with a
> mutex to avoid race conditions.
>
> The binner BO is created at the time of the first render ioctl and is
> destroyed when there is no client and no exec job using it left.
>
> The Out-Of-Memory (OOM) interrupt also gets some tweaking, to avoid
> enabling it before having allocated a binner bo.
>
> We also want to keep the BO alive during runtime suspend/resume to avoid
> failing to allocate it at resume. This happens when the CMA pool is
> full at that point and results in a hard crash.
>
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> @@ -313,6 +321,49 @@ static int bin_bo_alloc(struct vc4_dev *vc4)
> return ret;
> }
>
> +int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used)
> +{
> + int ret = 0;
> +
> + mutex_lock(&vc4->bin_bo_lock);
> +
> + if (used && *used)
> + goto complete;
> +
> + if (used)
> + *used = true;
> +
> + if (vc4->bin_bo) {
> + kref_get(&vc4->bin_bo_kref);
> + goto complete;
> + }
> +
> + ret = bin_bo_alloc(vc4);
I think this block wants to be:
if (vc4->bin_bo)
kref_get(&vc4->bin_bo_kref);
else
ret = bin_bo_alloc(vc4);
if (ret == 0 && used)
*used = true;
(so we don't flag used if bin_bo_alloc fails)
If you agree, then the series is:
Reviewed-by: Eric Anholt <eric@anholt.net>
> +
> +complete:
> + mutex_unlock(&vc4->bin_bo_lock);
> +
> + return ret;
> +}
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2019-05-09 18:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-03 8:12 [PATCH v8 0/4] drm/vc4: Binner BO management improvements Paul Kocialkowski
2019-05-03 8:12 ` [PATCH v8 1/4] drm/vc4: Reformat and the binner bo allocation helper Paul Kocialkowski
2019-05-03 8:12 ` [PATCH v8 2/4] drm/vc4: Check for V3D before binner bo alloc Paul Kocialkowski
2019-05-03 8:12 ` [PATCH v8 3/4] drm/vc4: Check for the binner bo before handling OOM interrupt Paul Kocialkowski
2019-05-03 8:12 ` [PATCH v8 4/4] drm/vc4: Allocate binner bo when starting to use the V3D Paul Kocialkowski
2019-05-09 18:39 ` Eric Anholt [this message]
2019-05-10 15:48 ` Paul Kocialkowski
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=87r2973222.fsf@anholt.net \
--to=eric@anholt.net \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=eben@raspberrypi.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
--cc=paul.kocialkowski@bootlin.com \
--cc=thomas.petazzoni@bootlin.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