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: <20150811125556.GD3402@lst.de>
Date:	Tue, 11 Aug 2015 14:55:56 +0200
From:	Christoph Hellwig <hch@....de>
To:	Dan Williams <dan.j.williams@...el.com>
Cc:	linux-kernel@...r.kernel.org, ross.zwisler@...ux.intel.com,
	mcgrof@...e.com, hch@....de, linux-nvdimm@...ts.01.org
Subject: Re: [PATCH v4 08/10] pmem: convert to generic memremap

On Mon, Aug 10, 2015 at 11:38:33PM -0400, Dan Williams wrote:
> Update memremap_pmem() to query the architecture for the mapping type of
> the given persistent memory range  and then pass those flags to generic
> memremap().  arch_memremap_pmem_flags() is provided an address range to
> evaluate in the event an arch has a need for different mapping types by
> address range.  For example the ACPI NFIT carries EFI mapping types in
> its memory range description table.
> 
> Cc: Ross Zwisler <ross.zwisler@...ux.intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>

Looks generally good, but a little nipick related to my comment
from two patches ago:

> +unsigned long arch_memremap_pmem_flags(resource_size_t offset, size_t size)
> +{
> +	/*
> +	 * The expectation is that pmem is always WB capable range on
> +	 * x86, i.e. no need to walk the range.
> +	 */
> +	return MEMREMAP_WB;
> +}
> +EXPORT_SYMBOL(arch_memremap_pmem_flags);

Why not just add a 

/*
 * The expectation is that pmem is always WB capable range on x86, i.e. no
 * need to walk the range.
 */
#define ARCH_MEMREMAP_PMEM	MEMREMAP_WB

in io.h, and then kill all these little pmem wrappers and:

>  static inline void __pmem *memremap_pmem(resource_size_t offset,
>  		unsigned long size)
>  {
> +	unsigned long flags;
> +
>  	if (arch_has_pmem_api())
> -		return arch_memremap_pmem(offset, size);
> -	return default_memremap_pmem(offset, size);
> +		flags = arch_memremap_pmem_flags(offset, size);
> +	else
> +		flags = default_memremap_pmem_flags();
> +
> +	return (void __pmem *) memremap(offset, size, flags);

#ifdef ARCH_MEMREMAP_PMEM
	return (void __pmem *) memremap(offset, size, ARCH_MEMREMAP_PMEM);
#else
	return (void __pmem *) memremap(offset, size, MEMREMAP_WT);
#endif

--
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