From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqvK4-0006xJ-Ut for qemu-devel@nongnu.org; Fri, 15 Apr 2016 00:25:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqvK0-00006G-Nx for qemu-devel@nongnu.org; Fri, 15 Apr 2016 00:25:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqvK0-00006A-8g for qemu-devel@nongnu.org; Fri, 15 Apr 2016 00:25:32 -0400 Date: Fri, 15 Apr 2016 14:26:42 +1000 From: David Gibson Message-ID: <20160415142642.68946844@voom.fritz.box> In-Reply-To: <20160414183404.GB21766@work-vm> References: <1460548364-27469-1-git-send-email-thuth@redhat.com> <20160413145835-mutt-send-email-mst@redhat.com> <570E5D05.2030507@redhat.com> <20160414114757.GE2252@work-vm> <570F8AD5.4040805@redhat.com> <20160414183404.GB21766@work-vm> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/5TZl+1mi6kUJ+4MaFRWoEn0"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH] hw/virtio/balloon: Fixes for different host page sizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: Thomas Huth , "Michael S. Tsirkin" , qemu-devel@nongnu.org, wehuang@redhat.com, drjones@redhat.com, amit.shah@redhat.com, jitendra.kolhe@hpe.com --Sig_/5TZl+1mi6kUJ+4MaFRWoEn0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 14 Apr 2016 19:34:05 +0100 "Dr. David Alan Gilbert" wrote: > * Thomas Huth (thuth@redhat.com) wrote: > > On 14.04.2016 13:47, Dr. David Alan Gilbert wrote: =20 > > > * Thomas Huth (thuth@redhat.com) wrote: > > > =20 > > >> That would mean a regression compared to what we have today. Current= ly, > > >> the ballooning is working OK for 64k guests on a 64k ppc host - rath= er > > >> by chance than on purpose, but it's working. The guest is always sen= ding > > >> all the 4k fragments of a 64k page, and QEMU is trying to call madvi= se() > > >> for every one of them, but the kernel is ignoring madvise() on > > >> non-64k-aligned addresses, so we end up with a situation where the > > >> madvise() frees a whole 64k page which is also declared as free by t= he > > >> guest. =20 > > >=20 > > > I wouldn't worry about migrating your fragmenet map; but I wonder if = it > > > needs to be that complex - does the guest normally do something more = sane > > > like do the 4k pages in order and so you've just got to track the last > > > page it tried rather than having a full map? =20 > >=20 > > That's maybe a little bit easier and might work for well-known Linux > > guests, but IMHO it's even more a hack than my approach: If the Linux > > driver one day is switched to send the pages in the opposite order, or > > if somebody tries to run a non-wellknown (i.e. non-Linux) guest, this > > does not work at all anymore. =20 >=20 > True. TBH, I'm not sure that basing off last sub-page ballooned will even be that much easier to implement, or at least to implement in a way that's convincingly correct even for the limited cases it's supposed to work in. > > > A side question is whether the behaviour that's seen by virtio_ballon= _handle_output > > > is always actually the full 64k page; it calls balloon_page once > > > for each message/element - but if all of those elements add back up t= o the full > > > page, perhaps it makes more sense to reassemble it there? =20 > >=20 > > That might work for 64k page size guests ... but for 4k guests, I think > > you'll have a hard time to reassemble a page there more easily than with > > my current approach. Or do you have a clever algorithm in mind that > > could do the job well there? =20 >=20 > No, i didn't; I just have an ulterior motive which is trying to > do as few madvise's as possible, and while virtio_balloon_handle_output s= ees > potentially quite a few requests at once, balloon_page is stuck down > there at the bottom without any idea of whether there are any more coming. >=20 > Dave >=20 > > Thomas > > =20 > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK --=20 David Gibson Senior Software Engineer, Virtualization, Red Hat --Sig_/5TZl+1mi6kUJ+4MaFRWoEn0 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXEG2CAAoJEGw4ysog2bOS+woQAIeNPjtzgoXW7ezkqVwi/6Ep mmX/HDxFwpZNgkUGxBKNs2lXGDUqXQdj0sHVoBf4l9Qi97ojU9y2c9L5AOTjavL5 fawzQn+eTbFfq7+jur659rBV5Uci4ROvnP91XvlMvmmgncIadkTAkwepccZrIKxU RBvvpEe/gJAKBKZkgoG2y9KKt8R+h8Be6sCnu/b6x4KDELyKAnsonrH9hNnxezHC jX/Mmtmd3bXPQlnEAHMTDG+Hzw46atEJw6Ofive6LRlzYzAx3MtuXtOFXz1SSrpn A/r5Cebr5pYISkKXiZqAX+ISSSl6zZ9E6dqMsUCqOuJrOfaW27+hn9cJ5A+2NQ6I j+e0wvQWOcxfKCjaVwW/iy0aDtfy3M25R1dz0VbV21y63DjN6byIhy8oHYalOw4W mwb8XngtWDCMEuogcljdUujfVwh0X8RpXrgELJjYHEgNB9woWsFxMnmHQyzns5VY 8QBpAesSBYNYV7Hl3XjPBHDOTsP3TRL7pgxuZU8ENXfGONoZ2iK6wMjNrZLVhuKZ eZ0b/ZTOv+xUWCQQSRF8dAcvNdxFVHZ2ZTo7R/TB7O6eug8EqiNgavyIVqrsiBT/ e1UD+bKwhunP+CC+HupTuNWdOJKz5RIzI1hWXh0UGMkrKRu7DlDnFrN0MNlGGcHU njb2czRN78hxvzkutvUE =WBK7 -----END PGP SIGNATURE----- --Sig_/5TZl+1mi6kUJ+4MaFRWoEn0--