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: <20141112221021.GC7549@laptop.dumpdata.com>
Date:	Wed, 12 Nov 2014 17:10:21 -0500
From:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To:	Juergen Gross <jgross@...e.com>
Cc:	linux-kernel@...r.kernel.org, xen-devel@...ts.xensource.com,
	david.vrabel@...rix.com, boris.ostrovsky@...cle.com,
	x86@...nel.org, tglx@...utronix.de, mingo@...hat.com, hpa@...or.com
Subject: Re: [PATCH V3 4/8] xen: Delay invalidating extra memory

> @@ -376,12 +374,14 @@ void __init xen_build_dynamic_phys_to_machine(void)
>  	unsigned long max_pfn;
>  	unsigned long pfn;
>  
> -	 if (xen_feature(XENFEAT_auto_translated_physmap))
> +	if (xen_feature(XENFEAT_auto_translated_physmap))

Spurious change.

.. snip..
> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
> index 0e5f9b6..8d5985b 100644
> --- a/arch/x86/xen/setup.c
> +++ b/arch/x86/xen/setup.c
> @@ -75,7 +75,6 @@ static unsigned long xen_remap_mfn __initdata = INVALID_P2M_ENTRY;
>  
>  static void __init xen_add_extra_mem(u64 start, u64 size)
>  {
> -	unsigned long pfn;
>  	int i;
>  
>  	for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
> @@ -95,17 +94,74 @@ static void __init xen_add_extra_mem(u64 start, u64 size)
>  		printk(KERN_WARNING "Warning: not enough extra memory regions\n");
>  
>  	memblock_reserve(start, size);
> +}
>  
> -	xen_max_p2m_pfn = PFN_DOWN(start + size);
> -	for (pfn = PFN_DOWN(start); pfn < xen_max_p2m_pfn; pfn++) {
> -		unsigned long mfn = pfn_to_mfn(pfn);
> +static void __init xen_del_extra_mem(u64 start, u64 size)
> +{
> +	int i;
> +	u64 start_r, size_r;
>  
> -		if (WARN_ONCE(mfn == pfn, "Trying to over-write 1-1 mapping (pfn: %lx)\n", pfn))
> -			continue;
> -		WARN_ONCE(mfn != INVALID_P2M_ENTRY, "Trying to remove %lx which has %lx mfn!\n",
> -			  pfn, mfn);
> +	for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
> +		start_r = xen_extra_mem[i].start;
> +		size_r = xen_extra_mem[i].size;
> +
> +		/* Start of region. */
> +		if (start_r == start) {
> +			BUG_ON(size > size_r);
> +			xen_extra_mem[i].start += size;
> +			xen_extra_mem[i].size -= size;
> +			break;
> +		}
> +		/* End of region. */
> +		if (start_r + size_r == start + size) {
> +			BUG_ON(size > size_r);
> +			xen_extra_mem[i].size -= size;
> +			break;
> +		}
> +		/* Mid of region. */
> +		if (start > start_r && start < start_r + size_r) {
> +			BUG_ON(start + size > start_r + size_r);
> +			xen_extra_mem[i].size = start - start_r;
> +			xen_add_extra_mem(start + size, start_r + size_r -
> +					  (start + size));

Which ends up calling 'memblock_reserve' for an region it already has
reserved. Should we call memblock_free(start_r, size_r - size) before calling this?

Or is that not neccessary as memblock_* is pretty smart about this sort of thing?

> +			break;
> +		}
> +	}
> +	memblock_free(start, size);
> +}
> +
--
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