Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1454822

[PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization follow-up

From Rafael Aquini <aquini@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization follow-up
Date 2016-08-02 17:50 +0200
Message-ID <s1K79-6pf-41@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


While backporting 71b3c126e611 ("x86/mm: Add barriers and document switch_mm()-vs-flush synchronization")
we stumbled across a possibly missing barrier at flush_tlb_page().

Following the reasoning presented while introducing the synchronization
barrier at flush_tlb_mm_range(), for the current->active_mm != mm checkpoint:

        if (current->active_mm != mm) {
                /* Synchronize with switch_mm. */
                smp_mb();

                goto out;
        }

it suggests the same barrier should be introduced for the similar
outcome at flush_tlb_page(). This patch add that mentioned missing
barrier and documents its case.

Suggested-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Rafael Aquini <aquini@redhat.com>
---
 arch/x86/mm/tlb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 4dbe656..3b4addc 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -375,6 +375,12 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long start)
 			/* Synchronize with switch_mm. */
 			smp_mb();
 		}
+	} else {
+		/*
+		 * current->active_mm != mm
+		 * Synchronize with switch_mm.
+		 */
+		smp_mb();
 	}
 
 	if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids)
-- 
2.5.5

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization follow-up Rafael Aquini <aquini@redhat.com> - 2016-08-02 17:50 +0200
  Re: [PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization follow-up Nadav Amit <nadav.amit@gmail.com> - 2016-08-03 00:30 +0200
    Re: [PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush  synchronization follow-up Andy Lutomirski <luto@amacapital.net> - 2016-08-03 00:50 +0200
    Re: [PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush  synchronization follow-up Rafael Aquini <aquini@redhat.com> - 2016-08-03 01:20 +0200
      Re: [PATCH] x86/mm: Add barriers and document switch_mm()-vs-flush synchronization follow-up Nadav Amit <nadav.amit@gmail.com> - 2016-08-03 02:50 +0200

csiph-web