Skip to contentSkip to conversation

xen/arm: create_p2m_entries has to flush TLBs on every CPU

PATCH Superseded Julien Grall 2 participants 3 messages Apr 18, 2014 – Apr 23, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: create_p2m_entries has to flush TLBs on every CPU

The function create_p2m_entries creates mappings in second-level page tables which is shared between every CPU.

Only flushing TLBs on local processor may result to wrong behaviour when io{re,un}map is used.

---

This patch is candidate to be backported to Xen 4.4.

create_p2m_entries is only used by vmap ( iore{,un}map functions.

Upstream Xen 4.4 calls these functions only when 1 CPU is online so it's "safe". People might want to use them when multiple CPUs are online.

Ian: Do you plan to backport your tlb series? If not, this patch will have to slighty change because Xen 4.4 doesn't have TLBs helper to flush xen data on every cpus.

---
 xen/arch/arm/mm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/mm.c +1 -1
index 362bc8d..eac228c 100644
@@ -845,7 +845,7 @@ static int create_xen_entries(enum xenmap_operation op,
                 BUG();
         }
     }
-    flush_xen_data_tlb_range_va_local(virt, PAGE_SIZE * nr_mfns);
+    flush_xen_data_tlb_range_va(virt, PAGE_SIZE * nr_mfns);
 
     rc = 0;
 
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Julien Grall

The function create_p2m_entries creates mappings in second-level page tables which is shared between every CPU.

You say create_p2m_entries twice but then patch create_xen_entries. Is it the patch or the description which is wrong?

Quoted 10 lines

Only flushing TLBs on local processor may result to wrong behaviour when io{re,un}map is used.

From this sounds like it's the desription?

---

This patch is candidate to be backported to Xen 4.4.

Quoted 8 lines

create_p2m_entries is only used by vmap ( iore{,un}map functions.

Upstream Xen 4.4 calls these functions only when 1 CPU is online so it's "safe". People might want to use them when multiple CPUs are online.

Ian: Do you plan to backport your tlb series? If not, this patch will have to slighty change because Xen 4.4 doesn't have TLBs helper to flush xen data on every cpus.

I wasn't planning to backport the tlb series, but I could look at backporting the required bits I suppose.

However, is it needed? Does 4.4 make any ioremap calls where this would actually hurt? I think all the uses in xen/arch/arm/platforms/*.c are short lived and only accessed from the current cpu. The one in xen/drivers/video/arm_hdlcd.c is done before we go SMP anyway.

Ian.

#2 lore raw

Hi Ian,

Quoted 6 lines · Ian Campbell
Quoted 2 lines · Julien Grall

The function create_p2m_entries creates mappings in second-level page tables which is shared between every CPU.

You say create_p2m_entries twice but then patch create_xen_entries. Is it the patch or the description which is wrong?

The description is wrong, sorry. I will send a new version of this patch.

Quoted 20 lines
Quoted 3 lines

Only flushing TLBs on local processor may result to wrong behaviour when io{re,un}map is used.

From this sounds like it's the desription?

Quoted 5 lines

---

This patch is candidate to be backported to Xen 4.4.

Quoted 8 lines

create_p2m_entries is only used by vmap ( iore{,un}map functions.

Upstream Xen 4.4 calls these functions only when 1 CPU is online so it's "safe". People might want to use them when multiple CPUs are online.

Ian: Do you plan to backport your tlb series? If not, this patch will have to slighty change because Xen 4.4 doesn't have TLBs helper to flush xen data on every cpus.

Quoted 7 lines

I wasn't planning to backport the tlb series, but I could look at backporting the required bits I suppose.

However, is it needed? Does 4.4 make any ioremap calls where this would actually hurt? I think all the uses in xen/arch/arm/platforms/*.c are short lived and only accessed from the current cpu. The one in xen/drivers/video/arm_hdlcd.c is done before we go SMP anyway.

There is some in serials drivers. I was thinking about people making product based Xen 4.4. They might use io{re,un}map in their own code with all CPUs up.

Regards,

Signature · 1 line
Julien Grall