From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Alistair Francis <alistair@alistair23.me>,
Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Emilio G . Cota" <cota@braap.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v3 4/4] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index
Date: Mon, 21 Jan 2019 12:25:36 -0800 [thread overview]
Message-ID: <20190121202536.GC21062@toto> (raw)
In-Reply-To: <20190121152218.9592-5-peter.maydell@linaro.org>
On Mon, Jan 21, 2019 at 03:22:18PM +0000, Peter Maydell wrote:
> 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>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.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
>
WARNING: multiple messages have this Message-ID (diff)
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Alistair Francis <alistair@alistair23.me>,
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: Re: [Qemu-devel] [PATCH v3 4/4] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index
Date: Mon, 21 Jan 2019 12:25:36 -0800 [thread overview]
Message-ID: <20190121202536.GC21062@toto> (raw)
In-Reply-To: <20190121152218.9592-5-peter.maydell@linaro.org>
On Mon, Jan 21, 2019 at 03:22:18PM +0000, Peter Maydell wrote:
> 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>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.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
>
next prev parent reply other threads:[~2019-01-21 20:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 15:22 [Qemu-devel] [PATCH v3 0/4] tcg: support heterogenous CPU clusters Peter Maydell
2019-01-21 15:22 ` Peter Maydell
2019-01-21 15:22 ` [Qemu-arm] [PATCH v3 1/4] hw/arm/xlx-zynqmp: Realize cluster after putting RPUs in it Peter Maydell
2019-01-21 15:22 ` [Qemu-devel] " Peter Maydell
2019-01-21 19:33 ` [Qemu-arm] " Edgar E. Iglesias
2019-01-21 19:33 ` [Qemu-devel] " Edgar E. Iglesias
2019-01-21 15:22 ` [Qemu-devel] [PATCH v3 2/4] qom/cpu: Add cluster_index to CPUState Peter Maydell
2019-01-21 15:22 ` Peter Maydell
2019-01-21 20:01 ` [Qemu-arm] " Edgar E. Iglesias
2019-01-21 20:01 ` [Qemu-devel] " Edgar E. Iglesias
2019-01-25 22:43 ` Alistair
2019-01-25 22:43 ` Alistair
2019-01-21 15:22 ` [Qemu-devel] [PATCH v3 3/4] accel/tcg: Add cluster number to TCG TB hash Peter Maydell
2019-01-21 15:22 ` Peter Maydell
2019-01-21 20:04 ` [Qemu-arm] " Edgar E. Iglesias
2019-01-21 20:04 ` [Qemu-devel] " Edgar E. Iglesias
2019-01-25 22:44 ` [Qemu-arm] " Alistair
2019-01-25 22:44 ` Alistair
2019-01-21 15:22 ` [Qemu-arm] [PATCH v3 4/4] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index Peter Maydell
2019-01-21 15:22 ` [Qemu-devel] " Peter Maydell
2019-01-21 20:25 ` Edgar E. Iglesias [this message]
2019-01-21 20:25 ` Edgar E. Iglesias
2019-01-21 18:39 ` [Qemu-arm] [PATCH v3 0/4] tcg: support heterogenous CPU clusters Peter Maydell
2019-01-21 18:39 ` [Qemu-devel] " Peter Maydell
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=20190121202536.GC21062@toto \
--to=edgar.iglesias@gmail.com \
--cc=aleksandar.m.mail@gmail.com \
--cc=alistair@alistair23.me \
--cc=cota@braap.org \
--cc=crosthwaite.peter@gmail.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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 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.