lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140316094650.GV21483@n2100.arm.linux.org.uk>
Date:	Sun, 16 Mar 2014 09:46:50 +0000
From:	Russell King - ARM Linux <linux@....linux.org.uk>
To:	Sebastian Capella <sebastian.capella@...aro.org>
Cc:	Stephen Boyd <sboyd@...eaurora.org>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linaro-kernel@...ts.linaro.org" <linaro-kernel@...ts.linaro.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	Len Brown <len.brown@...el.com>,
	Jonathan Austin <jonathan.austin@....com>,
	Victor Kamensky <victor.kamensky@...aro.org>,
	Nicolas Pitre <nico@...aro.org>,
	Will Deacon <will.deacon@....com>,
	Uwe Kleine-K??nig <u.kleine-koenig@...gutronix.de>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Laura Abbott <lauraa@...eaurora.org>,
	Sricharan R <r.sricharan@...com>,
	Ben Dooks <ben.dooks@...ethink.co.uk>,
	Russ Dill <Russ.Dill@...com>,
	Catalin Marinas <catalin.marinas@....com>,
	Santosh Shilimkar <santosh.shilimkar@...com>,
	Stefano Stabellini <stefano.stabellini@...citrix.com>,
	Jiang Liu <liuj97@...il.com>
Subject: Re: [PATCH v7 2/2] ARM hibernation / suspend-to-disk

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