From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Alistair Francis <alistair@alistair23.me>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
"Emilio G . Cota" <cota@braap.org>,
Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Subject: [Qemu-devel] [PATCH v2 4/4] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index
Date: Mon, 14 Jan 2019 11:56:37 +0000 [thread overview]
Message-ID: <20190114115637.6335-5-peter.maydell@linaro.org> (raw)
In-Reply-To: <20190114115637.6335-1-peter.maydell@linaro.org>
Now we're keeping the cluster index in the CPUState, we don't
need to jump through hoops in gdb_get_cpu_pid() to find the
associated cluster object.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
---
gdbstub.c | 48 +++++-------------------------------------------
1 file changed, 5 insertions(+), 43 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index bfc7afb5096..5d6cbea9d35 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -644,50 +644,12 @@ static int memtox(char *buf, const char *mem, int len)
static uint32_t gdb_get_cpu_pid(const GDBState *s, CPUState *cpu)
{
-#ifndef CONFIG_USER_ONLY
- gchar *path, *name = NULL;
- Object *obj;
- CPUClusterState *cluster;
- uint32_t ret;
-
- path = object_get_canonical_path(OBJECT(cpu));
-
- if (path == NULL) {
- /* Return the default process' PID */
- ret = s->processes[s->process_num - 1].pid;
- goto out;
- }
-
- name = object_get_canonical_path_component(OBJECT(cpu));
- assert(name != NULL);
-
- /*
- * Retrieve the CPU parent path by removing the last '/' and the CPU name
- * from the CPU canonical path.
- */
- path[strlen(path) - strlen(name) - 1] = '\0';
-
- obj = object_resolve_path_type(path, TYPE_CPU_CLUSTER, NULL);
-
- if (obj == NULL) {
- /* Return the default process' PID */
- ret = s->processes[s->process_num - 1].pid;
- goto out;
- }
-
- cluster = CPU_CLUSTER(obj);
- ret = cluster->cluster_id + 1;
-
-out:
- g_free(name);
- g_free(path);
-
- return ret;
-
-#else
/* TODO: In user mode, we should use the task state PID */
- return s->processes[s->process_num - 1].pid;
-#endif
+ if (cpu->cluster_index == UNASSIGNED_CLUSTER_INDEX) {
+ /* Return the default process' PID */
+ return s->processes[s->process_num - 1].pid;
+ }
+ return cpu->cluster_index + 1;
}
static GDBProcess *gdb_get_process(const GDBState *s, uint32_t pid)
--
2.20.1
prev parent reply other threads:[~2019-01-14 11:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 11:56 [Qemu-devel] [PATCH v2 0/4] tcg: support heterogenous CPU clusters Peter Maydell
2019-01-14 11:56 ` [Qemu-devel] [PATCH v2 1/4] hw/arm/xlx-zynqmp: Realize cluster after putting RPUs in it Peter Maydell
2019-01-14 11:56 ` [Qemu-devel] [PATCH v2 2/4] qom/cpu: Add cluster_index to CPUState Peter Maydell
2019-01-14 11:56 ` [Qemu-devel] [PATCH v2 3/4] accel/tcg: Add cluster number to TCG TB hash Peter Maydell
2019-01-15 21:20 ` Richard Henderson
2019-01-14 11:56 ` Peter Maydell [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=20190114115637.6335-5-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aleksandar.m.mail@gmail.com \
--cc=alistair@alistair23.me \
--cc=cota@braap.org \
--cc=crosthwaite.peter@gmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=ehabkost@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).