All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: linux-tegra@vger.kernel.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 01/15] drm/tegra: Map cmdbuf once for reloc processing
Date: Mon, 25 Nov 2019 12:02:40 +0100	[thread overview]
Message-ID: <20191125110240.GH1409040@ulmo> (raw)
Message-ID: <20191125110240.ZiWMqdr0Qb2q9JKORwtHZuEO3fSY85pc6EWUXYIZ_Y4@z> (raw)
In-Reply-To: <20191118103536.17675-2-daniel.vetter@ffwll.ch>


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

On Mon, Nov 18, 2019 at 11:35:22AM +0100, Daniel Vetter wrote:
> A few reasons to drop kmap:
> 
> - For native objects all we do is look at obj->vaddr anyway, so might
>   as well not call functions for every page.
> 
> - Reloc-processing on dma-buf is ... questionable.
> 
> - Plus most dma-buf that bother kernel cpu mmaps give you at least
>   vmap, much less kmaps. And all the ones relevant for arm-soc are
>   again doing a obj->vaddr game anyway, there's no real kmap going on
>   on arm it seems.
> 
> Plus this seems to be the only real in-tree user of dma_buf_kmap, and
> I'd like to get rid of that.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: linux-tegra@vger.kernel.org
> ---
>  drivers/gpu/host1x/job.c | 21 +++++++--------------
>  1 file changed, 7 insertions(+), 14 deletions(-)

This looks correct to me, and running some of the grate project's tests
against this works just fine, so:

Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>

> diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
> index 25ca54de8fc5..60b2fedd0061 100644
> --- a/drivers/gpu/host1x/job.c
> +++ b/drivers/gpu/host1x/job.c
> @@ -244,8 +244,7 @@ static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
>  
>  static int do_relocs(struct host1x_job *job, struct host1x_job_gather *g)
>  {
> -	u32 last_page = ~0;
> -	void *cmdbuf_page_addr = NULL;
> +	void *cmdbuf_addr = NULL;
>  	struct host1x_bo *cmdbuf = g->bo;
>  	unsigned int i;
>  
> @@ -267,28 +266,22 @@ static int do_relocs(struct host1x_job *job, struct host1x_job_gather *g)
>  			goto patch_reloc;
>  		}
>  
> -		if (last_page != reloc->cmdbuf.offset >> PAGE_SHIFT) {
> -			if (cmdbuf_page_addr)
> -				host1x_bo_kunmap(cmdbuf, last_page,
> -						 cmdbuf_page_addr);
> +		if (!cmdbuf_addr) {
> +			cmdbuf_addr = host1x_bo_mmap(cmdbuf);
>  
> -			cmdbuf_page_addr = host1x_bo_kmap(cmdbuf,
> -					reloc->cmdbuf.offset >> PAGE_SHIFT);
> -			last_page = reloc->cmdbuf.offset >> PAGE_SHIFT;
> -
> -			if (unlikely(!cmdbuf_page_addr)) {
> +			if (unlikely(!cmdbuf_addr)) {
>  				pr_err("Could not map cmdbuf for relocation\n");
>  				return -ENOMEM;
>  			}
>  		}
>  
> -		target = cmdbuf_page_addr + (reloc->cmdbuf.offset & ~PAGE_MASK);
> +		target = cmdbuf_addr + reloc->cmdbuf.offset;
>  patch_reloc:
>  		*target = reloc_addr;
>  	}
>  
> -	if (cmdbuf_page_addr)
> -		host1x_bo_kunmap(cmdbuf, last_page, cmdbuf_page_addr);
> +	if (cmdbuf_addr)
> +		host1x_bo_munmap(cmdbuf, cmdbuf_addr);
>  
>  	return 0;
>  }
> -- 
> 2.24.0
> 

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

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

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

  parent reply	other threads:[~2019-11-25 11:02 UTC|newest]

