From patchwork Fri Mar 18 22:39:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Feiner X-Patchwork-Id: 8624121 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD2F0C0553 for ; Fri, 18 Mar 2016 22:39:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0D5E20392 for ; Fri, 18 Mar 2016 22:39:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BE6520375 for ; Fri, 18 Mar 2016 22:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753818AbcCRWjU (ORCPT ); Fri, 18 Mar 2016 18:39:20 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:34075 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753744AbcCRWjR (ORCPT ); Fri, 18 Mar 2016 18:39:17 -0400 Received: by mail-pf0-f179.google.com with SMTP id x3so184920365pfb.1 for ; Fri, 18 Mar 2016 15:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=P7YIS4YLASaUGAANBCEYpX8Ys3pdoS93P4XewuRAT/s=; b=TejQD+8QnDF1i0J8OxZd2k0t+agaeErIqD0pyfmVvAdGXr8J0v7dRv6U16fOELDwi8 4PT+eO0rrSI8Y59s/0EBNSkJe/hQbV3iEwzlonah+l/RL+UBi1ngePhw5bwgmpiUteT7 Iu7AP4X9irL64eUdM8GRIrogSo3tmSdNqhAiDF+A1bTRmfpH5H7em1uGrATm4wLDqhqf Dlmcp2iw8KLzJokAzB0a9+YljU3nFpNWt/xfYLk+RsL6INNrVC27ylYHnUzuOhIb4ytQ lamv8anS97qyfyAGSXgRE/R32PlBRH1CbFx1iJ7RnRsd/Y9ntwCiKwCl4IOs9q3QdwCG AC3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=P7YIS4YLASaUGAANBCEYpX8Ys3pdoS93P4XewuRAT/s=; b=ArhykvihG27sOCLh+KmsqKHM76HXrjtCZlX4TZkX/Wy8rGJcukkwJ2wQj0Yl9uiRSo OhjROz8hlZxHFXpY4eDLLBAN4g7s8iyovIuxA0vWeXyhFvpK59Bt8qsmGrImaiouDKjz qZcneVxtQPkYuXGkTxizZ1PiT9/S8x+Ox4Ju0CeSQgVZuP3M7MOAGfjCiYya8Mt406nH ZglRPsbNIqvRJNRA1FWa6Jbc+3/eRIFASEUt5YYwpIAifv9MRmYsvXKeOoQp4MTKE7AE +dwbkJVCtkEAMkgSBDeWAWlbcosv4NQr3yyp++9IYNahcRlccPn+gq2x4s73aS7a6WHU Tp8A== X-Gm-Message-State: AD7BkJIsoNwoJkx76o7ph7zloyBsm3OJHTy8l4RC9vG0x+HKriRsLfSfWiQtbWH7zVBbtkds X-Received: by 10.98.42.211 with SMTP id q202mr26990978pfq.13.1458340756616; Fri, 18 Mar 2016 15:39:16 -0700 (PDT) Received: from localhost ([2620:0:1009:3:cd03:ef39:7648:4957]) by smtp.gmail.com with ESMTPSA id uh1sm23310296pab.26.2016.03.18.15.39.15 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 Mar 2016 15:39:15 -0700 (PDT) From: Peter Feiner To: jan.kiszka@siemens.com, pbonzini@redhat.com, kvm@vger.kernel.org Cc: pfeiner@google.com Subject: [PATCH kvm-unit-tests 2/4] x86: vmx: fix vm{launch, resume} early exit logic Date: Fri, 18 Mar 2016 15:39:10 -0700 Message-Id: X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If vmlaunch or vmresume returns immediately, there's definitely been an error -- rflags only needs to be consulted to determine what error occurred. By setting fail=1 unconditionally, the test framework will now detect problems with rflags *not* being set properly. Signed-off-by: Peter Feiner --- x86/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x86/vmx.c b/x86/vmx.c index b2e015f..27e85eb 100644 --- a/x86/vmx.c +++ b/x86/vmx.c @@ -911,6 +911,7 @@ static int vmx_run() u32 ret = 0, fail = 0; while (1) { + asm volatile ( "mov %%rsp, %%rsi\n\t" "mov %2, %%rdi\n\t" @@ -926,7 +927,7 @@ static int vmx_run() "vmresume\n\t" "2: " SAVE_GPR_C - "setbe %0\n\t" + "movl $1, %0\n\t" "jmp 3f\n\t" "vmx_return:\n\t" SAVE_GPR_C