From patchwork Thu Jan 14 21:30:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 8035481 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA4139F716 for ; Thu, 14 Jan 2016 21:34:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E22D0204D9 for ; Thu, 14 Jan 2016 21:34:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB56620211 for ; Thu, 14 Jan 2016 21:34:54 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJpUQ-0004M3-1W; Thu, 14 Jan 2016 21:31:30 +0000 Received: from pandora.arm.linux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJpUK-0004F4-QY for linux-arm-kernel@lists.infradead.org; Thu, 14 Jan 2016 21:31:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=vt/na+eFiyDkCQbPwFUpKB51n5Us9raN/vKAq8JiYII=; b=QvYLD6w5pQbMswVYG5jH+E6XOJTtyxzHAumErvoTAf0cTJxGpkcGD1ZUv/vRnN/ljhUeEtnkQhCV4kAy6NP7C+nYc5pPBXzjtsmgvJt2vbUV1DrcaB2HyOr1rgKg9o3LBxqm7abJo4FpIyIt3z7AiAmuDbopwu6xnIFJt3MrT8I=; Received: from n2100.arm.linux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:53179) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1aJpTo-0001N5-Am; Thu, 14 Jan 2016 21:30:52 +0000 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1aJpTk-0005um-K3; Thu, 14 Jan 2016 21:30:48 +0000 Date: Thu, 14 Jan 2016 21:30:48 +0000 From: Russell King - ARM Linux To: Grygorii Strashko Subject: Re: [4.4-rc6-rt1 PATCH 0/2] ARM: am437x: boot test report Message-ID: <20160114213048.GB19062@n2100.arm.linux.org.uk> References: <1451325611-21678-1-git-send-email-grygorii.strashko@ti.com> <20160112171556.GB31009@linutronix.de> <569637ED.1030304@ti.com> <5696B025.8020909@ti.com> <569800DD.7090102@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <569800DD.7090102@ti.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160114_133125_251984_FF22A3FB X-CRM114-Status: GOOD ( 15.18 ) X-Spam-Score: -4.3 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Andrzej Siewior , Sekhar Nori , linux-rt-users@vger.kernel.org, linux-arm , linux-kernel@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Jan 14, 2016 at 10:11:09PM +0200, Grygorii Strashko wrote: > diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c > index deabc36..b9b4f9c 100644 > --- a/arch/arm/mm/highmem.c > +++ b/arch/arm/mm/highmem.c > @@ -167,7 +167,7 @@ void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) > * Clear @prev's kmap_atomic mappings > */ > for (i = 0; i < prev_p->kmap_idx; i++) { > - int idx = i + KM_TYPE_NR * smp_processor_id(); > + int idx = FIX_KMAP_BEGIN + i + KM_TYPE_NR * smp_processor_id(); > > set_fixmap_pte(idx, __pte(0)); > } > @@ -175,7 +175,7 @@ void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) > * Restore @next_p's kmap_atomic mappings > */ > for (i = 0; i < next_p->kmap_idx; i++) { > - int idx = i + KM_TYPE_NR * smp_processor_id(); > + int idx = FIX_KMAP_BEGIN + i + KM_TYPE_NR * smp_processor_id(); > > if (!pte_none(next_p->kmap_pte[i])) > set_fixmap_pte(idx, next_p->kmap_pte[i]); This looks like it introduces the 4th and 5th copies of the same calcuation, so can I suggest that we do this to prevent this kind of error? Signed-off-by: Russell King diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index d02f8187b1cc..61f0d5941116 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c @@ -34,6 +34,11 @@ static inline pte_t get_fixmap_pte(unsigned long vaddr) return *ptep; } +static unsigned int fixmap_idx(int type) +{ + return FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); +} + void *kmap(struct page *page) { might_sleep(); @@ -79,7 +84,7 @@ void *kmap_atomic(struct page *page) type = kmap_atomic_idx_push(); - idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); + idx = fixmap_idx(type); vaddr = __fix_to_virt(idx); #ifdef CONFIG_DEBUG_HIGHMEM /* @@ -106,7 +111,7 @@ void __kunmap_atomic(void *kvaddr) if (kvaddr >= (void *)FIXADDR_START) { type = kmap_atomic_idx(); - idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); + idx = fixmap_idx(type); if (cache_is_vivt()) __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); @@ -138,7 +143,7 @@ void *kmap_atomic_pfn(unsigned long pfn) return page_address(page); type = kmap_atomic_idx_push(); - idx = FIX_KMAP_BEGIN + type + KM_TYPE_NR * smp_processor_id(); + idx = fixmap_idx(type); vaddr = __fix_to_virt(idx); #ifdef CONFIG_DEBUG_HIGHMEM BUG_ON(!pte_none(get_fixmap_pte(vaddr)));