Message ID | 20240208204844.119326-1-thuth@redhat.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-58677-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp460741dyd; Thu, 8 Feb 2024 13:23:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhdTRPGJoXSf5+Skj7bF9AlsYNOxil7ZUaYNwOhW2YhCm8Vq+/6TTR+BIPfRQkHiZhy6h5 X-Received: by 2002:a17:90b:3510:b0:297:244:94d4 with SMTP id ls16-20020a17090b351000b00297024494d4mr505764pjb.43.1707427431334; Thu, 08 Feb 2024 13:23:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707427431; cv=pass; d=google.com; s=arc-20160816; b=Ava5pVJTqaM1FQ5Kz0djlV2IJWUpVSPKvG6K6gWpyJekTCZq4+K/lDnVzoVPfmDICO R08N1c6NiDTr12B9oAhBDfTwxctb/5seK3oR7K5OIMT0cx9ENenZtBGQqo76tb21AxhD 8Zc/gSKrCEZzT6O95TXSsiZ1iNO/IjvbD6oJqe2e5+OHoaw8DaSAstRH7+NofRgMwNVj qfNPtUkWFf6Z9rPMk/vABprENb7stuwD1CHDHz609IXV4wqrevSE/u3V+sqlY5oX2Bvw j0/osV2sfj9d7K/8SdqhqeFKCeoAwbA87rNWGaSitEqTbxZPgcz+bnMIHhnpNyCVhb3i maYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=NjzbgvZWqOOP842jfLLt5QLs4+yDffYTw25/cut6/mc=; fh=rdq0DcXUxM8dOt4qcvy2cFlhVpp6DbXETI0W8GTylxw=; b=xtDG3/AaysFhVCSOPCm2i+2ayC4BmMMO0T0no654f5vD+Cr+NiKEiemRngk0MUtc4F VFfEtsQXETll5VBF59/9w1LJbAhAH2Cb2VsbPy4qMPCl0GHV6jjxoocEVpelWegvm2FA XKo5rWehYyufIaGaJUq7eWM5Z3GLmmE7NVAInAyk6rdS/AK7oUtq61yPKb+47Y/F5ew2 qmNZF4Fbl1+SnX/MZUuMF75VrhquCx0jz9aNK6EF888iuOmoXo7c+6wIFtw6suhst8yK Wy/APosoLQAv0W+Wv0U5GKskzNFwVv9OhQOS0i9Sr7e7k4l61V9647sYicgaHMqIpWH+ CLFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KHz2HL8O; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-58677-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58677-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCXs2GSddxTwd7/CzR1cIaUVNBNfp51LjsJlk/tqiaQ/drASewJDdFg5qVr4/mKcPJnTyC3UnqUunjrJxRYjvb4zY5ITjA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id nc14-20020a17090b37ce00b00296181ae98esi350516pjb.180.2024.02.08.13.23.50 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:23:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58677-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KHz2HL8O; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-58677-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58677-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A7AF3B28D21 for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 20:49:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 231694F602; Thu, 8 Feb 2024 20:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KHz2HL8O" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2056381D1 for <linux-kernel@vger.kernel.org>; Thu, 8 Feb 2024 20:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425335; cv=none; b=ld2Qg+PzfC3uldJPPeHkXfZqJm2NNVsP4SQODfZp+Xe8y3of/cVkh+qNLphRf0AoEfQlGpAhAHwD6mWdohKaSEEPcev6xG1ExDISrj7NaPwFmFiN2WHhk8H0uZgKfNJyAeqnjHJtUosmOQs+kQiAjQ0ToUMLAqXXO/yWwlUdcuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425335; c=relaxed/simple; bh=hQPpfJEcu1TBw9wCkVbp3RFuJW56wCEGbFWMn8aip4k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=knFq5pAetdILysBs1DWaRv5aYUJ2tt1trmpbFEH0f/wzhvE4XIUvV3ROEsM7T9MEHBZAyCzaqbn/LL0/vPd5kQOyJkQcLiGfQEdajBHLTF+JRarWLB8B40OD01oXMVV1QOcBX7RXmNqaP5i03e4RLk3YVfPs0hYTGj1xMM9pPGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KHz2HL8O; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707425332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NjzbgvZWqOOP842jfLLt5QLs4+yDffYTw25/cut6/mc=; b=KHz2HL8ODyL8fe7OC3vB+LtiD8YGb10Eu2kOW7ku4G+GZR7Mv6Zrglbb8WU7rzCarHPxT9 kTJyqk5Bf3GCVXy1NciQevPmKWZJ5od2kz5p7p6U3SV77fWNz0iJRRYq/260L7Jl5YXqfW c+OX0dyKxPb3Ei+O0A1ff+pLf/lntG0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-Zf_C2lMwNNSk9wblRrq7XQ-1; Thu, 08 Feb 2024 15:48:48 -0500 X-MC-Unique: Zf_C2lMwNNSk9wblRrq7XQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 886B73810790; Thu, 8 Feb 2024 20:48:47 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id D81121C10C0C; Thu, 8 Feb 2024 20:48:45 +0000 (UTC) From: Thomas Huth <thuth@redhat.com> To: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com> Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>, Andrew Jones <ajones@ventanamicro.com> Subject: [PATCH v3 0/8] Use TAP in some more x86 KVM selftests Date: Thu, 8 Feb 2024 21:48:36 +0100 Message-ID: <20240208204844.119326-1-thuth@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790367426313361204 X-GMAIL-MSGID: 1790367426313361204 |
Series |
Use TAP in some more x86 KVM selftests
|
|
Message
Thomas Huth
Feb. 8, 2024, 8:48 p.m. UTC
Basic idea of this series is now to use the kselftest_harness.h framework to get TAP output in the tests, so that it is easier for the user to see what is going on, and e.g. to be able to detect whether a certain test is part of the test binary or not (which is useful when tests get extended in the course of time). Since most tests also need a vcpu, we introduce our own macros to define such tests, so we don't have to repeat this code all over the place. v3: - Add patch from Sean to allow setting vCPU's entry points seperately - Let each test define the entry point via KVM_ONE_VCPU_TEST(), don't do it globally from KVM_ONE_VCPU_TEST_SUITE() v2: - Dropped the "Rename the ASSERT_EQ macro" patch (already merged) - Split the fixes in the sync_regs_test into separate patches (see the first two patches) - Introduce the KVM_ONE_VCPU_TEST_SUITE() macro as suggested by Sean (see third patch) and use it in the following patches - Add a new patch to convert vmx_pmu_caps_test.c, too Sean Christopherson (1): KVM: selftests: Move setting a vCPU's entry point to a dedicated API Thomas Huth (7): KVM: selftests: x86: sync_regs_test: Use vcpu_run() where appropriate KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it KVM: selftests: Add a macro to define a test with one vcpu KVM: selftests: x86: Use TAP interface in the sync_regs test KVM: selftests: x86: Use TAP interface in the fix_hypercall test KVM: selftests: x86: Use TAP interface in the vmx_pmu_caps test KVM: selftests: x86: Use TAP interface in the userspace_msr_exit test .../selftests/kvm/include/kvm_test_harness.h | 36 ++++++ .../selftests/kvm/include/kvm_util_base.h | 11 +- .../selftests/kvm/lib/aarch64/processor.c | 23 +++- .../selftests/kvm/lib/riscv/processor.c | 9 +- .../selftests/kvm/lib/s390x/processor.c | 13 +- .../selftests/kvm/lib/x86_64/processor.c | 13 +- .../selftests/kvm/x86_64/fix_hypercall_test.c | 27 ++-- .../selftests/kvm/x86_64/sync_regs_test.c | 121 +++++++++++++----- .../kvm/x86_64/userspace_msr_exit_test.c | 52 ++------ .../selftests/kvm/x86_64/vmx_pmu_caps_test.c | 50 ++------ 10 files changed, 215 insertions(+), 140 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/kvm_test_harness.h
Comments
On Thu, 08 Feb 2024 21:48:36 +0100, Thomas Huth wrote: > Basic idea of this series is now to use the kselftest_harness.h > framework to get TAP output in the tests, so that it is easier > for the user to see what is going on, and e.g. to be able to > detect whether a certain test is part of the test binary or not > (which is useful when tests get extended in the course of time). > > Since most tests also need a vcpu, we introduce our own macros > to define such tests, so we don't have to repeat this code all > over the place. > > [...] OMG, you didn't tell me this allows sub-tests to run after a failed test! That alone is worth the conversion :-) There's definitely a few enhancements we'll want to make, but this is more than good enough as a starting point. Applied to kvm-x86 selftests, thanks! [1/8] KVM: selftests: x86: sync_regs_test: Use vcpu_run() where appropriate https://github.com/kvm-x86/linux/commit/e10086285659 [2/8] KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it https://github.com/kvm-x86/linux/commit/221d65449453 [3/8] KVM: selftests: Move setting a vCPU's entry point to a dedicated API https://github.com/kvm-x86/linux/commit/8ef192609f14 [4/8] KVM: selftests: Add a macro to define a test with one vcpu https://github.com/kvm-x86/linux/commit/992178c7219c [5/8] KVM: selftests: x86: Use TAP interface in the sync_regs test https://github.com/kvm-x86/linux/commit/04941eb15439 [6/8] KVM: selftests: x86: Use TAP interface in the fix_hypercall test https://github.com/kvm-x86/linux/commit/69fb12492005 [7/8] KVM: selftests: x86: Use TAP interface in the vmx_pmu_caps test https://github.com/kvm-x86/linux/commit/200f604dfd07 [8/8] KVM: selftests: x86: Use TAP interface in the userspace_msr_exit test https://github.com/kvm-x86/linux/commit/8fd14fc541c7 -- https://github.com/kvm-x86/linux/tree/next
On Mon, Feb 26, 2024, Sean Christopherson wrote: > On Thu, 08 Feb 2024 21:48:36 +0100, Thomas Huth wrote: > > Basic idea of this series is now to use the kselftest_harness.h > > framework to get TAP output in the tests, so that it is easier > > for the user to see what is going on, and e.g. to be able to > > detect whether a certain test is part of the test binary or not > > (which is useful when tests get extended in the course of time). > > > > Since most tests also need a vcpu, we introduce our own macros > > to define such tests, so we don't have to repeat this code all > > over the place. > > > > [...] > > OMG, you didn't tell me this allows sub-tests to run after a failed test! > That alone is worth the conversion :-) > > There's definitely a few enhancements we'll want to make, but this is more than > good enough as a starting point. > > Applied to kvm-x86 selftests, thanks! > > [1/8] KVM: selftests: x86: sync_regs_test: Use vcpu_run() where appropriate > https://github.com/kvm-x86/linux/commit/e10086285659 > [2/8] KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it > https://github.com/kvm-x86/linux/commit/221d65449453 > [3/8] KVM: selftests: Move setting a vCPU's entry point to a dedicated API > https://github.com/kvm-x86/linux/commit/8ef192609f14 > [4/8] KVM: selftests: Add a macro to define a test with one vcpu > https://github.com/kvm-x86/linux/commit/992178c7219c > [5/8] KVM: selftests: x86: Use TAP interface in the sync_regs test > https://github.com/kvm-x86/linux/commit/04941eb15439 > [6/8] KVM: selftests: x86: Use TAP interface in the fix_hypercall test > https://github.com/kvm-x86/linux/commit/69fb12492005 > [7/8] KVM: selftests: x86: Use TAP interface in the vmx_pmu_caps test > https://github.com/kvm-x86/linux/commit/200f604dfd07 > [8/8] KVM: selftests: x86: Use TAP interface in the userspace_msr_exit test > https://github.com/kvm-x86/linux/commit/8fd14fc541c7 FYI, the hashes have changed for patches 3-8, as I forced pushed to fix an ARM goof in patch 3. [1/8] KVM: selftests: x86: sync_regs_test: Use vcpu_run() where appropriate https://github.com/kvm-x86/linux/commit/e10086285659 [2/8] KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it https://github.com/kvm-x86/linux/commit/221d65449453 [3/8] KVM: selftests: Move setting a vCPU's entry point to a dedicated API https://github.com/kvm-x86/linux/commit/53a43dd48f8e [4/8] KVM: selftests: Add a macro to define a test with one vcpu https://github.com/kvm-x86/linux/commit/55f2cf88486c [5/8] KVM: selftests: x86: Use TAP interface in the sync_regs test https://github.com/kvm-x86/linux/commit/ba97ed0af6fe [6/8] KVM: selftests: x86: Use TAP interface in the fix_hypercall test https://github.com/kvm-x86/linux/commit/a6983e8f5fab [7/8] KVM: selftests: x86: Use TAP interface in the vmx_pmu_caps test https://github.com/kvm-x86/linux/commit/de1b03f25f3b [8/8] KVM: selftests: x86: Use TAP interface in the userspace_msr_exit test https://github.com/kvm-x86/linux/commit/8d251856d425