From patchwork Thu Jul 13 14:24:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 107697 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp2373929obm; Thu, 13 Jul 2017 07:57:09 -0700 (PDT) X-Received: by 10.237.40.103 with SMTP id r94mr5293272qtd.205.1499957829551; Thu, 13 Jul 2017 07:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499957829; cv=none; d=google.com; s=arc-20160816; b=pIT/AgH4rxPhY2ZllLlYowvj8WBLSI8F8jQ7KGqckHfnD8jXxOpRTTSiMWdHTHX87w 9w0U7XFyLdfyObvyS9xzJV1zrYTnj+sUI98GXkcw/XvRhCoTSgt2U92GLhFJ1aJYAiMj ceiSZQ0Fwwykbb5x7P+31GzmmFIWwWRFVMeK+cdmieB8wGc6lUeIh+C0A0Mm9Pit9dN8 5WZI9XczcbtQ44qiGeR2pNo26v+Z7Y3ClLF7hHNZQZxqJH9AN/tvR/wOdJlFGnuWZ/oc GgUQKPBmteS+POfV314AZaY4ax6CSiPAPyVyNSDHRekg6VlvqRN1DdBAKZ1OF7WqZbSI uPkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=arbrowqiXXY1I5jnvtk2LC+cC4qs2l9RMhIv9E6O3oQ=; b=PHwjfltPJgbrz+VzHPPr3O4+qeULxXT6OIaOBUqFlry11vrrieKpKQsSmfFmRkqQU3 zJtckZGSubIf9pA8TRurzSMmvhz78o0i4KVXcy2Jstg8Tl29COe+3iIBA+CiP2LtB7xD 1rmeh67LUWtrES1EHZeM5WQ6xiRiAZr2tEU6nu0/Kpgfp+SlUVQhYIwZ3cSYIUPnki1D LTa6eT3E482dFiYObWexWnxGMNEIhLRMjUO5KGRGcDgoIFUaap11AYBkwADy+WFkcP23 Smtf0/+QUap2RZGSKTNywQtWT5gaZ252d3bGngrsoVE21dL4Eplgioy3W/T2HmSL3QVf VuVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.b=aUuNUqh3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id r49si5307366qte.305.2017.07.13.07.57.09 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.b=aUuNUqh3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:60518 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVfYB-0005rx-1C for patch@linaro.org; Thu, 13 Jul 2017 10:57:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVf4T-0001vJ-A9 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVf4P-0004L4-Dt for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:26:25 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVf4P-0004Kj-63 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:26:21 -0400 Received: by mail-wm0-f68.google.com with SMTP id p204so5456275wmg.1 for ; Thu, 13 Jul 2017 07:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=arbrowqiXXY1I5jnvtk2LC+cC4qs2l9RMhIv9E6O3oQ=; b=aUuNUqh3DyKjJ9Qf6dPQeIJ7qBmlbMtAdMei5uIhE/tccL96VSv28a3yqTRCyJnKTT e4p6YxPfBcRCdXmohLuNvBMrh/D95U67DNtdZo+eOEL0HbGHZpTD3OmdTXxeM5Jbiw5j ZgA/YzLdldMSwCjAJ3S8wcifsGNmkXsCXiIIJb7GeLxdhEu5AC22QCVLM1PYJxE83/jH TQhjD40CSBJ6VIiEvaBYzdD+5nOh0Vmfaf1MwTP6ggqay5d3Hx49tLVOtTcwXD66GUTL Usf5QI50hcdz2luDQ8QLj4fEgLu/wwdZW9HBzWT9CpPXas4vFpxqQMqcvzibEGtTy9C/ 3s1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=arbrowqiXXY1I5jnvtk2LC+cC4qs2l9RMhIv9E6O3oQ=; b=LM+Hh1CP7Pi5AQjTBOWRuRl2F6VOETH7nGuszFjNwA6/fqz0qQgO6bzPpb3VJErqk2 SUrmipxsgSjsYfcd80DbwlJV1/XD6q/IdceR3VLtoYoQaWu8srLUCFf0ZsJrN0BN0Stl 3B+kiM+5inFRvoQZ4ndIQ1K/f/tL8oND2jRaO7Km1x/QXasIfT9N+1vlGgKsN3y9LiLV /pqX77vvJSKEyqfrwZ7hsGop9rslWXJZilOsCm4DSmia4Qomq2AnM2HzAzseXk4fXncy CEeIAzlSU9KnZJRPO8UB08asYdX8fUAmGB331vfz8fA+rsmI0h/VQ9/JnXy3ycs/ov5a LfiQ== X-Gm-Message-State: AIVw111YkbyFGqD2uiD0OjBTR2qhwf0leJQHsSw5eIxn+UkmzidaYOMI XYGiQG41ne/0SUJnXe4= X-Received: by 10.28.22.6 with SMTP id 6mr2458059wmw.124.1499955919716; Thu, 13 Jul 2017 07:25:19 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id k75sm6042448wmh.10.2017.07.13.07.25.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:25:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 13 Jul 2017 16:24:19 +0200 Message-Id: <1499955874-10954-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499955874-10954-1-git-send-email-pbonzini@redhat.com> References: <1499955874-10954-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.68 Subject: [Qemu-devel] [PULL 26/41] 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: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée 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ée Reviewed-by: Greg Kurz Reviewed-by: Claudio Imbrenda Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20170712105216.747-4-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- 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(-) -- 1.8.3.1 diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index b550cee..19b2b8f 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 b1efe0b..378fdd8 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -64,7 +64,8 @@ static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr, static inline int cpu_gdb_index(CPUState *cpu) { #if defined(CONFIG_USER_ONLY) - return cpu->host_tid; + TaskState *ts = (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 7bfd50c..d3c783b 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 925ae11..003943b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6219,7 +6219,6 @@ static void *clone_func(void *arg) thread_cpu = cpu; ts = (TaskState *)cpu->opaque; info->tid = gettid(); - cpu->host_tid = info->tid; task_settid(ts); if (info->child_tidptr) put_user_u32(info->tid, info->child_tidptr);