From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8B7u-0000n1-L1 for qemu-devel@nongnu.org; Thu, 25 Jun 2015 13:39:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8B7q-00040B-Cn for qemu-devel@nongnu.org; Thu, 25 Jun 2015 13:39:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8B7q-0003zy-7Q for qemu-devel@nongnu.org; Thu, 25 Jun 2015 13:39:46 -0400 Message-ID: <558C3CDC.2050907@redhat.com> Date: Thu, 25 Jun 2015 19:39:40 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4b8fc4d985de6c4f44509b9c47a6152add36d832.1435195913.git.zhugh.fnst@cn.fujitsu.com> <558C2583.1040501@suse.de> <558C2605.2070806@redhat.com> <558C27DF.5090800@suse.de> <558C343F.1090703@redhat.com> <558C357C.4030908@suse.de> <558C3A13.2050702@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RESEND PATCH v8 1/4] apic: map APIC's MMIO region at each CPU's address space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Zhu Guihua , Eduardo Habkost , QEMU Developers , izumi.taku@jp.fujitsu.com, ChenFan , Igor Mammedov , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= On 25/06/2015 19:32, Peter Maydell wrote: > On 25 June 2015 at 18:27, Paolo Bonzini wrote: >> On 25/06/2015 19:08, Andreas F=C3=A4rber wrote: >>> And is installing a separate address space per CPU for KVM difficult = due >>> to kernel limitations, or is this just a few lines of QEMU code that = Zhu >>> or someone would need to write? :) >> >> It's basically impossible. Even though support for multiple address >> spaces is going to be in Linux 4.2, there are going to be just two: SM= M >> and not SMM. You don't really want to do O(#cpus) stuff in KVM, where >> the number of CPUs can be 200 or more. >=20 > Can you explain what the issue is here? Shouldn't it just be a matter > of kvm_cpu_exec() doing a dispatch to cpu->as rather than calling > address_space_rw() ? (Making it do that was one of the things on my > todo list for ARM at some point.) One example of the problem is that different CPU address spaces can have MMIO in different places. These MMIO areas can hide RAM depending on where they're placed and their relative priorities. If they do, KVM cannot really assume that a single set of page tables are okay to convert gpa->hpa for all guest CPUs. If you can tie this to CPU state (e.g. in or out of system management mode), you only get a small, constant number of such address spaces. See http://thread.gmane.org/gmane.comp.emulators.qemu/345230 for the QEMU part of the multiple-address-space support. Paolo > I'm happy to assume that RAM is shared by all CPUs I guess. >=20 >> TCG is okay because the #cpus is not really going to be more than 4-is= h. >=20 > Well, it might be more than that in future... >=20 > -- PMM >=20