From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbaCPJrW (ORCPT ); Sun, 16 Mar 2014 05:47:22 -0400 Received: from gw-1.arm.linux.org.uk ([78.32.30.217]:54037 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751080AbaCPJrU (ORCPT ); Sun, 16 Mar 2014 05:47:20 -0400 Date: Sun, 16 Mar 2014 09:46:50 +0000 From: Russell King - ARM Linux To: Sebastian Capella Cc: Stephen Boyd , Linux Kernel , "linux-pm@vger.kernel.org" , "linaro-kernel@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , Len Brown , Jonathan Austin , Victor Kamensky , Nicolas Pitre , Will Deacon , Uwe Kleine-K??nig , "Rafael J. Wysocki" , Laura Abbott , Sricharan R , Ben Dooks , Russ Dill , Catalin Marinas , Santosh Shilimkar , Stefano Stabellini , Jiang Liu Subject: Re: [PATCH v7 2/2] ARM hibernation / suspend-to-disk Message-ID: <20140316094650.GV21483@n2100.arm.linux.org.uk> References: <1394016605-24120-1-git-send-email-sebastian.capella@linaro.org> <1394016605-24120-3-git-send-email-sebastian.capella@linaro.org> <20140307044251.GD9985@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 10, 2014 at 11:32:17AM -0700, Sebastian Capella wrote: > I've moved to this second implementation. I don't think I understand > the ramifications enough to add the virt_to_pfn call for arm. Let's look at the implementations... #define __pa(x) __virt_to_phys((unsigned long)(x)) static inline phys_addr_t __virt_to_phys(unsigned long x) { return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET; } So, __pa() returns a phys_addr_t (which may be either 32-bit or 64-bit). #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) And that will do an appropriate shift to convert the phys_addr_t to a PFN, which will be fine to assign to an unsigned long variable. #define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT)) This does the same thing, but has an explicit cast. So, the only difference between the two suggestions is that additional cast, which has no effect here. > I've changed one thing. __nosave_end is pointing at the first byte > not included in the nosave region. I subtracted one from it so that > we make sure we're referring to the last pfn, and left the pfn > comparison as you'd suggested. Yes, that should be safer. -- FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.