From: Richard Henderson <rth@twiddle.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Patch Tracking <patches@linaro.org>,
QEMU Developers <qemu-devel@nongnu.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] exec.c: Collect AddressSpace related fields into a CPUAddressSpace struct
Date: Thu, 8 Oct 2015 08:39:55 +1100 [thread overview]
Message-ID: <5615912B.7030500@twiddle.net> (raw)
In-Reply-To: <CAFEAcA97=jaUuDJqUFkDV=PUcyCx+sfrwEFwr5GGPxDk57eH0g@mail.gmail.com>
On 10/08/2015 08:13 AM, Peter Maydell wrote:
> On 7 October 2015 at 10:57, Richard Henderson <rth@twiddle.net> 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 <rth@twiddle.net>
r~
prev parent reply other threads:[~2015-10-08 0:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 14:29 [Qemu-devel] [PATCH v2 0/3] exec.c: avoid iterating through CPUs in tcg_commit() Peter Maydell
2015-10-01 14:29 ` [Qemu-devel] [PATCH v2 1/3] exec.c: Don't call cpu_reload_memory_map() from cpu_exec_init() Peter Maydell
2015-10-01 14:29 ` [Qemu-devel] [PATCH v2 2/3] cpu-exec-common.c: Clarify comment about cpu_reload_memory_map()'s RCU operations Peter Maydell
2015-10-01 14:29 ` [Qemu-devel] [PATCH v2 3/3] exec.c: Collect AddressSpace related fields into a CPUAddressSpace struct Peter Maydell
2015-10-03 20:45 ` Edgar E. Iglesias
2015-10-07 9:57 ` Richard Henderson
2015-10-07 21:13 ` Peter Maydell
2015-10-07 21:39 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5615912B.7030500@twiddle.net \
--to=rth@twiddle.net \
--cc=edgar.iglesias@gmail.com \
--cc=patches@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).