linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Eric Anholt <eric@anholt.net>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	Eben Upton <eben@raspberrypi.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v2 2/2] drm/vc4: Allocated/liberate the binner BO at firstopen/lastclose
Date: Thu, 21 Mar 2019 16:58:35 +0100	[thread overview]
Message-ID: <a027f99e59c90b2b3a87c4b18a263cfee4cc5795.camel@bootlin.com> (raw)
In-Reply-To: <87wokth498.fsf@anholt.net>

Hi,

Le mercredi 20 mars 2019 à 09:58 -0700, Eric Anholt a écrit :
> Paul Kocialkowski <paul.kocialkowski@bootlin.com> writes:
> 
> > 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.
> > 
> > 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.
> > 
> > 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.
> > 
> > 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 results
> > in all subsequent operations to fail, resulting in a major hang in
> > userspace.
> > 
> > As a result, keep the buffer alive during runtime pm.
> > 
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> > ---
> > diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.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;
> >  
> > +	if (!bo)
> > +		return;
> > +
> >  	bin_bo_slot = vc4_v3d_get_bin_slot(vc4);
> >  	if (bin_bo_slot < 0) {
> >  		DRM_ERROR("Couldn't allocate binner overflow mem\n");
> 
> 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?

Cheers,

Paul

-- 
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


  reply	other threads:[~2019-03-21 15:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 15:48 [PATCH v2 0/2] drm/vc4: Binner BO management improvements Paul Kocialkowski
2019-03-20 15:48 ` [PATCH v2 1/2] drm/file: Rehabilitate the firstopen hook for non-legacy drivers Paul Kocialkowski
2019-03-20 16:56   ` Eric Anholt
2019-03-21 15:27     ` Paul Kocialkowski
2019-03-21 23:12       ` Eric Anholt
2019-03-28 18:53       ` Daniel Vetter
2019-03-29  9:09         ` Daniel Stone
2019-03-29 15:02           ` Paul Kocialkowski
2019-03-29 15:25             ` Daniel Vetter
2019-03-29 15:49               ` Paul Kocialkowski
2019-03-29 18:14                 ` Eric Anholt
2019-03-29 18:42                   ` Daniel Stone
2019-03-29 20:21                     ` Paul Kocialkowski
2019-03-29 15:07         ` Paul Kocialkowski
2019-03-20 15:48 ` [PATCH v2 2/2] drm/vc4: Allocated/liberate the binner BO at firstopen/lastclose Paul Kocialkowski
2019-03-20 16:58   ` Eric Anholt
2019-03-21 15:58     ` Paul Kocialkowski [this message]
2019-03-21 16:20       ` Eric Anholt

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=a027f99e59c90b2b3a87c4b18a263cfee4cc5795.camel@bootlin.com \
    --to=paul.kocialkowski@bootlin.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eben@raspberrypi.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    --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;
as well as URLs for NNTP newsgroup(s).