From nobody Tue Feb 10 11:32:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149632869679935.825071603876495; Thu, 1 Jun 2017 07:51:36 -0700 (PDT) Received: from localhost ([::1]:45060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRRm-000678-CQ for importer@patchew.org; Thu, 01 Jun 2017 10:51:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGRPM-0004Xp-4i for qemu-devel@nongnu.org; Thu, 01 Jun 2017 10:49:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGRPK-0002VR-B4 for qemu-devel@nongnu.org; Thu, 01 Jun 2017 10:49:04 -0400 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:37314) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGRPK-0002U3-4Y for qemu-devel@nongnu.org; Thu, 01 Jun 2017 10:49:02 -0400 Received: by mail-wm0-x22f.google.com with SMTP id d127so63402976wmf.0 for ; Thu, 01 Jun 2017 07:49:00 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l30sm13817208wre.25.2017.06.01.07.48.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 07:48:57 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 84D7C3E0496; Thu, 1 Jun 2017 15:49:15 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HhZLgiZIYSbWdRfyBX/zeaHilTG24DkAtqRdhfxEMJg=; b=SGT7Q2ILJxL5l2Z6H3WzIqwRNQgRX9TcTYLK7Qu4zzv02sx/0TLdpV0uhQDZYXFjZa kV5OjGGUBfTZ6r3+f7JoB0RaKcB+nZYMXB52E4CfFUgogh6Nj0h9sNH2DAiZthesL6HP nht1D0/DudnW2pkIl/2EBwie7dc4gf5erh9s4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HhZLgiZIYSbWdRfyBX/zeaHilTG24DkAtqRdhfxEMJg=; b=nUAi/iX7CHaaP0nC9Y59KSlTO6//5ICC2zvtn7JGKauoApzPj9jF68Jw5nEyGVGWUl AYQ+GSxB72wnc6W0UkEJ0sGkVq2KRsyPlWzPUrFoeMfpRWHP1eDtkY8ZwMQGJrIS1Jr+ dnuzLVGpieJltCN4/i894MSaiAaz7r7cIUdUu40aqEjp6OR0grJPt0Y0x+xqXO3cyHyk xhR4Kv/v9AOABpzK/3QfdqFsHQ3CAY3ookGVJ9y5vkIcV7ysv8TVpK1asQ3hv1dWHeC8 /3hK9SuMzyWi7zRS/EChU6EMqXzT/oE7bflNXLQp0gBFHLkVQR2zkK1PijmeRvIsxtzD mVbQ== X-Gm-Message-State: AODbwcAv9fEgao6vc9OHtcdC/S9coy7jHwSi5zTtcOO0SZf4gPemUL5b F8QgDeNfYywwuEYr X-Received: by 10.28.7.16 with SMTP id 16mr9605106wmh.16.1496328539014; Thu, 01 Jun 2017 07:48:59 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: pbonzini@redhat.com, doug16k@gmail.com, imbrenda@linux.vnet.ibm.com Date: Thu, 1 Jun 2017 15:49:14 +0100 Message-Id: <20170601144915.20778-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170601144915.20778-1-alex.bennee@linaro.org> References: <20170601144915.20778-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22f Subject: [Qemu-devel] [PATCH v2 3/4] qom/cpu: remove host_tid field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This was only used by the gdbstub and even then was only being set for subsequent threads. Rather the continue duplicating the number just make the gdbstub get the information from TaskState structure. Now the tid is correctly reported for all threads the bug I was seeing with "vCont;C04:0;c" packets is fixed as the correct tid is reported to gdb. I moved cpu_gdb_index into the gdbstub to facilitate easy access to the TaskState which is used elsewhere in gdbstub. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Claudio Imbrenda Reviewed-by: Greg Kurz Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- gdbstub.c | 15 +++++++++++++++ include/exec/gdbstub.h | 14 -------------- include/qom/cpu.h | 2 -- linux-user/syscall.c | 1 - 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 026d1fe6bb..45a3a0b16b 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -55,6 +55,21 @@ static inline int target_memory_rw_debug(CPUState *cpu, = target_ulong addr, return cpu_memory_rw_debug(cpu, addr, buf, len, is_write); } =20 +/* Return the GDB index for a given vCPU state. + * + * For user mode this is simply the thread id. In system mode GDB + * numbers CPUs from 1 as 0 is reserved as an "any cpu" index. + */ +static inline int cpu_gdb_index(CPUState *cpu) +{ +#if defined(CONFIG_USER_ONLY) + TaskState *ts =3D (TaskState *) cpu->opaque; + return ts->ts_tid; +#else + return cpu->cpu_index + 1; +#endif +} + enum { GDB_SIGNAL_0 =3D 0, GDB_SIGNAL_INT =3D 2, diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index c4fe567600..9aa7756d92 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -58,20 +58,6 @@ void gdb_register_coprocessor(CPUState *cpu, gdb_reg_cb get_reg, gdb_reg_cb set_reg, int num_regs, const char *xml, int g_pos); =20 -/* Return the GDB index for a given vCPU state. - * - * For user mode this is simply the thread id. In system mode GDB - * numbers CPUs from 1 as 0 is reserved as an "any cpu" index. - */ -static inline int cpu_gdb_index(CPUState *cpu) -{ -#if defined(CONFIG_USER_ONLY) - return cpu->host_tid; -#else - return cpu->cpu_index + 1; -#endif -} - /* The GDB remote protocol transfers values in target byte order. This me= ans * we can use the raw memory access routines to access the value buffer. * Conveniently, these also handle the case where the buffer is mis-aligne= d. diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 55214ce131..909e7ae994 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -266,7 +266,6 @@ struct qemu_work_item; * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU. * @numa_node: NUMA node this CPU is belonging to. - * @host_tid: Host thread ID. * @running: #true if CPU is currently running (lockless). * @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end; * valid under cpu_list_lock. @@ -321,7 +320,6 @@ struct CPUState { HANDLE hThread; #endif int thread_id; - uint32_t host_tid; bool running, has_waiter; struct QemuCond *halt_cond; bool thread_kicked; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cec8428589..cada188e58 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6216,7 +6216,6 @@ static void *clone_func(void *arg) thread_cpu =3D cpu; ts =3D (TaskState *)cpu->opaque; info->tid =3D gettid(); - cpu->host_tid =3D info->tid; task_settid(ts); if (info->child_tidptr) put_user_u32(info->tid, info->child_tidptr); --=20 2.13.0