Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757429AbcCDCir (ORCPT ); Thu, 3 Mar 2016 21:38:47 -0500 Received: from mga11.intel.com ([192.55.52.93]:16517 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756634AbcCDCiq convert rfc822-to-8bit (ORCPT ); Thu, 3 Mar 2016 21:38:46 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,534,1449561600"; d="scan'208";a="663547172" From: "Li, Liang Z" To: Cornelia Huck CC: "quintela@redhat.com" , "amit.shah@redhat.com" , "qemu-devel@nongnu.org" , "linux-kernel@vger.kernel.org" , "mst@redhat.com" , "akpm@linux-foundation.org" , "pbonzini@redhat.com" , "rth@twiddle.net" , "ehabkost@redhat.com" , "linux-mm@kvack.org" , "virtualization@lists.linux-foundation.org" , "kvm@vger.kernel.org" , "dgilbert@redhat.com" Subject: RE: [RFC qemu 2/4] virtio-balloon: Add a new feature to balloon device Thread-Topic: [RFC qemu 2/4] virtio-balloon: Add a new feature to balloon device Thread-Index: AQHRdTqNiA+YSUCfvUil9TtoPzawdp9HHnAAgAFzOmA= Date: Fri, 4 Mar 2016 02:38:29 +0000 Message-ID: References: <1457001868-15949-1-git-send-email-liang.z.li@intel.com> <1457001868-15949-3-git-send-email-liang.z.li@intel.com> <20160303132334.5e4565df.cornelia.huck@de.ibm.com> In-Reply-To: <20160303132334.5e4565df.cornelia.huck@de.ibm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2RiY2M1OWUtZjIyMi00OWM4LWIyMzUtM2YyMWJjYzUxYmNkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlRHTmI2eVJTdEJkNHNmWUFmcXA1ZHpvVmtSWVd6Y21sc29KN1BSeEtEMHM9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1745 Lines: 48 > On Thu, 3 Mar 2016 18:44:26 +0800 > Liang Li wrote: > > > Extend the virtio balloon device to support a new feature, this new > > feature can help to get guest's free pages information, which can be > > used for live migration optimzation. > > Do you have a spec for this, e.g. as a patch to the virtio spec? Not yet. > > > > > Signed-off-by: Liang Li > > --- > > balloon.c | 30 ++++++++- > > hw/virtio/virtio-balloon.c | 81 ++++++++++++++++++++++++- > > include/hw/virtio/virtio-balloon.h | 17 +++++- > > include/standard-headers/linux/virtio_balloon.h | 1 + > > include/sysemu/balloon.h | 10 ++- > > 5 files changed, 134 insertions(+), 5 deletions(-) > > > +static int virtio_balloon_free_pages(void *opaque, > > + unsigned long *free_pages_bitmap, > > + unsigned long *free_pages_count) > > +{ > > + VirtIOBalloon *s = opaque; > > + VirtIODevice *vdev = VIRTIO_DEVICE(s); > > + VirtQueueElement *elem = s->free_pages_vq_elem; > > + int len; > > + > > + if (!balloon_free_pages_supported(s)) { > > + return -1; > > + } > > + > > + if (s->req_status == NOT_STARTED) { > > + s->free_pages_bitmap = free_pages_bitmap; > > + s->req_status = STARTED; > > + s->mem_layout.low_mem = > > + pc_get_lowmem(PC_MACHINE(current_machine)); > > Please don't leak pc-specific information into generic code. I have already notice that and just leave it here in this initial RFC version, the hard part of this solution is how to handle different architecture ... Thanks! Liang