From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjzDQ-0002qV-6F for qemu-devel@nongnu.org; Wed, 07 Oct 2015 20:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjzDM-0006qJ-43 for qemu-devel@nongnu.org; Wed, 07 Oct 2015 20:37:48 -0400 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:33762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjzDL-0006qE-VX for qemu-devel@nongnu.org; Wed, 07 Oct 2015 20:37:44 -0400 Received: by qkas79 with SMTP id s79so13037243qka.0 for ; Wed, 07 Oct 2015 17:37:43 -0700 (PDT) Sender: Richard Henderson References: <1443709790-25180-1-git-send-email-peter.maydell@linaro.org> <1443709790-25180-4-git-send-email-peter.maydell@linaro.org> <5614EC78.3090109@twiddle.net> From: Richard Henderson Message-ID: <5615912B.7030500@twiddle.net> Date: Thu, 8 Oct 2015 08:39:55 +1100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/3] exec.c: Collect AddressSpace related fields into a CPUAddressSpace struct List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Patch Tracking , QEMU Developers , "Edgar E. Iglesias" On 10/08/2015 08:13 AM, Peter Maydell wrote: > On 7 October 2015 at 10:57, Richard Henderson wrote: >> On 10/02/2015 12:29 AM, Peter Maydell wrote: >>> >>> + cpu->cpu_ases = g_new0(CPUAddressSpace, 1); >>> + cpu->cpu_ases[0].cpu = cpu; >>> + cpu->cpu_ases[0].as = as; >>> + cpu->cpu_ases[0].tcg_as_listener.commit = tcg_commit; >>> + memory_listener_register(&cpu->cpu_ases[0].tcg_as_listener, as); >>> } >> >> >> What's the plan when it's more than one? > > We g_realloc() the array to make it larger if the target-specific > code calls us again to add another AS. > >> Just thinking about why separate allocation vs embedding an array. Though >> possibly with the CPUState member being a pointer to an array within the >> TargetCPUClass, or CPUTargetState. Dunno. > > An embedded array runs you into the problem that cpu.h doesn't > have access to a definition of the MemoryListener struct (at > least I think it's that one), so it doesn't know how much space > to allocate in the structure. Plus MemoryListener doesn't > exist in non-softmmu configs, and allowing the CPUState struct > to be different sizes for softmmu vs not doesn't work because > the header can be used from compiled-once-only .c files. > This awkwardness is why we ended up with CPUState having a > pointer to a MemoryListener and thus the loop in tcg_commit > in the first place. Ah, right. Thanks. Whole series Reviewed-by: Richard Henderson r~