On Mon, Dec 19, 2016 at 03:18:07PM +0530, Aneesh Kumar K.V wrote:
Reza Arbab <ar...@linux.vnet.ibm.com> writes:
+static void remove_pte_table(pte_t *pte_start, unsigned long addr,
+                            unsigned long end)
+{
+       unsigned long next;
+       pte_t *pte;
+
+       pte = pte_start + pte_index(addr);
+       for (; addr < end; addr = next, pte++) {
+               next = (addr + PAGE_SIZE) & PAGE_MASK;
+               if (next > end)
+                       next = end;
+
+               if (!pte_present(*pte))
+                       continue;
+
+               spin_lock(&init_mm.page_table_lock);
+               pte_clear(&init_mm, addr, pte);
+               spin_unlock(&init_mm.page_table_lock);
+       }
+
+       flush_tlb_mm(&init_mm);

Why call a flush here. we do that at the end of remove_page_table .
Isn't that sufficient ?

This was carried over from the x86 version of the function, where they do flush_tlb_all(). I can experiment to make sure things work without it.

+static void remove_pagetable(unsigned long start, unsigned long end,
+                            unsigned long map_page_size)
+{
+       unsigned long next;
+       unsigned long addr;
+       pgd_t *pgd;
+       pud_t *pud;
+
+       for (addr = start; addr < end; addr = next) {
+               next = pgd_addr_end(addr, end);
+
+               pgd = pgd_offset_k(addr);
+               if (!pgd_present(*pgd))
+                       continue;
+
+               pud = (pud_t *)pgd_page_vaddr(*pgd);
+               remove_pud_table(pud, addr, next, map_page_size);
+               free_pud_table(pud, pgd);
+       }
+
+       flush_tlb_mm(&init_mm);


So we want to flush the full kernel tlb when we do a hotplug ?
May be check using flush_tlb_kernel_range(). Also that flush_tlb_mm() do
check for mm_is_thread_local(). Do we update init_mm correct to handle
that check ? I assume we want a tlbie() here instead of tlbiel() ?

I'll try using flush_tlb_kernel_range() instead. That sure does seem more appropriate.

--
Reza Arbab

Reply via email to