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: <5011062F.3080505@redhat.com>
Date:	Thu, 26 Jul 2012 11:56:15 +0300
From:	Avi Kivity <avi@...hat.com>
To:	Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: Re: [PATCH v2 3/3] KVM: remove dummy pages

On 07/26/2012 06:58 AM, Xiao Guangrong wrote:
> Currently, kvm allocates some pages and use them as error indicators,
> it wastes memory and is not good for scalability
> 
> Base on Avi's suggestion, we use the error codes instead of these pages
> to indicate the error conditions
> 
> 
> +static pfn_t get_bad_pfn(void)
> +{
> +	return -ENOENT;
> +}
> +
> +pfn_t get_fault_pfn(void)
> +{
> +	return -EFAULT;
> +}
> +EXPORT_SYMBOL_GPL(get_fault_pfn);
> +
> +static pfn_t get_hwpoison_pfn(void)
> +{
> +	return -EHWPOISON;
> +}
> +

Would be better as #defines

>  int is_hwpoison_pfn(pfn_t pfn)
>  {
> -	return pfn == hwpoison_pfn;
> +	return pfn == -EHWPOISON;
>  }
>  EXPORT_SYMBOL_GPL(is_hwpoison_pfn);
> 
>  int is_noslot_pfn(pfn_t pfn)
>  {
> -	return pfn == bad_pfn;
> +	return pfn == -ENOENT;
>  }
>  EXPORT_SYMBOL_GPL(is_noslot_pfn);
> 
>  int is_invalid_pfn(pfn_t pfn)
>  {
> -	return pfn == hwpoison_pfn || pfn == fault_pfn;
> +	return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
>  }
>  EXPORT_SYMBOL_GPL(is_invalid_pfn);
> 

So is_*_pfn() could go away and be replaced by ==.

> 
>  EXPORT_SYMBOL_GPL(gfn_to_page);
> 
>  void kvm_release_page_clean(struct page *page)
>  {
> -	kvm_release_pfn_clean(page_to_pfn(page));
> +	if (!is_error_page(page))
> +		kvm_release_pfn_clean(page_to_pfn(page));
>  }
>  EXPORT_SYMBOL_GPL(kvm_release_page_clean);

Note, we can remove calls to kvm_release_page_clean() from error paths
now, so in the future we can drop the test.

Since my comments are better done as a separate patch, I applied all
three patches.  Thanks!

-- 
error compiling committee.c: too many arguments to function


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