From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KzbfL-0006d8-Uj for qemu-devel@nongnu.org; Mon, 10 Nov 2008 13:39:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KzbfK-0006cT-04 for qemu-devel@nongnu.org; Mon, 10 Nov 2008 13:39:11 -0500 Received: from [199.232.76.173] (port=56847 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KzbfJ-0006cO-Qr for qemu-devel@nongnu.org; Mon, 10 Nov 2008 13:39:09 -0500 Received: from an-out-0708.google.com ([209.85.132.244]:29347) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KzbfJ-00011F-Lm for qemu-devel@nongnu.org; Mon, 10 Nov 2008 13:39:09 -0500 Received: by an-out-0708.google.com with SMTP id c38so352794ana.37 for ; Mon, 10 Nov 2008 10:39:08 -0800 (PST) Message-ID: <49187FC8.60107@codemonkey.ws> Date: Mon, 10 Nov 2008 12:39:04 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 0/4] VGA optimization References: <1226342253-8887-1-git-send-email-glommer@redhat.com> In-Reply-To: <1226342253-8887-1-git-send-email-glommer@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Glauber Costa wrote: > hey guys, > I gave you some bad advice that I think is causing the breakage I'm seeing now. I suggested that you simply do a lookup to find the slot given a target_phys_addr_t but that isn't correct. Let me explain why. ram_addr_t represents a guest physical address. From a ram_addr_t you can get a target_phys_addr_t. Sometimes these are the same but they aren't always. You can have multiple ram_addr_t's pointing to the same target_phys_addr_t. This is ram aliasing and it happens for a variety of reasons. In general, it's pretty expensive to map a ram_addr_t to a target_phys_addr_t because, among other things, for a range of (ram_addr_t, size_t), you may have many (target_phys_addr_t, size) tuples that you have to deal with. vga_common_init() takes a target_phys_addr_t (well, it really takes an unsigned long, but that's a bug). It takes this as an optimization. It avoids having to do the conversion and ensures that it's one big linear region. For dirty tracking, we have a bitmap indexed by target_phys_addr_t in QEMU. This means that we can happily set dirty bits based on target_phys_addr_t's. We don't have to worry about what ram_addr_t it came from because they all map to the same bits. Since KVM uses a slot API, and that API is indexed in ram_addr_t's, we need to enable dirty tracking on the ram_addr_t's. We don't have a ram_addr_t in the VGA code. The solution is pretty simple. We need to keep track of the ram_addr_t's in the VGA code and enable dirty tracking on the appropriate ram_addr_ts. Regards, Anthony Liguori > I hope this is the last version (Of course, once this is merged, > the optimizations of the optimization can start ;-) ) > > I split it in 4 patches. The first two ones are just moving > things out of the way, and then #3 and #4 do the real thing. > #3 kvm-side, #4 overall qemu. > > They merge most of the suggestion Anthony and Stefano's sent > on last iteration. > > Hope you like it. > > > > >