aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/s390/mm/gmap.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2016-04-15 12:45:45 +0200
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-20 09:54:18 +0200
commiteea3678d4334925bf838e6f4bc88760811a84cd6 (patch)
treeb2f259d685344030fde9d7cb7312d2e330d223a0 /arch/s390/mm/gmap.c
parents390/mm: add kvm shadow fault function (diff)
downloadwireguard-linux-eea3678d4334925bf838e6f4bc88760811a84cd6.tar.xz
wireguard-linux-eea3678d4334925bf838e6f4bc88760811a84cd6.zip
s390/mm: flush tlb of shadows in all situations
For now, the tlb of shadow gmap is only flushed when the parent is removed, not when it is removed upfront. Therefore other shadow gmaps can reuse the tables without the tlb getting flushed. Fix this by simply flushing the tlb 1. Before the shadow tables are removed (analogouos to other unshadow functions) 2. When the gmap is freed and therefore the top level pages are freed. Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/gmap.c')
-rw-r--r--arch/s390/mm/gmap.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 6695a09a3885..b02d0d0cc641 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -173,6 +173,9 @@ static void gmap_free(struct gmap *gmap)
{
struct page *page, *next;
+ /* Flush tlb of all gmaps (if not already done for shadows) */
+ if (!(gmap_is_shadow(gmap) && gmap->removed))
+ gmap_flush_tlb(gmap);
/* Free all segment & region tables. */
list_for_each_entry_safe(page, next, &gmap->crst_list, lru)
__free_pages(page, 2);
@@ -226,13 +229,10 @@ void gmap_remove(struct gmap *gmap)
{
struct gmap *sg, *next;
- /* Flush tlb. */
- gmap_flush_tlb(gmap);
/* Remove all shadow gmaps linked to this gmap */
if (!list_empty(&gmap->children)) {
spin_lock(&gmap->shadow_lock);
list_for_each_entry_safe(sg, next, &gmap->children, list) {
- gmap_flush_tlb(sg);
list_del(&sg->list);
gmap_put(sg);
}
@@ -1360,6 +1360,7 @@ static void gmap_unshadow(struct gmap *sg)
return;
sg->removed = 1;
gmap_call_notifier(sg, 0, -1UL);
+ gmap_flush_tlb(sg);
table = (unsigned long *)(sg->asce & _ASCE_ORIGIN);
switch (sg->asce & _ASCE_TYPE_MASK) {
case _ASCE_TYPE_REGION1: