From patchwork Thu Nov 17 00:23:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 21347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp135639wrr; Wed, 16 Nov 2022 16:25:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf6EK4a+C7JX3uYdD5A/j/iAGyf1jB198xMuyYVRPYDBG66imZNR+OQe6p5MLqLcIzUm6BLa X-Received: by 2002:a17:907:98f5:b0:7ad:b45d:810c with SMTP id ke21-20020a17090798f500b007adb45d810cmr229485ejc.181.1668644712010; Wed, 16 Nov 2022 16:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668644712; cv=none; d=google.com; s=arc-20160816; b=cYv4Md7dDapUY/yaDNqMF5vVSDrV6L3ILS/LvtU7xWvbu1blweJ+lIc/bueozqdxs+ DL9UqDdwaLw8vyQ1M1n+WuYrNJCIKl43bqpIU0Cvydu1dvLmqd99lVRHlZgvrNf+8WB2 Re9qR7sgIPCFNZwi8LgtVtmZ+1LTZ4yUBgOSHwTewiAZUi819ONPv6PhaL3mY/PgEu4T POC8BZIXvgXdj4Ab9e57xf6HhNHTRGgm2toO57vvgsaJSuxaJWxtA5E7TrdfKE/did+M PcTPYVcxkZnO6dAl1yuDJepL4mVcOMVK4BsK7Jhf6DQSdJca6ECP42amiIJO8YUtihDu kb5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=f1KDr+rH3XIqQLVQCEwig1RrLbtV2JH7CIwItqPq0uE=; b=IW6pW1p9ybGjGbmhHlMSyhFZJqARJokKdC4vjkwx9yrLgaBnAe6AqexWgiMkCH9Dyi C8y1PDPMpjCP8gJ9+XLtiGNC9CcTXEdJNWVOcYv49dMbT9/A0vw+3yyL5qvPjFayt9TZ 2QIFQPR9gr4rgQVLol8R0FZ4S7oUl/gmELdlYD/BqLwaQd0AoM4zHcTzpfyvGkcYqD7Q r9Jla9kRNV0GXGn7EeYZVmvzMj1/JlGu6xkvKhcikygZtv16ctcdqlZbL8NtncHzu2k1 bCxiRNfdutNsvaqGhy3T9GiTlMoPTVMbVwkNyQPYcdNe3OpYhMybwKshdFg0ATdlaH8E EiJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Sb0CLlnD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020aa7d357000000b0046844a8111dsi4910135edr.533.2022.11.16.16.24.49; Wed, 16 Nov 2022 16:25:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Sb0CLlnD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234393AbiKQAYC (ORCPT + 99 others); Wed, 16 Nov 2022 19:24:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234170AbiKQAYA (ORCPT ); Wed, 16 Nov 2022 19:24:00 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBE5B61BBB for ; Wed, 16 Nov 2022 16:23:58 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id b1-20020a17090a10c100b0020da29fa5e5so227314pje.2 for ; Wed, 16 Nov 2022 16:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=f1KDr+rH3XIqQLVQCEwig1RrLbtV2JH7CIwItqPq0uE=; b=Sb0CLlnDvxGcJjdPFEdXu3sQ7ExS0J2DsrUa96MG+x30pOPo41C8wX8lnkjEvFu692 o3pvJ4nlLGDjV9D5+o/Xc1NHyPs2MuqEv5vvIqZ+sqZzIL/ssXgFKRuEh3ykOWsb8Aof 8NuSb0SC0FoNWARBXd8nIP1nNXh5DasKaX+CcaBKFNHtvZl56/253TE6fwjP5JoMpiim gUPzWrrXnAvNi8nnM084PxpxGvTGH19Xn+GRoqghoBS14moljDfd44Cr3RqglOvym254 gzMKd+B+aCWjFP6TQW5RMTEuFyf2CyJjQHrsUsqBJWG2Qn401exrcaqrEcOx43Ax6pEw +BbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f1KDr+rH3XIqQLVQCEwig1RrLbtV2JH7CIwItqPq0uE=; b=PHLgzBinkcVhsyCqQGNVoBNxpwUc26rTiZeag3/erwEKzfmzehITTf0OYG7Oj84soy JoM50KXzT+baHF/Dgk+w+0pJEDJbtGd2UuvpqffCL2/GB3ulUqS7gGoM+6OYgo7tFv3k BQrHGb/iwGK7Ue8dX40kHuVzeDR7xYj2cCiRlmi+5j7LCOmjhE1kb5JDIe0hDx2BLM9U jCjhQVXNzfNky0Hg43ww53N4nWyGiYUm4EGhO/MqviYLEXpL7gQ19LjJUnAVhlDQAoHG SkCdPLC/yay7DNs+yfj/FeTDrtv0tWAapQXVShgXtFQoiqeaWov/AUnhGUtJkbUIqrSA EWrA== X-Gm-Message-State: ANoB5pmMp+V3iDMWBeQ7fDbhq9z7oW85j1aH3INDtFTFqe3sfw7C1bxx rUPNkW4BiA9hdh4xdAq4qI7iQ9JCnfI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:a17:b0:213:2708:8dc3 with SMTP id gg23-20020a17090b0a1700b0021327088dc3mr636229pjb.2.1668644638088; Wed, 16 Nov 2022 16:23:58 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 17 Nov 2022 00:23:49 +0000 In-Reply-To: <20221117002350.2178351-1-seanjc@google.com> Mime-Version: 1.0 References: <20221117002350.2178351-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221117002350.2178351-2-seanjc@google.com> Subject: [PATCH 1/2] KVM: arm64: selftests: Disable single-step with correct KVM define From: Sean Christopherson To: Marc Zyngier Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Reiji Watanabe , Sean Christopherson X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749700797930110853?= X-GMAIL-MSGID: =?utf-8?q?1749700797930110853?= Disable single-step by setting debug.control to KVM_GUESTDBG_ENABLE, not to SINGLE_STEP_DISABLE. The latter is an arbitrary test enum that just happens to have the same value as KVM_GUESTDBG_ENABLE, and so effectively disables single-step debug. No functional change intended. Cc: Reiji Watanabe Fixes: b18e4d4aebdd ("KVM: arm64: selftests: Add a test case for KVM_GUESTDBG_SINGLESTEP") Signed-off-by: Sean Christopherson Reviewed-by: Oliver Upton Reviewed-by: Reiji Watanabe --- tools/testing/selftests/kvm/aarch64/debug-exceptions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c index 947bd201435c..91f55b45dfc7 100644 --- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c +++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c @@ -369,7 +369,7 @@ void test_single_step_from_userspace(int test_cnt) KVM_GUESTDBG_SINGLESTEP; ss_enable = true; } else { - debug.control = SINGLE_STEP_DISABLE; + debug.control = KVM_GUESTDBG_ENABLE; ss_enable = false; } From patchwork Thu Nov 17 00:23:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 21348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp136257wrr; Wed, 16 Nov 2022 16:27:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf7SKCQqINDeOLBld0sXR8DTo/O5Rfydo9fnlKlrDRfSMXvqRfAEgY+E2sDEp6ru7ASTh2vA X-Received: by 2002:a17:903:447:b0:188:d78e:16ec with SMTP id iw7-20020a170903044700b00188d78e16ecmr190741plb.154.1668644834365; Wed, 16 Nov 2022 16:27:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668644834; cv=none; d=google.com; s=arc-20160816; b=See/+6dLvUv4AAb/JXeWestS0iSt29frlKpT0e4ZrAUvRgbk1xUlxQyz7NoFpxgvnc 4ktjAHJLyz7PkwcRtT9ymCkM0BInBgP5cIBjenS9CWlCKY6g1I1G9/LkUfBxO9/LfTBE NeZfaDz5qP2opk93omF51brJ+EeqtqVafhZ9Z6LlhH0yHg+BZPbug+2xwChM6+wnC/lW qKV6b2/qh1vH4RDZFXy+tmIDTOlWQhzZRlBbmIqYR6uOVIYcc4qWoOXUkWYqFu9yp8Ik D8EIcFsyVSOF93z1aAi35lmOEHXksgan82s7XmreZShTbJk+7ovHb42JK/BdRyUw1DDP 7YPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=OQIty0gkGvimYsfAtcoPy8df73fwY+kl22+jSnaHr3Q=; b=sUEbK9SKCrX2O+Mh9ev14n3zGQPHZ4GNQnPn6ZiLhhZWUClWio4427tpibfMQZDq9s AqstqjzBVgmefZwKpw9ZpOVE7e0U/P5wWGnv0+dT2hAyksmZAk5+EQqPHTeVdp7BA0rW 2laiSJO//eZiW/gvYk1mOACSTzxtwyN6DbCopSU8cELbNJqXyBpJ/2O6e1gokCEbPYQo 1sz/xW+fRPZu5Da3pkfQQMc3eNOOblIiXIYF+kaQ1HBCSZKwW7gQML9Zs4/a39BS2O4+ GByneakCRU38tvoFHPdpkUdwACpOBN15O3Qhfx2UZN0dnOtWyroQxuSaGpfEkp917D1z 7Pqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XawF3gkr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u131-20020a627989000000b00562b0b92756si16661116pfc.297.2022.11.16.16.27.01; Wed, 16 Nov 2022 16:27:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XawF3gkr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234364AbiKQAYE (ORCPT + 99 others); Wed, 16 Nov 2022 19:24:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234346AbiKQAYB (ORCPT ); Wed, 16 Nov 2022 19:24:01 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA28627C1 for ; Wed, 16 Nov 2022 16:24:00 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id v10-20020a17090a7c0a00b00215deac75b4so226248pjf.3 for ; Wed, 16 Nov 2022 16:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=OQIty0gkGvimYsfAtcoPy8df73fwY+kl22+jSnaHr3Q=; b=XawF3gkr8CSKZ24fVYfQH/likVJmqrI6J+VgfY0e5oCqzv9OjobeFrDLWibgksGjp1 bpT/73ID8XYCUWtDkHG2HllTtEz582TclewSThnNE0l3c5yF0jvFHZ1/ZL/wudSFnfNc 22czahecA+4YL4y5BIk2STkzJ4Sl4F0uiU6ADlDXxHmn4GtTD2LizNnfounT0TGHV1ul /PifA+5TNyMgrcAklqK6NQw2i1wpsS5JW7doMrokg2FmWTpQJbyYBuHmTEcGBLiW9ITd 7j6WcKeXgdmwApf4zSyXL5jmPW52XoIa3JdjF+0UF72NtCpSP+95c3KKIAP0X74sDOd8 MIUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OQIty0gkGvimYsfAtcoPy8df73fwY+kl22+jSnaHr3Q=; b=6csuKWjYzXG6UOEy7wQWRLlXe+IpgqQ5h4Na+xm0hb1IDaE7j46y4dXeAh1O2imtng XvjxkkVmb5MD1G6Y2Skj4MUDY3nX0Di4rusUIwRviwxu5VSvicPuQTt+3mViYsg8PQ86 RdbQL/7N57X7gKRXKvNP742HhMfSYkLASttoOqRi41P/qEp4LG8yMePy/RDnNxpSgRqP 9/ezDVn/l2C0iwqa++ImyEqWs/kp7sewfqEmgJVQM5P1uN2v1cjO3cEJNbLY4mhcH28S Rx1bg1jx40+f8lT/spGr1vg645h1D7TfIy3cCwOUE7ViGkQ080xQnphLggo+YSa6+dbq 5cBA== X-Gm-Message-State: ANoB5pmEDwNkfTfWrYrfetMdZQwFCjGYeMCES/ubzyjkH/CiwDkZC+Ed M/Ej0t5VDcVVnNxb1Mnf22FC2sP16fY= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:aa7:9628:0:b0:56d:c3af:2d7f with SMTP id r8-20020aa79628000000b0056dc3af2d7fmr464212pfg.64.1668644639816; Wed, 16 Nov 2022 16:23:59 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 17 Nov 2022 00:23:50 +0000 In-Reply-To: <20221117002350.2178351-1-seanjc@google.com> Mime-Version: 1.0 References: <20221117002350.2178351-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221117002350.2178351-3-seanjc@google.com> Subject: [PATCH 2/2] KVM: arm64: selftests: Disable single-step without relying on ucall() From: Sean Christopherson To: Marc Zyngier Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Reiji Watanabe , Sean Christopherson X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749700926288861174?= X-GMAIL-MSGID: =?utf-8?q?1749700926288861174?= Automatically disable single-step when the guest reaches the end of the verified section instead of using an explicit ucall() to ask userspace to disable single-step. An upcoming change to implement a pool-based scheme for ucall() will add an atomic operation (bit test and set) in the guest ucall code, and if the compiler generate "old school" atomics, e.g. 40e57c: c85f7c20 ldxr x0, [x1] 40e580: aa100011 orr x17, x0, x16 40e584: c80ffc31 stlxr w15, x17, [x1] 40e588: 35ffffaf cbnz w15, 40e57c <__aarch64_ldset8_sync+0x1c> the guest will hang as the local exclusive monitor is reset by eret, i.e. the stlxr will always fail due to the VM-Exit for the debug exception. Link: https://lore.kernel.org/all/20221006003409.649993-8-seanjc@google.com Cc: Oliver Upton Cc: Marc Zyngier Signed-off-by: Sean Christopherson Reviewed-by: Oliver Upton Reviewed-by: Reiji Watanabe --- .../selftests/kvm/aarch64/debug-exceptions.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c index 91f55b45dfc7..65cd7e4f07fa 100644 --- a/tools/testing/selftests/kvm/aarch64/debug-exceptions.c +++ b/tools/testing/selftests/kvm/aarch64/debug-exceptions.c @@ -241,7 +241,6 @@ static void guest_svc_handler(struct ex_regs *regs) enum single_step_op { SINGLE_STEP_ENABLE = 0, - SINGLE_STEP_DISABLE = 1, }; static void guest_code_ss(int test_cnt) @@ -258,7 +257,7 @@ static void guest_code_ss(int test_cnt) GUEST_SYNC(SINGLE_STEP_ENABLE); /* - * The userspace will veriry that the pc is as expected during + * The userspace will verify that the pc is as expected during * single step execution between iter_ss_begin and iter_ss_end. */ asm volatile("iter_ss_begin:nop\n"); @@ -268,11 +267,9 @@ static void guest_code_ss(int test_cnt) bvr = read_sysreg(dbgbvr0_el1); wvr = read_sysreg(dbgwvr0_el1); + /* Userspace disables Single Step when the end is nigh. */ asm volatile("iter_ss_end:\n"); - /* Disable Single Step execution */ - GUEST_SYNC(SINGLE_STEP_DISABLE); - GUEST_ASSERT(bvr == w_bvr); GUEST_ASSERT(wvr == w_wvr); } @@ -364,15 +361,12 @@ void test_single_step_from_userspace(int test_cnt) TEST_ASSERT(cmd == UCALL_SYNC, "Unexpected ucall cmd 0x%lx", cmd); - if (uc.args[1] == SINGLE_STEP_ENABLE) { - debug.control = KVM_GUESTDBG_ENABLE | - KVM_GUESTDBG_SINGLESTEP; - ss_enable = true; - } else { - debug.control = KVM_GUESTDBG_ENABLE; - ss_enable = false; - } + TEST_ASSERT(uc.args[1] == SINGLE_STEP_ENABLE, + "Unexpected ucall action 0x%lx", uc.args[1]); + debug.control = KVM_GUESTDBG_ENABLE | + KVM_GUESTDBG_SINGLESTEP; + ss_enable = true; vcpu_guest_debug_set(vcpu, &debug); continue; } @@ -385,6 +379,14 @@ void test_single_step_from_userspace(int test_cnt) "Unexpected pc 0x%lx (expected 0x%lx)", pc, test_pc); + if ((pc + 4) == (uint64_t)&iter_ss_end) { + test_pc = 0; + debug.control = KVM_GUESTDBG_ENABLE; + ss_enable = false; + vcpu_guest_debug_set(vcpu, &debug); + continue; + } + /* * If the current pc is between iter_ss_bgin and * iter_ss_end, the pc for the next KVM_EXIT_DEBUG should