From patchwork Mon Sep 23 16:13:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13809832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81D38CF9C72 for ; Mon, 23 Sep 2024 16:25:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sslpw-0007iV-Is; Mon, 23 Sep 2024 12:22:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sslpi-0006lW-BF for qemu-devel@nongnu.org; Mon, 23 Sep 2024 12:22:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sslpg-0000ce-0C for qemu-devel@nongnu.org; Mon, 23 Sep 2024 12:22:41 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48NDTSxS022624; Mon, 23 Sep 2024 16:22:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=4jKFaE+nAcKFG HgVUI61x15jdvMo3CEXemOHI19GnaM=; b=dz5ioy4NbwdoktqQxOFLsNmxQ3yrR HYBERNFsa3EpRWg2YnMXiQ1/icTwAtPxnUfa9WiQkPbVqkyoX2vIE7CfJTPSKCBV SKOb8WssbuTEAr35OQH6QyIvbXL0L4LM5hkDfdO0BYtKEJ5bBseK9NxkpbyEygO7 KcE/+E4cNvjsfdXA9Kchp4uuck/insboE6qu7/B+NHNPIWyWx/JDT6hlssaOPwKz e49afvQRxgYQLndo39KB+cw7TjfPFpXa4NctDSc6OfU8gu5tHAMlBPuWDKIgcLRR coTbPozizYTtFCahtwCrS8GArO3iUFMMxTbutrbQ63A6IBHe2lG/zOz6g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 41skjrd0ey-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2024 16:22:27 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 48NGML0R024405; Mon, 23 Sep 2024 16:22:26 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 41skjrd0ev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2024 16:22:26 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 48NEwlMC014009; Mon, 23 Sep 2024 16:22:26 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 41t9ymqcy6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Sep 2024 16:22:26 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 48NGMOPr52232600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Sep 2024 16:22:24 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1422A2004E; Mon, 23 Sep 2024 16:22:24 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B31342004D; Mon, 23 Sep 2024 16:22:23 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.179.24.235]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 23 Sep 2024 16:22:23 +0000 (GMT) From: Ilya Leoshkevich To: Richard Henderson , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Cc: qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH 17/18] gdbstub: Pause all CPUs before sending stop replies Date: Mon, 23 Sep 2024 18:13:12 +0200 Message-ID: <20240923162208.90745-18-iii@linux.ibm.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240923162208.90745-1-iii@linux.ibm.com> References: <20240923162208.90745-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CFdM_Cj9pRsyXbBe-C7LFlP1tMGBXB3J X-Proofpoint-ORIG-GUID: DMKLeepD6df2pdo_EtWlC2JgrNJzXbGi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-23_12,2024-09-23_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 spamscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxlogscore=489 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2408220000 definitions=main-2409230117 Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This is required by the GDB remote protocol. Signed-off-by: Ilya Leoshkevich --- gdbstub/gdbstub.c | 2 ++ gdbstub/user.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index a096104b07a..be632f8b214 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -2497,6 +2497,8 @@ bool gdb_try_stop(void) return false; } + pause_all_vcpus(); + gdbserver_state.allow_stop_reply = false; return true; } diff --git a/gdbstub/user.c b/gdbstub/user.c index 82007b09db6..3095c846a99 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -458,6 +458,7 @@ static void disable_gdbstub(CPUState *thread_cpu) cpu_breakpoint_remove_all(cpu, BP_GDB); /* no cpu_watchpoint_remove_all for user-mode */ cpu_single_step(cpu, 0); + cpu_resume(cpu); } tb_flush(thread_cpu); } @@ -650,9 +651,16 @@ int gdb_continue_partial(char *newstates) * previous situation, where only one CPU would be single-stepped. */ CPU_FOREACH(cpu) { - if (newstates[cpu->cpu_index] == 's') { + switch (newstates[cpu->cpu_index]) { + case 's': trace_gdbstub_op_stepping(cpu->cpu_index); cpu_single_step(cpu, gdbserver_state.sstep_flags); + QEMU_FALLTHROUGH; + case 'c': + case 'C': + case 'S': + cpu_resume(cpu); + break; } } gdbserver_user_state.running_state = 1;