Re: arm64: virtio broken in upstream kernel

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

 



On Mon, Dec 01, 2014 at 03:03:50PM +0000, Peter Maydell wrote:
> On 1 December 2014 at 14:02, Richard W.M. Jones <rjones@xxxxxxxxxx> wrote:
> > OK I fixed it ...
> >
> > This patch to qemu fixes the problem for me.  I will post it to
> > qemu-devel shortly.

[In reply to your other comment about wasting memory on machines with
small amounts of memory]

How about we just do this on aarch64?  Isn't it the case that only
aarch64 has 64K pages, and aarch64 machines presumably all have loads
of RAM.

> Really this is a workaround for a bug in the (guest) kernel.
> The booting ABI documentation says nothing about having to keep
> the DTB outside the tail end of the page occupied by the initrd,
> so it's a kernel bug that it fails to work in this situation
> (or a kernel documentation bug that it doesn't say that the
> last part-page of the initrd can't be shared with anything,
> if you prefer).

What's actually happening is the kernels frees initrd memory just
after unpacking the initramfs (arch/arm64/mm/init.c:free_initrd_mem).

That happens to be some time before the device tree is parsed for
virtio-mmio devices.  The act of freeing the initrd memory deletes a
bit of the device tree (or probably allows that memory to be
overwritten by a future allocation somewhere) with predictable
consequences.

So I don't know how to fix this easily in the kernel.  Perhaps:

 - move the initrd free later?
 - don't free the initrd memory (wasting much more than my qemu patch)
 - don't free the last page of initrd?  (this might have been the
   intention of Yalin Wang's patch?)

TBH it does sound like a documentation bug - the kernel requires that
the initrd occupies exclusively whole pages.

IA64 has a similar-but-different problem with the kernel possibly
overlapping the initrd because EFI and the kernel might differ about
page size (see arch/ia64/mm/init.c:free_initrd_mem).  This leads me to
think that we may need to align the start of the initrd as well.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux