lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Mar 2019 09:20:29 -0700
From:   Eric Anholt <eric@...olt.net>
To:     Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Eben Upton <eben@...pberrypi.org>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v2 2/2] drm/vc4: Allocated/liberate the binner BO at firstopen/lastclose

Paul Kocialkowski <paul.kocialkowski@...tlin.com> writes:

> Hi,
>
> Le mercredi 20 mars 2019 à 09:58 -0700, Eric Anholt a écrit :
>> Paul Kocialkowski <paul.kocialkowski@...tlin.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@...tlin.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?

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.

Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