From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSRiq-0003Kc-3T for qemu-devel@nongnu.org; Mon, 02 Mar 2015 09:53:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSRim-00038z-MU for qemu-devel@nongnu.org; Mon, 02 Mar 2015 09:53:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSRim-00038m-Fa for qemu-devel@nongnu.org; Mon, 02 Mar 2015 09:53:24 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t22ErNjU025871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 2 Mar 2015 09:53:23 -0500 Date: Mon, 2 Mar 2015 15:52:48 +0100 From: Peter Krempa Message-ID: <20150302145248.GM681446@andariel.home> References: <1424980156-25556-1-git-send-email-lcapitulino@redhat.com> <1424980156-25556-3-git-send-email-lcapitulino@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kkcDP0v44wDpNmbp" Content-Disposition: inline In-Reply-To: <1424980156-25556-3-git-send-email-lcapitulino@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2] docs: add memory-hotplug.txt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: imammedo@redhat.com, qemu-devel@nongnu.org --kkcDP0v44wDpNmbp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 26, 2015 at 14:49:16 -0500, Luiz Capitulino wrote: > This document describes how to use memory hotplug in QEMU. >=20 > Signed-off-by: Luiz Capitulino > --- > docs/memory-hotplug.txt | 77 +++++++++++++++++++++++++++++++++++++++++++= ++++++ > 1 file changed, 77 insertions(+) > create mode 100644 docs/memory-hotplug.txt >=20 > diff --git a/docs/memory-hotplug.txt b/docs/memory-hotplug.txt > new file mode 100644 > index 0000000..e821449 > --- /dev/null > +++ b/docs/memory-hotplug.txt > @@ -0,0 +1,77 @@ > +QEMU memory hotplug > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > + > +This document explains how to use the memory hotplug feature in QEMU, > +which is present since v2.1.0. > + > +Please, note that memory hot unplug is not supported yet. This means > +that you're able to add memory, but you're not able to remove it. > +Also, proper proper guest support is required for memory hotplug > +to work. > + > +Basic RAM hotplug > +----------------- > + > +In order to be able to hotplug memory, QEMU has to be told how many > +hotpluggable memory slots to create and what is the maximum amount of > +memory the guest can grow. This is done at startup time by means of > +the -m command-line option, which has the following format: > + > + -m [size=3D]megs[,slots=3Dn,maxmem=3Dsize] > + > +Where, > + > + - "megs" is the startup RAM. It is the RAM the guest will boot with > + - "slots" is the number of hotpluggable memory slots Limit is 256 IIRC. > + - "maxmem" is the maximum RAM size the guest can grow And this has to be aligned properly (see reply to 1/2). > + > +For example, the following command-line: > + > + qemu [...] 1G,slots=3D3,maxmem=3D4G > + > +Creates a guest with 1GB of memory and three hotpluggable memory slots. > +The hotpluggable memory slots are empty when the guest is booted, so all > +memory the guest will see after boot is 1GB. The maximum memory the > +guest can reach is 4GB. This means that three additional gigas can be > +hotplugged by using any combination of the available memory slots. > + > +Two monitor commands are used to hotplug memory: > + > + - "object_add": creates a memory backend object > + - "device_add": creates the front-end pc-dimm device and inserts it > + into an empty slot > + > +For example, the following commands add another 1GB to the guest > +discussed earlier: > + > + (qemu) object_add memory-backend-ram,id=3Dmem1,size=3D1G The size here is also checked for alignment AFAIK. Also a sane minimum for linux guests is 128MiB. > + (qemu) device_add pc-dimm,id=3Ddimm1,memdev=3Dmem1 > + > +Using the file backend > +---------------------- > + > +Besides basic RAM hotplug, QEMU also supports using files as a memory > +backend. This is useful for using hugetlbfs in Linux, which provides > +access to bigger page sizes. > + > +For example, assuming that the host has 1GB hugepages available in > +the /mnt/hugepages-1GB directory, a 1GB hugepage could be hotplugged > +into the guest from the previous section with the following commnands: > + > + (qemu) object_add memory-backend-file,id=3Dmem1,size=3D1G,mem-path=3D/= mnt/hugepages-1GB > + (qemu) device_add pc-dimm,id=3Ddimm1,memdev=3Dmem1 > + > +It's also possible to start a guest with memory plugged into the > +hotpluggable memory slots. This might seem counterintuitive at first, > +but this allows for a lot of flexibility when using the file backend. > + > +In the following command-line example, a 8GB guest is created where 6GB > +comes from regular RAM, 1GB is a 1GB hugepage page and 256MB is from > +2MB pages. Also, the guest has additional memory slots to hotplug more > +2GB if needed: > + > + qemu [...] -m 6GB,slots=3D4,maxmem=3D10G \ > + -object memory-backend-file,id=3Dmem1,size=3D1G,mem-path=3D/mnt/hugep= ages-1G \ > + -device pc-dimm,id=3Ddimm1,memdev=3Dmem1 \ > + -object memory-backend-file,id=3Dmem2,size=3D256M,mem-path=3D/mnt/hug= epages-2MB \ > + -device pc-dimm,id=3Ddimm2,memdev=3Dmem2 Otherwise a very helpful text :). Shame that it wasn't available sooner I had to figure out the details myself. Peter --kkcDP0v44wDpNmbp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU9HlAAAoJEDbsFqzQGGgr1ZQQAIAWv6Ccyw7XyrT2gVB9QAal S7jyR938AmONllLLeaHD3eLv1npr0Xi2XuwIX04S20rBH6TLhFgMJFGmQKaM2mJv 8GtF0f5LhKm91PPmnGyk02mamUQu1RgNZAg14UM0nRbruo/guMcgeWU364//573A o9RwHoP23rJn8QEWealUJpg+/3YTs81PIpsMubRnMLYQ6TAMnOwa+M6itFgWKIQo 5WZvyy0pW4qEv5NiPB8cNfoSiq8xQGsy8NwCatm9BMCQuI8vsuWeDnQ0Hcj0SjpS q0j4q6vhalsEcC+weejP63owQaPaOB0A0zp3eL0ROBuLfPfOhM3O290lE6xtC8eD EWhde3xNqQ9WK/jqr370PNZpcyUYkXYVAnlIJb6Aj5fDOhy3/bBi31WUPZKxiBnL jwKmMO+Y/7vw4hVQxaQ2/05e19WmYWmsEpGCA7q5dc7WsgBYSLid4ugUKCCyf34W N0HUA+n5kWK/N0BY6QsXa0nG+QzIr2xE6wOSqNP9AexXqPAaaiiwqYlBMHJwhIc8 S5ooUjWXt73O2eEjF5xjo3ueMgY7hMQx7yr/HYxjbpzG4/CDqL4HpjprgO8CMx/k x7itrBsB1wUc1sHflFOwP5eyeCO4flr7vp05Zx3ONPc6+Poyquyh5XL7MtP7B0LE P21OxIsCAenbfxJjPqbF =FInt -----END PGP SIGNATURE----- --kkcDP0v44wDpNmbp--