mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: dri-devel <dri-devel@lists.freedesktop.org>,
	freedreno <freedreno@lists.freedesktop.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Rob Clark <robdclark@chromium.org>, Sean Paul <sean@poorly.run>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/9] drm/msm/gem: Split out inuse helper
Date: Wed, 30 Mar 2022 10:32:32 -0700	[thread overview]
Message-ID: <CAF6AEGtkpF5MLza0LY_AJsC4vu1nAzXZ5xv4Eusz+Bpp6GFXRA@mail.gmail.com> (raw)
In-Reply-To: <CAA8EJpqAaW0Q-QeQObonUqAhdWaw8mPPvChmboH88ttTx+2XGg@mail.gmail.com>

On Wed, Mar 30, 2022 at 4:32 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Wed, 30 Mar 2022 at 02:00, Rob Clark <robdclark@gmail.com> wrote:
> >
> > From: Rob Clark <robdclark@chromium.org>
> >
> > Prep for a following patch.  While we are at it, convert a few remaining
> > WARN_ON()s to GEM_WARN_ON().
>
> Well... GEM_WARN_ON doesn't really look like a 'while we are at it'.
> It might be better to split it into a separate commit.

it was a bit lazy.. I'll split it out

> >
> > Signed-off-by: Rob Clark <robdclark@chromium.org>
> > ---
> >  drivers/gpu/drm/msm/msm_gem.c     |  2 +-
> >  drivers/gpu/drm/msm/msm_gem.h     |  1 +
> >  drivers/gpu/drm/msm/msm_gem_vma.c | 15 ++++++++++-----
> >  3 files changed, 12 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> > index a4f61972667b..f96d1dc72021 100644
> > --- a/drivers/gpu/drm/msm/msm_gem.c
> > +++ b/drivers/gpu/drm/msm/msm_gem.c
> > @@ -938,7 +938,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m,
> >                                 name, comm ? ":" : "", comm ? comm : "",
> >                                 vma->aspace, vma->iova,
> >                                 vma->mapped ? "mapped" : "unmapped",
> > -                               vma->inuse);
> > +                               msm_gem_vma_inuse(vma));
> >                         kfree(comm);
> >                 }
> >
> > diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
> > index 947ff7d9b471..1b7f0f0b88bf 100644
> > --- a/drivers/gpu/drm/msm/msm_gem.h
> > +++ b/drivers/gpu/drm/msm/msm_gem.h
> > @@ -61,6 +61,7 @@ struct msm_gem_vma {
> >  int msm_gem_init_vma(struct msm_gem_address_space *aspace,
> >                 struct msm_gem_vma *vma, int npages,
> >                 u64 range_start, u64 range_end);
> > +bool msm_gem_vma_inuse(struct msm_gem_vma *vma);
> >  void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
> >                 struct msm_gem_vma *vma);
> >  void msm_gem_unmap_vma(struct msm_gem_address_space *aspace,
> > diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
> > index f914ddbaea89..dc2ae097805e 100644
> > --- a/drivers/gpu/drm/msm/msm_gem_vma.c
> > +++ b/drivers/gpu/drm/msm/msm_gem_vma.c
> > @@ -37,6 +37,11 @@ msm_gem_address_space_get(struct msm_gem_address_space *aspace)
> >         return aspace;
> >  }
> >
> > +bool msm_gem_vma_inuse(struct msm_gem_vma *vma)
> > +{
> > +       return !!vma->inuse;
> > +}
>
> It almost  asks to be a static inline. The patch 04 makes it complex,
> so it's probably not that important.

yeah, that is the reason I didn't make it static inline

BR,
-R

