From patchwork Thu Mar 3 01:09:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Feiner X-Patchwork-Id: 8487041 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 1BA06C0553 for ; Thu, 3 Mar 2016 01:09:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46A9C2021F for ; Thu, 3 Mar 2016 01:09:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 41462201FE for ; Thu, 3 Mar 2016 01:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754739AbcCCBJw (ORCPT ); Wed, 2 Mar 2016 20:09:52 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:33984 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbcCCBJu (ORCPT ); Wed, 2 Mar 2016 20:09:50 -0500 Received: by mail-pf0-f175.google.com with SMTP id 4so4231675pfd.1 for ; Wed, 02 Mar 2016 17:09:50 -0800 (PST) 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; bh=5KIqeS7Ms3nj67qEatw6rwNPtKrnFkCOnG1K49W1jPE=; b=LNVbfk7rAhdJVOUSe0fR1f0/AYyXuIX+8PLUtQi/jzKjSs2vLiZieDdYLFTfC7YrbU yguuvoK/0b5xzQC5byA35/YxxGorWnfzizWBlHU4Zkno0vObIROG6G7694LfYAD10Tt9 xgPTAFBL2NglEpzJhjZw2Z96x7s9c3UKZcQr7qZV6h/n00od0wGy/ugtpvMP4N7M5ZfF 2VXrH23RshOqc1yVk4YAxw+pRhfZLlEy6cgN+Q8vEG+H8llxkk8Eo9cwRNVc8rdinEnk ZMiyy1+TZEGVJOu69ZGneUDAq9uNY4fxFvioRfiDzyokz9SOZfM411i0mlDoG1EWALL4 /NwA== 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; bh=5KIqeS7Ms3nj67qEatw6rwNPtKrnFkCOnG1K49W1jPE=; b=guQm7H2wislsP5rwc+mmEoG/lbhJFpxeyZ9EMHqzkMonkK8qmoSNtumwTxTPEhuodY upAZ3Qg26dPslghjoHIHuiZGAo+pgFn4wOAmh1bwO0yAYMnssm0O5cfmq3/uc7MPiSVq +FeYr3Ai83kX/FuQ0SkaWs9DAfRPg90uHEHrinFyp3MAlcv2lKoq2T17LGm0CkgnKyPZ FKBvSUGRzHAoS5HqysA8CxifRrOdF+2KyZOKx5YsaZsvbsZNEp3fER4TTxAmnXH7IzAF cEIN6MhrCXc2sGt3oppR1Lwk1BAs8ZNT3vS532c1efHXCiVtTIyY2q66RV4KPwOGt1Ur vgtw== X-Gm-Message-State: AD7BkJKLE/wPNju5yaohzCRri01joXGOyDJE3wGdlXZgQqp7ppCGTOkG2WUTc2qp3GYoExVs X-Received: by 10.98.10.133 with SMTP id 5mr5702826pfk.75.1456967389499; Wed, 02 Mar 2016 17:09:49 -0800 (PST) Received: from localhost ([2620:0:1009:3:10b2:1b3a:febc:1b15]) by smtp.gmail.com with ESMTPSA id sj4sm16939574pab.43.2016.03.02.17.09.48 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 02 Mar 2016 17:09:49 -0800 (PST) From: Peter Feiner To: kvm@vger.kernel.org, drjones@redhat.com, pbonzini@redhat.com Cc: pfeiner@google.com Subject: [kvm-unit-tests v2 2/8] x86: emulator: disable test_lldt Date: Wed, 2 Mar 2016 17:09:32 -0800 Message-Id: <1456967378-6367-3-git-send-email-pfeiner@google.com> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1456967378-6367-1-git-send-email-pfeiner@google.com> References: <1456867658-10937-1-git-send-email-pfeiner@google.com> <1456967378-6367-1-git-send-email-pfeiner@google.com> 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 When compiled with -fno-omit-frame-pointer, test_lldt causes a triple fault, which insta-reboots the guest. I couldn't figure out why the triple-fault was happening, so I disabled the test outright. Knowing that the other emulator.c tests pass is more useful than a VM stuck in a reboot loop. On x86-64, this test was adding little value since it was broken to begin with: an LDT descriptor is 16 bytes on x86-64. The GDT limit was also bogus. I've fixed these problems for posterity. N.B. I only tested this on Linux 4.3.5. Perhaps lldt emulation has been fixed since then. Signed-off-by: Peter Feiner --- x86/emulator.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/x86/emulator.c b/x86/emulator.c index d990961..3730721 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -1006,10 +1006,17 @@ static void test_sreg(volatile uint16_t *mem) write_ss(ss); } +/* Broken emulation causes triple fault, which skips the other tests. */ +#if 0 static void test_lldt(volatile uint16_t *mem) { - u64 gdt[] = { 0, 0x0000f82000000ffffull /* ldt descriptor */ }; - struct descriptor_table_ptr gdt_ptr = { .limit = 0xffff, .base = (ulong)&gdt }; + u64 gdt[] = { 0, /* null descriptor */ +#ifdef __X86_64__ + 0, /* ldt descriptor is 16 bytes in long mode */ +#endif + 0x0000f82000000ffffull /* ldt descriptor */ }; + struct descriptor_table_ptr gdt_ptr = { .limit = sizeof(gdt) - 1, + .base = (ulong)&gdt }; struct descriptor_table_ptr orig_gdt; cli(); @@ -1021,6 +1028,7 @@ static void test_lldt(volatile uint16_t *mem) sti(); report("lldt", sldt() == *mem); } +#endif static void test_ltr(volatile uint16_t *mem) { @@ -1139,7 +1147,7 @@ int main() test_shld_shrd(mem); //test_lgdt_lidt(mem); test_sreg(mem); - test_lldt(mem); + //test_lldt(mem); test_ltr(mem); test_cmov(mem);