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]
Date:	Tue, 17 Jul 2012 15:00:12 +1000
From:	Michael Ellerman <michael@...erman.id.au>
To:	<kvm@...r.kernel.org>
Cc:	<linux-kernel@...r.kernel.org>, <matt@...abs.org>,
	<penberg@...nel.org>, <kvm-ppc@...r.kernel.org>,
	<prerna@...ux.vnet.ibm.com>,
	David Gibson <david@...son.dropbear.id.au>
Subject: [PATCH 02/10] kvm tools, powerpc: Use mmap_anon_or_hugetblfs() in kvm__arch_init()

It implements essentially the same logic. The one difference is it sets
MAP_NORESERVE when using anonymous mmap, but I think that is OK.

Reword the comment about hugetblfs, we are no longer required to use
hugepages to back the guest.

Signed-off-by: Michael Ellerman <michael@...erman.id.au>
---
 tools/kvm/powerpc/kvm.c |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/tools/kvm/powerpc/kvm.c b/tools/kvm/powerpc/kvm.c
index cbc0d8f..0d8a9da 100644
--- a/tools/kvm/powerpc/kvm.c
+++ b/tools/kvm/powerpc/kvm.c
@@ -97,20 +97,12 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
 
 	kvm->ram_size		= ram_size;
 
-	/*
-	 * Currently, HV-mode PPC64 SPAPR requires that we map from hugetlfs.
-	 * Allow a 'default' option to assist.
-	 * PR-mode does not require this.
-	 */
-	if (hugetlbfs_path) {
-		if (!strcmp(hugetlbfs_path, "default"))
-			hugetlbfs_path = HUGETLBFS_PATH;
-		kvm->ram_start = mmap_hugetlbfs(hugetlbfs_path, kvm->ram_size);
-	} else {
-		kvm->ram_start = mmap(0, kvm->ram_size, PROT_READ | PROT_WRITE,
-				      MAP_ANON | MAP_PRIVATE,
-				      -1, 0);
-	}
+	/* Map "default" hugetblfs path to the standard 16M mount point */
+	if (hugetlbfs_path && !strcmp(hugetlbfs_path, "default"))
+		hugetlbfs_path = HUGETLBFS_PATH;
+
+	kvm->ram_start = mmap_anon_or_hugetlbfs(hugetlbfs_path, kvm->ram_size);
+
 	if (kvm->ram_start == MAP_FAILED)
 		die("Couldn't map %lld bytes for RAM (%d)\n",
 		    kvm->ram_size, errno);
-- 
1.7.9.5

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