Re: [PATCH 11/22] KVM: MMU: Add infrastructure for two-level page walker

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/28/2010 01:52 PM, Joerg Roedel wrote:
On Tue, Apr 27, 2010 at 03:34:10PM +0300, Avi Kivity wrote:
On 04/27/2010 01:38 PM, Joerg Roedel wrote:
This patch introduces a mmu-callback to translate gpa
addresses in the walk_addr code. This is later used to
translate l2_gpa addresses into l1_gpa addresses.

+static inline gfn_t gpa_to_gfn(gpa_t gpa)
+{
+	return (gfn_t)gpa>>   PAGE_SHIFT;
+}
+
This overflows on 32-bit, since gpa_t is u64 and gfn_t is ulong.
Hm, this is a problem outside of this patchset too (for 32bit hosts).
The best solution is probably to convert gfn_t to u64 too.

If you cast like

   (gfn_t)(gpa >> PAGE_SHIFT)

you avoid the overflow for MAXPHYADDR < 48. However, I agree that converting gfn_t to u64 is best, the minor performance degradation is in no way comparable to the corruption that results from a miscast.

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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux