dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: etnaviv@lists.freedesktop.org
Cc: Russell King <linux+etnaviv@armlinux.org.uk>,
	dri-devel@lists.freedesktop.org, kernel@pengutronix.de,
	patchwork-lst@pengutronix.de
Subject: Re: [PATCH v3 8/8] drm/etnaviv: implement per-process address spaces on MMUv2
Date: Fri, 09 Aug 2019 15:45:08 +0200	[thread overview]
Message-ID: <1565358308.2323.65.camel@pengutronix.de> (raw)
In-Reply-To: <20190809120424.32679-8-l.stach@pengutronix.de>

Am Freitag, den 09.08.2019, 14:04 +0200 schrieb Lucas Stach:
> This builds on top of the MMU contexts introduced earlier. Instead of having
> one context per GPU core, each GPU client receives its own context.
> 
> On MMUv1 this still means a single shared pagetable set is used by all
> clients, but on MMUv2 there is now a distinct set of pagetables for each
> client. As the command fetch is also translated via the MMU on MMUv2 the
> kernel command ringbuffer is mapped into each of the client pagetables.
> 
> As the MMU context switch is a bit of a heavy operation, due to the needed
> cache and TLB flushing, this patch implements a lazy way of switching the
> MMU context. The kernel does not have its own MMU context, but reuses the
> last client context for all of its operations. This has some visible impact,
> as the GPU can now only be started once a client has submitted some work and
> we got the client MMU context assigned. Also the MMU context has a different
> lifetime than the general client context, as the GPU might still execute the
> kernel command buffer in the context of a client even after the client has
> completed all GPU work and has been terminated. Only when the GPU is runtime
> suspended or switches to another clients MMU context is the old context
> freed up.
> 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> v3: Don't call etnaviv_cmdbuf_suballoc_unmap when mapping failed.
> ---
[...]
>  	/*
> @@ -308,7 +312,8 @@ void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event)
>  
>  /* Append a command buffer to the ring buffer. */
>  void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
> > -	unsigned int event, struct etnaviv_cmdbuf *cmdbuf)
> > +	struct etnaviv_iommu_context *mmu_context, unsigned int event,
> > +	struct etnaviv_cmdbuf *cmdbuf)
>  {
> >  	struct etnaviv_cmdbuf *buffer = &gpu->buffer;
> >  	unsigned int waitlink_offset = buffer->user_size - 16;
> @@ -317,17 +322,19 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
> >  	bool switch_context = gpu->exec_state != exec_state;
> >  	unsigned int new_flush_seq = READ_ONCE(gpu->mmu_context->flush_seq);
> >  	bool need_flush = gpu->flush_seq != new_flush_seq;
> +	bool switch_mmu_context = gpu->mmu_context != mmu_context;


I screwed up this one during the rework to avoid the flush sequence
race. I'll squash the following into this commit:

--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
@@ -320,9 +320,9 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
        u32 return_target, return_dwords;
        u32 link_target, link_dwords;
        bool switch_context = gpu->exec_state != exec_state;
-       unsigned int new_flush_seq = READ_ONCE(gpu->mmu_context->flush_seq);
-       bool need_flush = gpu->flush_seq != new_flush_seq;
        bool switch_mmu_context = gpu->mmu_context != mmu_context;
+       unsigned int new_flush_seq = READ_ONCE(gpu->mmu_context->flush_seq);
+       bool need_flush = switch_mmu_context || gpu->flush_seq != new_flush_seq;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-08-09 13:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-09 12:04 [PATCH v3 1/8] drm/etnaviv: simplify unbind checks Lucas Stach
2019-08-09 12:04 ` [PATCH v3 2/8] drm/etnaviv: split out cmdbuf mapping into address space Lucas Stach
2019-08-09 12:04 ` [PATCH v3 3/8] drm/etnaviv: share a single cmdbuf suballoc region across all GPUs Lucas Stach
2019-08-13 14:01   ` Guido Günther
2019-08-09 12:04 ` [PATCH v3 4/8] drm/etnaviv: replace MMU flush marker with flush sequence Lucas Stach
2019-08-09 12:16   ` Philipp Zabel
2019-08-13 18:20   ` Guido Günther
2019-08-09 12:04 ` [PATCH v3 5/8] drm/etnaviv: rework MMU handling Lucas Stach
2019-08-13 15:27   ` Guido Günther
2019-08-09 12:04 ` [PATCH v3 6/8] drm/etnaviv: split out starting of FE idle loop Lucas Stach
2019-08-13 14:21   ` Guido Günther
2019-08-09 12:04 ` [PATCH v3 7/8] drm/etnaviv: provide MMU context to etnaviv_gem_mapping_get Lucas Stach
2019-08-14  9:59   ` Guido Günther
2019-08-15  9:06     ` Lucas Stach
2019-08-09 12:04 ` [PATCH v3 8/8] drm/etnaviv: implement per-process address spaces on MMUv2 Lucas Stach
2019-08-09 12:25   ` Philipp Zabel
2019-08-09 13:45   ` Lucas Stach [this message]
2019-08-14 10:00   ` Guido Günther

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=1565358308.2323.65.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=patchwork-lst@pengutronix.de \
    /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