Thread (9 messages) flat view 9 messages, 3 authors, 2017-08-30

Re: [PATCH v3 2/3] cxl: Mark context requiring global TLBIs

From: Alistair Popple <hidden>
Date: 2017-08-22 03:10:11

On Thu, 3 Aug 2017 05:22:31 PM Balbir Singh wrote:
On Thu, Aug 3, 2017 at 6:29 AM, Frederic Barrat
[off-list ref] wrote:
quoted
The PSL and XSL need to see all TLBIs pertinent to the memory contexts
used on the adapter. For the hash memory model, it is done by making
all TLBIs global as soon as the cxl driver is in use. For radix, we
need something similar, but we can refine and only convert to global
the invalidations for contexts actually used by the device.

So mark the contexts being attached to the cxl adapter as requiring
global TLBIs.
Looking at these bits, I'm wondering the previous code should check
for CONFIG_CXL in mm_is_invalidation_local? That would pretty much cover
BOOK3S_64
That won't work as we also need this for other nest MMU users which might
not have CONFIG_CXL set - for example the NPU the will use
mm_context_set_global_tlbi() for processes on the GPU.

Regards,

Alistair
quoted
Signed-off-by: Frederic Barrat <redacted>
---
 drivers/misc/cxl/api.c    | 12 ++++++++++--
 drivers/misc/cxl/cxllib.c |  7 +++++++
 drivers/misc/cxl/file.c   | 12 ++++++++++--
 3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 1a138c83f877..d3f3fdede755 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -332,8 +332,17 @@ int cxl_start_context(struct cxl_context *ctx, u64 wed,
                cxl_context_mm_count_get(ctx);

                /* decrement the use count */
-               if (ctx->mm)
+               if (ctx->mm) {
                        mmput(ctx->mm);
+#ifdef CONFIG_PPC_BOOK3S_64
+                       mm_context_set_global_tlbi(&ctx->mm->context);
Do we have CXL for non PPC_BOOK3S_64?
quoted
+                       /*
+                        * Barrier guarantees that the device will
+                        * receive all TLBIs from that point on
+                        */
+                       wmb();
smp_wmb();
quoted
+#endif
+               }
        }
The other comments are the same as this (in the snip'd code)

Balbir
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help