From nobody Sat Feb 7 06:55:46 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.zohomail.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 1499856968351147.9359772534317; Wed, 12 Jul 2017 03:56:08 -0700 (PDT) Received: from localhost ([::1]:51703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVFJP-0006yK-3p for importer@patchew.org; Wed, 12 Jul 2017 06:56:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVFGo-0004jK-QV for qemu-devel@nongnu.org; Wed, 12 Jul 2017 06:53:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVFGl-00020F-NZ for qemu-devel@nongnu.org; Wed, 12 Jul 2017 06:53:26 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34058) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVFGl-0001zh-HS for qemu-devel@nongnu.org; Wed, 12 Jul 2017 06:53:23 -0400 Received: by mail-wr0-f176.google.com with SMTP id 77so28342456wrb.1 for ; Wed, 12 Jul 2017 03:53:23 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 143sm2469838wmg.9.2017.07.12.03.52.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Jul 2017 03:52:19 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 335823E08FA; Wed, 12 Jul 2017 11:52:17 +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=TS4LOcMtR8F8ENWKcSA6UF3p+XUn+M+VO0pxw9VOPco=; b=kgejAX7hYxl+sUoeD4tT9QLmWCTmcyq+F3gpawCXrMH60LXOjKRlhqljUWka+Sr5eW LEauwKWk58O02Gub3gwxXi8UT1rv5RlCjDkC2LiaVS9Ogt+8ARBSgJ9uX1SK11KuLXeC kfOC2p/B4Tjcww9afy5mYlwlwQ7IcjMLsk9Rw= 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=TS4LOcMtR8F8ENWKcSA6UF3p+XUn+M+VO0pxw9VOPco=; b=i7rSl2zGq+WtR1N7wuOyE5pv7832So1Qvc5RYnSv7Aao1euPXBFeFuJrKUyXYC6No3 KP/waGEt6n6yhJYN/GgzI4by+QHHs8EebT2d9OrF96WuHgNHf/SgiBgRJmbrHUkHo3Uv rSnIfFjWGcjuQf6YOfmfEXZIncDXgTvY+VSXyjGy6548x8MFloNdHnnCgqDzB3cDQ86P i0kapn1P31yYgWZZCQ4M1i2a3E7UsWf6p7Aqeyx5LfGCCuQfKy32rF1NmfMdNJc6ZnNR Pp1aTf/7joGJQth2nNJA866WEP4Td/Q14OYQgqjvEZgyPbvx+6/FbyhiI4fbEOugIkYt NO7A== X-Gm-Message-State: AIVw110wkswMbEXQyZv2GW57y5/XaVoUMndphNj882astmNjmjcprHbT 3y51IwGhVIyg5Pb68KnVCQ== X-Received: by 10.28.221.85 with SMTP id u82mr1880367wmg.40.1499856742175; Wed, 12 Jul 2017 03:52:22 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: pbonzini@redhat.com Date: Wed, 12 Jul 2017 11:52:15 +0100 Message-Id: <20170712105216.747-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170712105216.747-1-alex.bennee@linaro.org> References: <20170712105216.747-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.176 Subject: [Qemu-devel] [PATCH v4 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. To prevent BSD failing to build I've included ts_tid into its TaskStruct but not populated it - which was the same state as the old cpu->host_tid. I'll leave it up to the BSD maintainers to actually populate this properly if they want a working gdbstub with user-threads. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Greg Kurz Reviewed-by: Claudio Imbrenda Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- v4 - add host_tid field for BSD (but don't populate it) v3 - fix merge, did move of function in previous commit --- bsd-user/qemu.h | 2 ++ gdbstub.c | 3 ++- include/qom/cpu.h | 2 -- linux-user/syscall.c | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index b550cee0cb..19b2b8fecb 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -85,6 +85,8 @@ struct emulated_sigtable { /* NOTE: we force a big alignment so that the stack stored after is aligned too */ typedef struct TaskState { + pid_t ts_tid; /* tid (or pid) of this task */ + struct TaskState *next; int used; /* non zero if used */ struct image_info *info; diff --git a/gdbstub.c b/gdbstub.c index 6b56f55eba..484e96dbd9 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -64,7 +64,8 @@ static inline int target_memory_rw_debug(CPUState *cpu, t= arget_ulong addr, static inline int cpu_gdb_index(CPUState *cpu) { #if defined(CONFIG_USER_ONLY) - return cpu->host_tid; + TaskState *ts =3D (TaskState *) cpu->opaque; + return ts->ts_tid; #else return cpu->cpu_index + 1; #endif diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 7bfd50cc32..d3c783b4b5 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -265,7 +265,6 @@ struct qemu_work_item; * @cpu_index: CPU index (informative). * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU. - * @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. @@ -319,7 +318,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 925ae11ea6..003943b736 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6219,7 +6219,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