From patchwork Fri Jun 2 13:05:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101247 Delivered-To: patch@linaro.org Received: by 10.182.202.35 with SMTP id kf3csp184574obc; Fri, 2 Jun 2017 06:06:53 -0700 (PDT) X-Received: by 10.200.11.193 with SMTP id p1mr7828328qti.221.1496408812946; Fri, 02 Jun 2017 06:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496408812; cv=none; d=google.com; s=arc-20160816; b=HDjKHPcX/cZ61tGSWPsIuTbtiyID/qBOUQa7lJzaxq3I/OZVIgSBXJzqLqPd9Zr2yh vJyxNJQx6IhZU3lVIGrG8GZ0l3UhFulIoiGY7738DTHDp9Mb3C5w8n7yo1DteoRQves4 g+ChvHcw06EbRWL5b/9a46VwbsjnyUE7chCKiwKZ3d4TDwWUk2R6335lAxQy3sNtNSXm uoCdd8St7i4fvqsVHp42OhWnnqRSnFXSMJNFT3d8NboiEZKJCTOm8ct2f5WaJT4NjN2a kvLKbO345FCRIrP9sWos32N/FbS+/WLTbkqe4YVPkGH1wu2EB3zOSXw51rLDtnQGimaG f6+Q== 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=/vgkPSMEl2YnnOoLebzx/r20nDGLFE6ysMUjmT0ACR4=; b=jtZAjvX7T4CBDCZEi5oGKmF6nccBUP5W8pZ1zaOyaQIgYUZ6iZG79mHrEED4dB7nJV PyQtPn34Z3mVs+xy81KWBotuvIMS5OsfX2xo6Rm6UoGm1p1GGpONpDTbxxtNMHR7nwPg AHp+xJkbz1qSGYk8RfxlPjC+SOhmuAacLrYc+X6pWQzd9SfT5WBSZ0mqeSzccVKWJ0yT VI6rk0tW8KXF7XlWtQpsxbNFTjXZ+yxloM8X0hU87fuY0hFF++v6TVkwtfq+f232jsTt 7ELyNlz1ybj7v0sskyeiZUhA9L3qlFhDI4BZmbuVCMP63OkIXNjSDyALt1snUguXl+3m 2tzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g65si21770059qke.238.2017.06.02.06.06.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 06:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGmHy-00079A-9e for patch@linaro.org; Fri, 02 Jun 2017 09:06:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGmGI-0006G6-SX for qemu-devel@nongnu.org; Fri, 02 Jun 2017 09:05:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGmGF-0002fd-I6 for qemu-devel@nongnu.org; Fri, 02 Jun 2017 09:05:06 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:34664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGmGF-0002fB-BE for qemu-devel@nongnu.org; Fri, 02 Jun 2017 09:05:03 -0400 Received: by mail-wr0-x234.google.com with SMTP id g76so6683896wrd.1 for ; Fri, 02 Jun 2017 06:05:03 -0700 (PDT) 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=/vgkPSMEl2YnnOoLebzx/r20nDGLFE6ysMUjmT0ACR4=; b=JUsJuddJ4y5i0rGIQhRz8lAvFG6EOIb+cgCvVFZYfch5/FxZ47KY1ATTfJOihtgOQm 0ZryqBgW74tBZSU0Mt7/PFG49By8XKjG+EmvmWhMkMRY4Rw+GWQ3XHQ33l6TgtyVzm41 AXcMdDxRFumKMgX+uaJe2RsqWdWCCcLdSeIxU= 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=/vgkPSMEl2YnnOoLebzx/r20nDGLFE6ysMUjmT0ACR4=; b=uRFdvT4vmrUFWdthBbpv29oNZKBjaOTyuXReLcc+A+E0hy37nqBoY2tvYFmLFRzHvI HS2j2SxtupPhHHnasC8a5SL6Y+6l2tOyTLIAdJ/JVZ7KpeB/ifphQzTYcHDR37YSpk4q ceXyjz+zuaIBMk2QFD4g/ZXjqTIgkY8jF7bznysgdNwk5/bBPV/LLgcoa6tw48zqkfl/ J/45YnL5CYzwSItjUc+a7KxKBv18IdkZGpzDTwBjEXkEAJsVN/JkH0oNzJE2nsV0z6VZ PlSbNu4k7DmCKzNJ4wlMOEeuvduQsVcTts/28+MZ6KyQo4UQNDrdKDIDY/RpovJ9cGdq 831w== X-Gm-Message-State: AODbwcDRrl3b56jocAkud8ykDNWpTlAgBMqjbctKxzq0Jth3MAlfJECC oa9hdbiSETV8Y+/w X-Received: by 10.223.154.195 with SMTP id a61mr4890392wrc.47.1496408702200; Fri, 02 Jun 2017 06:05:02 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x126sm2491100wme.12.2017.06.02.06.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 06:04:59 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 206B03E031F; Fri, 2 Jun 2017 14:05:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, pbonzini@redhat.com, doug16k@gmail.com, imbrenda@linux.vnet.ibm.com Date: Fri, 2 Jun 2017 14:05:17 +0100 Message-Id: <20170602130518.22943-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602130518.22943-1-alex.bennee@linaro.org> References: <20170602130518.22943-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PATCH v3 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_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Greg Kurz Reviewed-by: Claudio Imbrenda Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier --- v3 - fix merge, did move of function in previous commit --- gdbstub.c | 3 ++- include/qom/cpu.h | 2 -- linux-user/syscall.c | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) -- 2.13.0 diff --git a/gdbstub.c b/gdbstub.c index 57befe16e2..45a3a0b16b 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -63,7 +63,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 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 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 = 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);