From patchwork Sat Feb 12 16:18:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 551791 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1CGIp65012324 for ; Sat, 12 Feb 2011 16:18:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751014Ab1BLQSt (ORCPT ); Sat, 12 Feb 2011 11:18:49 -0500 Received: from hiauly1.hia.nrc.ca ([132.246.10.84]:2942 "EHLO hiauly1.hia.nrc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881Ab1BLQSs (ORCPT ); Sat, 12 Feb 2011 11:18:48 -0500 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id 404A14ED8; Sat, 12 Feb 2011 11:18:47 -0500 (EST) Date: Sat, 12 Feb 2011 11:18:46 -0500 From: John David Anglin To: James.Bottomley@HansenPartnership.com, dave.anglin@nrc-cnrc.gc.ca, linux-parisc@vger.kernel.org Subject: Re: [PATCH] parisc: Improve dcache flush on PA8800/PA8900 Message-ID: <20110212161846.GA24076@hiauly1.hia.nrc.ca> Reply-To: John David Anglin References: <20110210170033.4317E4ED8@hiauly1.hia.nrc.ca> <20110210200044.203164E01@hiauly1.hia.nrc.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110210200044.203164E01@hiauly1.hia.nrc.ca> Organization: nrc.ca User-Agent: Mutt/1.5.16 (2007-06-09) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 12 Feb 2011 16:18:51 +0000 (UTC) diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index 3f11331..e57c3e8 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -75,14 +75,16 @@ EXPORT_SYMBOL(flush_cache_all_local); void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { - struct page *page = pte_page(*ptep); + unsigned long pfn = pte_pfn(*ptep); + struct page *page; - if (pfn_valid(page_to_pfn(page)) && page_mapping(page) && - test_bit(PG_dcache_dirty, &page->flags)) { + if (!pfn_valid(pfn)) + return; - flush_kernel_dcache_page(page); - clear_bit(PG_dcache_dirty, &page->flags); - } else if (parisc_requires_coherency()) + page = pfn_to_page(pfn); + + if (test_and_clear_bit(PG_dcache_dirty, &page->flags) + || parisc_requires_coherency()) flush_kernel_dcache_page(page); } diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index c9b9322..f0cb56e 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c @@ -92,11 +92,12 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, { if (len > TASK_SIZE) return -ENOMEM; - /* Might want to check for cache aliasing issues for MAP_FIXED case - * like ARM or MIPS ??? --BenH. - */ - if (flags & MAP_FIXED) + if (flags & MAP_FIXED) { + if ((flags & MAP_SHARED) && + (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)) + return -EINVAL; return addr; + } if (!addr) addr = TASK_UNMAPPED_BASE;