linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Mikko Perttunen <mperttunen@nvidia.com>
Subject: Re: [PATCH 2/2] drm/tegra: Acquire a reference to the IOVA cache
Date: Thu, 17 May 2018 14:09:42 +0200	[thread overview]
Message-ID: <20180517120942.GA11379@ulmo> (raw)
In-Reply-To: <49971929-ddc7-0cad-bd23-125251bf0af4@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1919 bytes --]

On Thu, May 17, 2018 at 01:53:23PM +0300, Dmitry Osipenko wrote:
> On 23.04.2018 09:57, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > The IOVA API uses a memory cache to allocate IOVA nodes from. To make
> > sure that this cache is available, obtain a reference to it and release
> > the reference when the cache is no longer needed.
> > 
> > On 64-bit ARM this is hidden by the fact that the DMA mapping API gets
> > that reference and never releases it. On 32-bit ARM, however, the DMA
> > mapping API doesn't do that, so allocation of IOVA nodes fails.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/gpu/drm/tegra/drm.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> > index 4a696fa274a3..0540b0741df6 100644
> > --- a/drivers/gpu/drm/tegra/drm.c
> > +++ b/drivers/gpu/drm/tegra/drm.c
> > @@ -115,6 +115,10 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
> >  			goto free;
> >  		}
> >  
> > +		err = iova_cache_get();
> > +		if (err < 0)
> > +			goto domain;
> > +
> >  		geometry = &tegra->domain->geometry;
> >  		gem_start = geometry->aperture_start;
> >  		gem_end = geometry->aperture_end - CARVEOUT_SZ;
> > @@ -205,11 +209,12 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
> >  	tegra_drm_fb_free(drm);
> >  config:
> >  	drm_mode_config_cleanup(drm);
> > -
> > +domain:
> >  	if (tegra->domain) {
> >  		mutex_destroy(&tegra->mm_lock);
> >  		drm_mm_takedown(&tegra->mm);
> >  		put_iova_domain(&tegra->carveout.domain);
> > +		iova_cache_put();
> 
> I've spotted that this ^ is incorrect. This will put the iova_cache without
> getting it if iova_cache_get() failed.

Good catch, updated the patch with your suggestion.

Thanks,
Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-05-17 12:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23  6:57 [PATCH 1/2] drm/tegra: Fix order of teardown in IOMMU case Thierry Reding
2018-04-23  6:57 ` [PATCH 2/2] drm/tegra: Acquire a reference to the IOVA cache Thierry Reding
2018-04-23  8:34   ` Dmitry Osipenko
2018-04-23  8:41     ` Dmitry Osipenko
2018-04-23  8:43       ` Dmitry Osipenko
2018-05-14  9:02         ` Thierry Reding
2018-05-17 10:53   ` Dmitry Osipenko
2018-05-17 12:09     ` Thierry Reding [this message]
2018-04-23  8:35 ` [PATCH 1/2] drm/tegra: Fix order of teardown in IOMMU case Dmitry Osipenko
2018-05-14  8:59   ` Thierry Reding

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=20180517120942.GA11379@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=digetx@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.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).