Thread overview: 145+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 10:35 [PATCH 00/15] Retire dma_buf_k(un)map Daniel Vetter
2019-11-18 10:35 ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35 ` [PATCH 01/15] drm/tegra: Map cmdbuf once for reloc processing Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-25  9:58   ` Daniel Vetter
2019-11-25  9:58     ` [Intel-gfx] " Daniel Vetter
2019-11-25  9:58     ` Daniel Vetter
2019-11-25 10:47     ` Thierry Reding
2019-11-25 10:47       ` [Intel-gfx] " Thierry Reding
2019-11-25 10:47       ` Thierry Reding
2019-11-25 11:02   ` Thierry Reding [this message]
2019-11-25 11:02     ` [Intel-gfx] " Thierry Reding
2019-11-25 11:02     ` Thierry Reding
2019-11-18 10:35 ` [PATCH 02/15] drm/tegra: Delete host1x_bo_ops->k(un)map Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-25 11:04   ` Thierry Reding
2019-11-25 11:04     ` [Intel-gfx] " Thierry Reding
2019-11-25 11:04     ` Thierry Reding
2019-11-18 10:35 ` [PATCH 03/15] drm/i915: Remove dma_buf_kmap selftest Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 12:58   ` Chris Wilson
2019-11-18 12:58     ` [Intel-gfx] " Chris Wilson
2019-11-18 12:58     ` Chris Wilson
2019-11-18 10:35 ` [PATCH 04/15] staging/android/ion: delete dma_buf->kmap/unmap implemenation Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 11:26   ` Greg KH
2019-11-18 11:26     ` [Intel-gfx] " Greg KH
2019-11-18 11:26     ` Greg KH
2019-11-18 11:26     ` Greg KH
2019-11-18 14:55   ` Laura Abbott
2019-11-18 14:55     ` [Intel-gfx] " Laura Abbott
2019-11-18 14:55     ` Laura Abbott
2019-11-18 10:35 ` [PATCH 05/15] drm/armada: Delete dma_buf->k(un)map implemenation Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-25 21:44   ` Daniel Vetter
2019-11-25 21:44     ` [Intel-gfx] " Daniel Vetter
2019-11-26  0:35     ` Russell King - ARM Linux admin
2019-11-26  0:35       ` [Intel-gfx] " Russell King - ARM Linux admin
2019-11-26  8:33       ` Daniel Vetter
2019-11-26  8:33         ` [Intel-gfx] " Daniel Vetter
2019-11-26  8:33         ` Daniel Vetter
2019-11-18 10:35 ` [PATCH 06/15] drm/i915: Drop dma_buf->k(un)map Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 11:38   ` Christian König
2019-11-18 11:38     ` [Intel-gfx] " Christian König
2019-11-18 11:38     ` Christian König
2019-11-18 12:53   ` Chris Wilson
2019-11-18 12:53     ` [Intel-gfx] " Chris Wilson
2019-11-18 12:53     ` Chris Wilson
2019-11-18 10:35 ` [PATCH 07/15] drm/omapdrm: " Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 12:44   ` Tomi Valkeinen
2019-11-18 12:44     ` [Intel-gfx] " Tomi Valkeinen
2019-11-18 12:44     ` Tomi Valkeinen
2019-11-18 10:35 ` [PATCH 08/15] drm/tegra: Remove dma_buf->k(un)map Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-25 11:06   ` Thierry Reding
2019-11-25 11:06     ` [Intel-gfx] " Thierry Reding
2019-11-18 10:35 ` [PATCH 09/15] dma-buf: Drop dma_buf_k(un)map Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:35 ` [PATCH 10/15] drm/vmwgfx: Delete mmaping functions Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 17:25   ` Thomas Hellstrom
2019-11-18 17:25     ` [Intel-gfx] " Thomas Hellstrom
2019-11-18 17:25     ` Thomas Hellstrom
2019-11-18 17:42     ` Daniel Vetter
2019-11-18 17:42       ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35 ` [PATCH 11/15] media/videobuf2: Drop dma_buf->k(un)map support Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:58   ` Marek Szyprowski
2019-11-18 10:58     ` [Intel-gfx] " Marek Szyprowski
2019-11-18 10:58     ` Marek Szyprowski
2019-11-18 10:58     ` Marek Szyprowski
2019-11-18 11:02   ` Hans Verkuil
2019-11-18 11:02     ` [Intel-gfx] " Hans Verkuil
2019-11-18 11:02     ` Hans Verkuil
2019-11-18 10:35 ` [PATCH 12/15] drm/tee_shm: Drop dma_buf_k(unmap) support Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 11:26   ` Greg Kroah-Hartman
2019-11-18 11:26     ` [Intel-gfx] " Greg Kroah-Hartman
2019-11-18 12:02   ` Jens Wiklander
2019-11-18 12:02     ` [Intel-gfx] " Jens Wiklander
2019-11-18 12:02     ` Jens Wiklander
2019-11-18 10:35 ` [PATCH 13/15] xen/gntdev-dmabuf: Ditch dummy map functions Daniel Vetter
2019-11-18 10:35   ` [Xen-devel] " Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:50   ` [Xen-devel] " Oleksandr Andrushchenko
2019-11-18 10:50     ` Oleksandr Andrushchenko
2019-11-18 10:50     ` [Intel-gfx] " Oleksandr Andrushchenko
2019-11-18 10:50     ` Oleksandr Andrushchenko
2019-11-18 10:53   ` Jürgen Groß
2019-11-18 10:53     ` [Xen-devel] " Jürgen Groß
2019-11-18 10:53     ` [Intel-gfx] " Jürgen Groß
2019-11-18 10:53     ` Jürgen Groß
2019-11-18 10:35 ` [PATCH 14/15] sample/vfio-mdev/mbocs: Remove dma_buf_k(un)map support Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 11:41   ` Gerd Hoffmann
2019-11-18 11:41     ` [Intel-gfx] " Gerd Hoffmann
2019-11-18 11:41     ` Gerd Hoffmann
2019-11-18 11:41     ` Gerd Hoffmann
2019-11-18 10:35 ` [PATCH 15/15] dma-buf: Remove kernel map/unmap hooks Daniel Vetter
2019-11-18 10:35   ` [Intel-gfx] " Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 10:35   ` Daniel Vetter
2019-11-18 15:22   ` kbuild test robot
2019-11-18 15:22     ` kbuild test robot
2019-11-18 15:22     ` [Intel-gfx] " kbuild test robot
2019-11-18 15:22     ` kbuild test robot
2019-11-18 15:22     ` kbuild test robot
2019-11-18 16:43     ` Daniel Vetter
2019-11-18 16:43       ` Daniel Vetter
2019-11-18 16:43       ` [Intel-gfx] " Daniel Vetter
2019-11-18 16:43       ` Daniel Vetter
2019-11-25  0:46       ` [kbuild-all] " Rong Chen
2019-11-25  0:46         ` Rong Chen
2019-11-25  0:46         ` [Intel-gfx] [kbuild-all] " Rong Chen
2019-11-25  0:46         ` Rong Chen
2019-11-26 10:54   ` Daniel Vetter
2019-11-26 10:54     ` [Intel-gfx] " Daniel Vetter
2019-11-26 10:54     ` Daniel Vetter
2019-11-18 12:36 ` ✗ Fi.CI.CHECKPATCH: warning for Retire dma_buf_k(un)map Patchwork
2019-11-18 12:36   ` [Intel-gfx] " Patchwork
2019-11-18 13:01 ` ✓ Fi.CI.BAT: success " Patchwork
2019-11-18 13:01   ` [Intel-gfx] " Patchwork
2019-11-18 15:58 ` [PATCH 00/15] " Sumit Semwal
2019-11-18 15:58   ` [Intel-gfx] " Sumit Semwal
2019-11-18 15:58   ` Sumit Semwal
2019-11-18 18:45 ` ✓ Fi.CI.IGT: success for " Patchwork
2019-11-18 18:45   ` [Intel-gfx] " Patchwork

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=20191125110240.GH1409040@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-tegra@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.