From patchwork Mon Dec 14 21:24:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= X-Patchwork-Id: 7849041 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EAD689F350 for ; Mon, 14 Dec 2015 21:25:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EC462028D for ; Mon, 14 Dec 2015 21:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4094020279 for ; Mon, 14 Dec 2015 21:25:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932437AbbLNVYh (ORCPT ); Mon, 14 Dec 2015 16:24:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37362 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932390AbbLNVYg (ORCPT ); Mon, 14 Dec 2015 16:24:36 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 70775C00124A for ; Mon, 14 Dec 2015 21:24:36 +0000 (UTC) Received: from potion (dhcp-1-105.brq.redhat.com [10.34.1.105]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id tBELOYa5003245; Mon, 14 Dec 2015 16:24:34 -0500 Received: by potion (sSMTP sendmail emulation); Mon, 14 Dec 2015 22:24:33 +0100 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: kvm@vger.kernel.org Cc: Paolo Bonzini , Andrew Jones Subject: [PATCH kvm-unit-tests 3/6] x86/pmu: expect failure with nmi_watchdog Date: Mon, 14 Dec 2015 22:24:18 +0100 Message-Id: <1450128261-21170-4-git-send-email-rkrcmar@redhat.com> In-Reply-To: <1450128261-21170-1-git-send-email-rkrcmar@redhat.com> References: <1450128261-21170-1-git-send-email-rkrcmar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Host's nmi_watchdog takes one slot, making the "all counters" unit-test fail. We know exactly what happens, mark it as expected failure. PMU test is now executed regardless of host_nmi_watchdog. Signed-off-by: Radim Kr?má? --- x86/pmu.c | 9 ++++++++- x86/unittests.cfg | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/x86/pmu.c b/x86/pmu.c index c68980044dee..4ca93235b977 100644 --- a/x86/pmu.c +++ b/x86/pmu.c @@ -92,6 +92,7 @@ struct pmu_event { }; static int num_counters; +bool host_nmi_watchdog; char *buf; @@ -291,7 +292,7 @@ static void check_counters_many(void) if (!verify_counter(&cnt[i])) break; - report("all counters", i == n); + report_xfail("all counters", host_nmi_watchdog, i == n); } static void check_counter_overflow(void) @@ -374,6 +375,7 @@ static void check_rdpmc(void) int main(int ac, char **av) { + int i; struct cpuid id = cpuid(10); setup_vm(); @@ -385,6 +387,11 @@ int main(int ac, char **av) ebx.full = id.b; edx.full = id.d; + /* XXX: horrible command line parsing */ + for (i = 1; i < ac; i++) + if (!strcmp(av[i], "host_nmi_watchdog=1")) + host_nmi_watchdog = true; + if (!eax.split.version_id) { printf("No pmu is detected!\n"); return report_summary(); diff --git a/x86/unittests.cfg b/x86/unittests.cfg index ffffc15c86df..6b94ad93dcf0 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -106,8 +106,7 @@ file = msr.flat [pmu] file = pmu.flat -extra_params = -cpu host -check = /proc/sys/kernel/nmi_watchdog=0 +extra_params = -cpu host -append "host_nmi_watchdog=`cat /proc/sys/kernel/nmi_watchdog`" [port80] file = port80.flat