From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: Alistair Francis <alistair23@gmail.com> Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>, Peter Maydell <peter.maydell@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, "open list:Overall" <kvm@vger.kernel.org>, Juan Quintela <quintela@redhat.com>, "open list:New World" <qemu-ppc@nongnu.org>, Marcelo Tosatti <mtosatti@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, qemu-arm <qemu-arm@nongnu.org>, Alistair Francis <alistair.francis@wdc.com>, Paolo Bonzini <pbonzini@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, Richard Henderson <rth@twiddle.net> Subject: Re: [PATCH 10/15] memory: Replace current_machine by qdev_get_machine() Date: Sun, 12 Jan 2020 14:45:08 +0100 [thread overview] Message-ID: <f7e3539a-4506-0df1-ee66-f3d8a6aa8fce@redhat.com> (raw) In-Reply-To: <CAKmqyKNrgTbiipNK1wrwCMqk_=7cJmc4rBwO1zxjFiVV+TRSgQ@mail.gmail.com> On 1/12/20 10:48 AM, Alistair Francis wrote: > On Thu, Jan 9, 2020 at 11:29 PM Philippe Mathieu-Daudé > <philmd@redhat.com> wrote: >> >> As we want to remove the global current_machine, >> replace 'current_machine' by MACHINE(qdev_get_machine()). >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> memory.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/memory.c b/memory.c >> index d7b9bb6951..57e38b1f50 100644 >> --- a/memory.c >> +++ b/memory.c >> @@ -3004,6 +3004,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, >> int n = view->nr; >> int i; >> AddressSpace *as; >> + MachineState *ms; >> >> qemu_printf("FlatView #%d\n", fvi->counter); >> ++fvi->counter; >> @@ -3026,6 +3027,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, >> return; >> } >> >> + ms = MACHINE(qdev_get_machine()); > > Why not set this at the top? Calling qdev_get_machine() is not free as it does some introspection checks. Since we can return earlier if there are no rendered FlatView, I placed the machinestate initialization just before it we need to access it. > Alistair > >> while (n--) { >> mr = range->mr; >> if (range->offset_in_region) { >> @@ -3057,7 +3059,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, >> if (fvi->ac) { >> for (i = 0; i < fv_address_spaces->len; ++i) { >> as = g_array_index(fv_address_spaces, AddressSpace*, i); >> - if (fvi->ac->has_memory(current_machine, as, >> + if (fvi->ac->has_memory(ms, as, >> int128_get64(range->addr.start), >> MR_SIZE(range->addr.size) + 1)) { >> qemu_printf(" %s", fvi->ac->name); >> -- >> 2.21.1 >> >> >
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: Alistair Francis <alistair23@gmail.com> Cc: Peter Maydell <peter.maydell@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, "open list:Overall" <kvm@vger.kernel.org>, Juan Quintela <quintela@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, qemu-arm <qemu-arm@nongnu.org>, "open list:New World" <qemu-ppc@nongnu.org>, Paolo Bonzini <pbonzini@redhat.com>, Alistair Francis <alistair.francis@wdc.com>, Richard Henderson <rth@twiddle.net>, David Gibson <david@gibson.dropbear.id.au> Subject: Re: [PATCH 10/15] memory: Replace current_machine by qdev_get_machine() Date: Sun, 12 Jan 2020 14:45:08 +0100 [thread overview] Message-ID: <f7e3539a-4506-0df1-ee66-f3d8a6aa8fce@redhat.com> (raw) In-Reply-To: <CAKmqyKNrgTbiipNK1wrwCMqk_=7cJmc4rBwO1zxjFiVV+TRSgQ@mail.gmail.com> On 1/12/20 10:48 AM, Alistair Francis wrote: > On Thu, Jan 9, 2020 at 11:29 PM Philippe Mathieu-Daudé > <philmd@redhat.com> wrote: >> >> As we want to remove the global current_machine, >> replace 'current_machine' by MACHINE(qdev_get_machine()). >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> memory.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/memory.c b/memory.c >> index d7b9bb6951..57e38b1f50 100644 >> --- a/memory.c >> +++ b/memory.c >> @@ -3004,6 +3004,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, >> int n = view->nr; >> int i; >> AddressSpace *as; >> + MachineState *ms; >> >> qemu_printf("FlatView #%d\n", fvi->counter); >> ++fvi->counter; >> @@ -3026,6 +3027,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, >> return; >> } >> >> + ms = MACHINE(qdev_get_machine()); > > Why not set this at the top? Calling qdev_get_machine() is not free as it does some introspection checks. Since we can return earlier if there are no rendered FlatView, I placed the machinestate initialization just before it we need to access it. > Alistair > >> while (n--) { >> mr = range->mr; >> if (range->offset_in_region) { >> @@ -3057,7 +3059,7 @@ static void mtree_print_flatview(gpointer key, gpointer value, >> if (fvi->ac) { >> for (i = 0; i < fv_address_spaces->len; ++i) { >> as = g_array_index(fv_address_spaces, AddressSpace*, i); >> - if (fvi->ac->has_memory(current_machine, as, >> + if (fvi->ac->has_memory(ms, as, >> int128_get64(range->addr.start), >> MR_SIZE(range->addr.size) + 1)) { >> qemu_printf(" %s", fvi->ac->name); >> -- >> 2.21.1 >> >> >
next prev parent reply other threads:[~2020-01-12 13:45 UTC|newest] Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-09 15:21 [PATCH 00/15] Replace current_machine by qdev_get_machine() Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-09 15:21 ` [PATCH 01/15] target/arm/kvm: Use CPUState::kvm_state in kvm_arm_pmu_supported() Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-10 9:59 ` Alistair Francis 2020-01-10 9:59 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 02/15] hw/ppc/spapr_rtas: Use local MachineState variable Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-09 17:13 ` Greg Kurz 2020-01-09 17:13 ` Greg Kurz 2020-01-13 1:11 ` David Gibson 2020-01-13 1:11 ` David Gibson 2020-01-09 15:21 ` [PATCH 03/15] hw/ppc/spapr_rtas: Access MachineState via SpaprMachineState argument Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-09 17:13 ` Greg Kurz 2020-01-09 17:13 ` Greg Kurz 2020-01-13 1:11 ` David Gibson 2020-01-13 1:11 ` David Gibson 2020-01-09 15:21 ` [PATCH 04/15] hw/ppc/spapr_rtas: Restrict variables scope to single switch case Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-09 17:43 ` Greg Kurz 2020-01-09 17:43 ` Greg Kurz 2020-01-10 9:34 ` Philippe Mathieu-Daudé 2020-01-10 9:34 ` Philippe Mathieu-Daudé 2020-01-10 9:50 ` Greg Kurz 2020-01-10 9:50 ` Greg Kurz 2020-01-10 19:18 ` Eric Blake 2020-01-10 19:18 ` Eric Blake 2020-01-13 7:16 ` David Gibson 2020-01-13 7:16 ` David Gibson 2020-01-09 15:21 ` [PATCH 05/15] device-hotplug: Replace current_machine by qdev_get_machine() Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-12 9:42 ` Alistair Francis 2020-01-12 9:42 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 06/15] migration/savevm: " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-09 15:52 ` Dr. David Alan Gilbert 2020-01-09 15:52 ` Dr. David Alan Gilbert 2020-01-12 9:43 ` Alistair Francis 2020-01-12 9:43 ` Alistair Francis 2020-01-14 13:27 ` Juan Quintela 2020-01-14 13:27 ` Juan Quintela 2020-01-09 15:21 ` [PATCH 07/15] hw/core/machine-qmp-cmds: " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-12 9:44 ` Alistair Francis 2020-01-12 9:44 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 08/15] target/arm/monitor: " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-12 9:47 ` Alistair Francis 2020-01-12 9:47 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 09/15] device_tree: " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-12 9:47 ` Alistair Francis 2020-01-12 9:47 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 10/15] memory: " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-12 9:48 ` Alistair Francis 2020-01-12 9:48 ` Alistair Francis 2020-01-12 13:45 ` Philippe Mathieu-Daudé [this message] 2020-01-12 13:45 ` Philippe Mathieu-Daudé 2020-01-14 2:02 ` Alistair Francis 2020-01-14 2:02 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 11/15] exec: " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-14 1:57 ` Alistair Francis 2020-01-14 1:57 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 12/15] accel: Introduce the current_accel() method Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-14 1:59 ` Alistair Francis 2020-01-14 1:59 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 13/15] accel: Replace current_machine->accelerator by " Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-14 1:58 ` Alistair Francis 2020-01-14 1:58 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 14/15] accel/accel: Replace current_machine by qdev_get_machine() Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-14 1:59 ` Alistair Francis 2020-01-14 1:59 ` Alistair Francis 2020-01-09 15:21 ` [PATCH 15/15] vl: Make current_machine a local variable Philippe Mathieu-Daudé 2020-01-09 15:21 ` Philippe Mathieu-Daudé 2020-01-14 2:00 ` Alistair Francis 2020-01-14 2:00 ` Alistair Francis 2020-01-21 8:59 ` [PATCH 00/15] Replace current_machine by qdev_get_machine() Markus Armbruster 2020-01-21 8:59 ` Markus Armbruster
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=f7e3539a-4506-0df1-ee66-f3d8a6aa8fce@redhat.com \ --to=philmd@redhat.com \ --cc=alistair.francis@wdc.com \ --cc=alistair23@gmail.com \ --cc=david@gibson.dropbear.id.au \ --cc=dgilbert@redhat.com \ --cc=ehabkost@redhat.com \ --cc=kvm@vger.kernel.org \ --cc=mtosatti@redhat.com \ --cc=pbonzini@redhat.com \ --cc=peter.maydell@linaro.org \ --cc=qemu-arm@nongnu.org \ --cc=qemu-devel@nongnu.org \ --cc=qemu-ppc@nongnu.org \ --cc=quintela@redhat.com \ --cc=rth@twiddle.net \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.