Received: from eggs.gnu.org ([2001:4830:134:3::10]:54525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBoF4-0001sK-7k for qemu-devel@nongnu.org; Tue, 29 Nov 2016 14:39:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBoF0-0003q3-04 for qemu-devel@nongnu.org; Tue, 29 Nov 2016 14:39:02 -0500 Received: from mx3-phx2.redhat.com ([209.132.183.24]:58552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cBoEz-0003pi-NW for qemu-devel@nongnu.org; Tue, 29 Nov 2016 14:38:57 -0500 Date: Tue, 29 Nov 2016 14:38:50 -0500 (EST) From: David Airlie Message-ID: <1544413389.564929.1480448330524.JavaMail.zimbra@redhat.com> In-Reply-To: <1480423356-22255-1-git-send-email-kraxel@redhat.com> References: <1480423356-22255-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] virtio-gpu: track and limit host memory allocations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , =?utf-8?B?5p2O5by6?= , "Michael S. Tsirkin" ----- Original Message ----- > From: "Gerd Hoffmann" > To: qemu-devel@nongnu.org > Cc: "Gerd Hoffmann" , "Marc-Andr=C3=A9 Lureau" , "Dave Airlie" > , "=E6=9D=8E=E5=BC=BA" , "Michael = S. Tsirkin" > Sent: Tuesday, 29 November, 2016 10:42:36 PM > Subject: [PATCH] virtio-gpu: track and limit host memory allocations >=20 > This patch makes virtio-gpu track host memory allocations for ressources > and applies a limit (configurable 256M by default). When exceeding the > limit virtio-gpu throws VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY errors (like > it already does today when pixman image allocations fail). >=20 > This patch covers 2d mode only. For 3d mode we have to figure how we > are going to handle this best. qemu doesn't track resources in case > virglrenderer is used, so I guess we should extend virglrenderer to > allow setting a limit, then let qemu set the limit and catch > virgl_renderer_resource_create failures. The problem being we have no idea how much memory a GL allocation takes on the host, it is totally dependant on the GL drivers installed, and there is no way to find out. Space on host memory could be anywhere from a few bytes of metadata to the whole size of the allocation + a bunch of meta data overhead. Dave.