Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932219AbcCCDDs (ORCPT ); Wed, 2 Mar 2016 22:03:48 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:39749 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932191AbcCCDDq (ORCPT ); Wed, 2 Mar 2016 22:03:46 -0500 Message-ID: <56D7A987.5040602@imgtec.com> Date: Wed, 2 Mar 2016 19:03:35 -0800 From: Leonid Yegoshin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Paul Burton , CC: Lars Persson , "stable # v4 . 1+" , "Steven J. Hill" , "David Daney" , Huacai Chen , "Aneesh Kumar K.V" , , Andrew Morton , Jerome Marchand , "Kirill A. Shutemov" , Ralf Baechle Subject: Re: [4/4] MIPS: Sync icache & dcache in set_pte_at References: <1456799879-14711-5-git-send-email-paul.burton@imgtec.com> In-Reply-To: <1456799879-14711-5-git-send-email-paul.burton@imgtec.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.20.3.92] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1289 Lines: 40 Paul Burton wrote: > It is, however, used in such a way by others & seems to me like the only > correct way to implement the lazy cache flushing. The alternative would > be to adjust all generic code to ensure flush_icache_page gets called > before set_pte_at ... which is an exact case right now. Both calls of flush_icache_page() are: 1) do_swap_page() flush_icache_page(vma, page); if (pte_swp_soft_dirty(orig_pte)) pte = pte_mksoft_dirty(pte); set_pte_at(mm, address, page_table, pte); ... 2) do_set_pte() flush_icache_page(vma, page); entry = mk_pte(page, vma->vm_page_prot); if (write) entry = maybe_mkwrite(pte_mkdirty(entry), vma); if (anon) { inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES); page_add_new_anon_rmap(page, vma, address); } else { inc_mm_counter_fast(vma->vm_mm, MM_FILEPAGES); page_add_file_rmap(page); } set_pte_at(vma->vm_mm, address, pte, entry); /* no need to invalidate: a not-present page won't be cached */ update_mmu_cache(vma, address, pte); .... You should only be sure that flush_icache_page() completes a lazy D-cache flush. - Leonid.