> > +
> >  /* Actually unmap memory for the vma */
> >  void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
> >                 struct msm_gem_vma *vma)
> > @@ -44,7 +49,7 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
> >         unsigned size = vma->node.size << PAGE_SHIFT;
> >
> >         /* Print a message if we try to purge a vma in use */
> > -       if (WARN_ON(vma->inuse > 0))
> > +       if (GEM_WARN_ON(msm_gem_vma_inuse(vma)))
> >                 return;
> >
> >         /* Don't do anything if the memory isn't mapped */
> > @@ -61,7 +66,7 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace,
> >  void msm_gem_unmap_vma(struct msm_gem_address_space *aspace,
> >                 struct msm_gem_vma *vma)
> >  {
> > -       if (!WARN_ON(!vma->iova))
> > +       if (!GEM_WARN_ON(!vma->iova))
> >                 vma->inuse--;
> >  }
> >
> > @@ -73,7 +78,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace,
> >         unsigned size = npages << PAGE_SHIFT;
> >         int ret = 0;
> >
> > -       if (WARN_ON(!vma->iova))
> > +       if (GEM_WARN_ON(!vma->iova))
> >                 return -EINVAL;
> >
> >         /* Increase the usage counter */
> > @@ -100,7 +105,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace,
> >  void msm_gem_close_vma(struct msm_gem_address_space *aspace,
> >                 struct msm_gem_vma *vma)
> >  {
> > -       if (WARN_ON(vma->inuse > 0 || vma->mapped))
> > +       if (GEM_WARN_ON(msm_gem_vma_inuse(vma) || vma->mapped))
> >                 return;
> >
> >         spin_lock(&aspace->lock);
> > @@ -120,7 +125,7 @@ int msm_gem_init_vma(struct msm_gem_address_space *aspace,
> >  {
> >         int ret;
> >
> > -       if (WARN_ON(vma->iova))
> > +       if (GEM_WARN_ON(vma->iova))
> >                 return -EBUSY;
> >
> >         spin_lock(&aspace->lock);
> > --
> > 2.35.1
> >
>
>
> --
> With best wishes
> Dmitry

  reply	other threads:[~2022-03-30 17:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 23:00 [PATCH 0/9] drm/msm: Userspace allocated GPU addresses Rob Clark
2022-03-29 23:00 ` [PATCH 1/9] drm/msm/gem: Move prototypes Rob Clark
2022-03-29 23:09   ` Dmitry Baryshkov
2022-03-29 23:00 ` [PATCH 2/9] drm/msm/gpu: Drop duplicate fence counter Rob Clark
2022-03-29 23:00 ` [PATCH 3/9] drm/msm/gem: Split out inuse helper Rob Clark
2022-03-30 11:32   ` Dmitry Baryshkov
2022-03-30 17:32     ` Rob Clark [this message]
2022-03-29 23:00 ` [PATCH 4/9] drm/msm/gem: Drop PAGE_SHIFT for address space mm Rob Clark
2022-03-29 23:12   ` Dmitry Baryshkov
2022-03-29 23:00 ` [PATCH 5/9] drm/msm: Drop msm_gem_iova() Rob Clark
2022-03-30 11:27   ` Dmitry Baryshkov
2022-03-29 23:00 ` [PATCH 6/9] drm/msm/gem: Rework vma lookup and pin Rob Clark
2022-03-29 23:00 ` [PATCH 7/9] drm/msm/gem: Split " Rob Clark
2022-03-29 23:00 ` [PATCH 8/9] drm/msm/gem: Add fenced vma unpin Rob Clark
2022-03-29 23:00 ` [PATCH 9/9] drm/msm: Add a way for userspace to allocate GPU iova Rob Clark
2022-03-29 23:17   ` Dmitry Osipenko
2022-03-29 23:42   ` Dmitry Baryshkov
2022-03-30  2:58     ` Rob Clark

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=CAF6AEGtkpF5MLza0LY_AJsC4vu1nAzXZ5xv4Eusz+Bpp6GFXRA@mail.gmail.com \
    --to=robdclark@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@chromium.org \
    --cc=sean@poorly.run \
    /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

all inboxes | Powered by JetHome®