From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH v2 2/2] drm/vc4: Allocated/liberate the binner BO at firstopen/lastclose Date: Thu, 21 Mar 2019 09:20:29 -0700 Message-ID: <871s3042sy.fsf@anholt.net> References: <20190320154809.14823-1-paul.kocialkowski@bootlin.com> <20190320154809.14823-3-paul.kocialkowski@bootlin.com> <87wokth498.fsf@anholt.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Paul Kocialkowski , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Eben Upton , Thomas Petazzoni List-Id: dri-devel@lists.freedesktop.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Paul Kocialkowski writes: > Hi, > > Le mercredi 20 mars 2019 =C3=A0 09:58 -0700, Eric Anholt a =C3=A9crit : >> Paul Kocialkowski writes: >>=20 >> > The binner BO is a pre-requisite to GPU operations, so we must ensure >> > that it is always allocated when the GPU is in use. Currently, we are >> > allocating it at probe time and liberating/allocating it during runtime >> > pm cycles. >> >=20 >> > First, since the binner buffer is only required for GPU rendering, it's >> > a waste to allocate it when the driver probes since internal users of >> > the driver (such as fbcon) won't try to use the GPU. >> >=20 >> > Move the allocation/liberation to the firstopen/lastclose instead to >> > only allocate it when userspace has opened the device and adapt the IRQ >> > handler to return early when no binner BO was allocated yet. >> >=20 >> > Second, because the buffer is allocated from the same pool as other GPU >> > buffers, we might run into a situation where we are out of memory at >> > runtime resume. This causes the binner BO allocation to fail and resul= ts >> > in all subsequent operations to fail, resulting in a major hang in >> > userspace. >> >=20 >> > As a result, keep the buffer alive during runtime pm. >> >=20 >> > Signed-off-by: Paul Kocialkowski >> > --- >> > diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_i= rq.c >> > index 4cd2ccfe15f4..efaba2b02f6c 100644 >> > --- a/drivers/gpu/drm/vc4/vc4_irq.c >> > +++ b/drivers/gpu/drm/vc4/vc4_irq.c >> > @@ -64,6 +64,9 @@ vc4_overflow_mem_work(struct work_struct *work) >> > struct vc4_exec_info *exec; >> > unsigned long irqflags; >> >=20=20 >> > + if (!bo) >> > + return; >> > + >> > bin_bo_slot =3D vc4_v3d_get_bin_slot(vc4); >> > if (bin_bo_slot < 0) { >> > DRM_ERROR("Couldn't allocate binner overflow mem\n"); >>=20 >> Hmm. We take the OOM IRQ on poweron, have no bin BO since nobody's >> opened yet, and leave it. Do we ever get the OOM IRQ again after that? >> Seems like vc4_allocate_bin_bo() might need to kick something so that we >> can fill an OOM request. > > I just had a look and it seems that we do get the OOM interrupt again > after the bin BO is allocated. Actually, I can see it kicking from time > to time when using X with glamor. > > From what I understood, this looks fairly legitimate. Should we be > worried about this? Great. I think how it ends up working is that when the job is submitted, the bin allocation it supplies internally gets us out of the OOM condition, so OOM can edge trigger again later. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlyTuc4ACgkQtdYpNtH8 nuja2xAAtyp4j1VInkIuNIkkh1Kx8yWqpbndPR9pXaks5Gp8rIMF6/P9briWGuLY 9cC+D2L6EPpk/4wmypEpzuy7h1il894TQjAutaOEbPqLM66ZqpE7vU5ULAyMm1+O nLj3YkbtzggaxKGDNIJDX7K8iO+U+P/IqFBAG3Rvu8Gy61Ol/pPO83HaSv1oqKOT DKGoAtlyWngghFo10A3jPpIu+QIpAu902Krf3tpIc7w/LJmqfAyKjMQmQ2072L+p Au6Xf6C3UOPIRPQQlbwGyzV4Nqsnjj47JrnlmvV1NSvo7kmev5NloPqEdjqZ6QNx VRLwvvw00Z/rsFUxIRUEqE3dAGnmZTLy+f7gJVcQeDcNLz94yrtWExSFZkP/TBlq pF3owZmcFvQSwsz1Hz2bAbpPZXIiZ0DhFgoKCi4wU6udNx9K+vsCWQ/+enO3npsZ gTvijtNNGvwm8NoT+QeB3KS12XoSZujNB8/4u5NMk28Jd3/TJDd+8vz2XIq5Qu4E L9x0d3+WS5pM42OB4DxDFlbPB2ns+38FG4MqqeZJAO9Mw7SjtURCjy8MTHfi6zg8 2cIK5MIPiL3IzbKNnk4SaTsi9O2PvyXsi824LBOAECrdGmgnh5SUBAK8v2FP9Pac iElQyCZLVtCMhKYGYFlyi4CwzLQ2+ti9uygKb7ShA5Au4/XZdFM= =kuQ/ -----END PGP SIGNATURE----- --=-=-=--