Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F93A7F for ; Tue, 13 Dec 2022 00:16:57 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id k7-20020a256f07000000b006cbcc030bc8so14841959ybc.18 for ; Mon, 12 Dec 2022 16:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=rrmKIRMf4Mq2msGAMjuH9G/DlO6PhwIb4et9Vyytf0s=; b=Y/SoLe17F+HoJZwya7YFOMVPVWxIyS8YXDXAdkZKURoZhYboc1qqDhxRYkM8qd/fyn zV4AKnvonZDIf4kBxS6BbqKkYvK++Z8SlakM9rrpZf/WnJthiD/WaPvC4mId1Hi85VXx HEnTLJKfq/AiMkE+A1lvFD7n5RUyEVn7KE12qMAkazwYdkxp/onbTYKAwGSZxx/+wvCu AkCHnFjwsiycANQDr7f8nJl13jr3Aq6KbcvSvBjixq+cK42hwQ3dC8wgvpt4LO7Wo9ul DCX6EzwtU8238LHHvhH1M16EyNBESvafX2Bsjx0/y3efzS0Lla4Z0vEPMEkwmHimVswS SmYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rrmKIRMf4Mq2msGAMjuH9G/DlO6PhwIb4et9Vyytf0s=; b=NRmldBSzFZDG7RlAawMhuvd8S/vAW3MEMNj7ujm7UTb28VHz3DfheJAMoV0YDFoloU P+Z4lBXiZEiNXs0RbYA7G5aVZMN60HBwDYI45rsEOOo0OXIxwd2+XvhcgFdroQisXp4K TB9DLpwD/gcbFFS81AhDAx43EzNBsGW5l9mvx5hgf+sejWGi9EEgJfFLCMJw5WuOGI2U mF5RbKbXW7SESuYq4yi91nq9Jtg1zKQFhGjJWvacYZZZbC7me8bRQlZBS9X9++YauEgt kOuQEt+2l1QYJ8J4UI/dpbneqTZRKhOperuLNM4d9RAJL7/xoafljaNPfrhtGjcxST8Y n6aw== X-Gm-Message-State: ANoB5pnTvoni5XL2NMPUwiRlSUGNUOCMnhWHgOIWqUJxCAYzcqUN07Oi 1NaMV2I5d3TXjl/U72WRU5nJ2aVpYNs= X-Google-Smtp-Source: AA0mqf6/pKu0pWWW1KBsbsV+bRwkpXaD3AJngXQVdm+DqVUnownROWyJFsvs/+l4EXLP/kxHJtplxf44+Wk= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:2397:0:b0:724:2a55:aadb with SMTP id j145-20020a252397000000b007242a55aadbmr1005565ybj.576.1670890616579; Mon, 12 Dec 2022 16:16:56 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 13 Dec 2022 00:16:39 +0000 Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.rc1.256.g54fd8350bd-goog Message-ID: <20221213001653.3852042-1-seanjc@google.com> Subject: [PATCH 00/14] KVM: selftests: Clang fixes, Makefile cleanup From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Tom Rix , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Ricardo Koller , Sean Christopherson , Aaron Lewis , Raghavendra Rao Ananta Content-Type: text/plain; charset="UTF-8" Message-ID: <20221213001639.JSAYSq0Q0uw52HhfsHZmkymtfmRhOU08bQlZhBvEz1U@z> Fix a variety of KVM selftests issues exposed by clang, and rework the Makefile and .gitignore to reduce the maintenance burden of selftests. For the Makefile, programmatically generate the list of targets by looking for .c files, and opt-out via a dummy macro in the source instead of forcing architectures to opt-in. The opt-out approach is less error prone (harder to forget to add an arch), doesn't generate unnecessary conflicts if multiple tests are added simultanesouly, and makes it much easier to understand which tests aren't supported, e.g. $ git grep TEST_UNSUPPORTED | grep aarch64 hardware_disable_test.c:TEST_UNSUPPORTED(aarch64); max_guest_memory_test.c:TEST_UNSUPPORTED(aarch64); system_counter_offset_test.c:TEST_UNSUPPORTED(aarch64); This all started when trying to reproduce clang build errors reported by Raghu and Aaron that were introduced by commit 6b6f71484bf4 ("KVM: selftests: Implement memcmp(), memcpy(), and memset() for guest use"). Just getting selftests to compile with clang was a nightmare, as it took me several hours to realize that "CC=clang make" and "make CC=clang" aren't equivalent, and that the "include ../lib.mak" buried halfway through the Makefile was overriding "CC=clang make". After too many hours fighting to get clang working, my frustration with the Makefile boiled over a bit... Note, I have fixes for the RISC-V RSEQ bugs (outside of selftests/kvm) that I'll post separately. Tested on x86 and arm, build tested on s390x and RISC-V, all with both gcc and clang. Sean Christopherson (14): KVM: selftests: Define literal to asm constraint in aarch64 as unsigned long KVM: selftests: Delete dead code in x86_64/vmx_tsc_adjust_test.c KVM: selftests: Fix divide-by-zero bug in memslot_perf_test KVM: selftests: Use pattern matching in .gitignore KVM: selftests: Fix a typo in x86-64's kvm_get_cpu_address_width() KVM: selftests: Rename UNAME_M to ARCH_DIR, fill explicitly for x86 KVM: selftests: Use proper function prototypes in probing code KVM: selftests: Probe -no-pie with actual CFLAGS used to compile KVM: selftests: Explicitly disable builtins for mem*() overrides KVM: selftests: Include lib.mk before consuming $(CC) KVM: selftests: Disable "gnu-variable-sized-type-not-at-end" warning KVM: selftests: Use wildcards to find library source files KVM: selftests: Use wildcards to find targets and test source files KVM: selftests: Enable RSEQ test for RISC-V tools/testing/selftests/kvm/.gitignore | 91 +------ tools/testing/selftests/kvm/Makefile | 229 +++--------------- .../selftests/kvm/aarch64/page_fault_test.c | 2 +- .../selftests/kvm/access_tracking_perf_test.c | 3 + .../selftests/kvm/dirty_log_perf_test.c | 3 + .../selftests/kvm/hardware_disable_test.c | 4 + .../testing/selftests/kvm/include/test_util.h | 11 + .../selftests/kvm/lib/x86_64/processor.c | 2 +- .../selftests/kvm/max_guest_memory_test.c | 4 + .../kvm/memslot_modification_stress_test.c | 3 + .../testing/selftests/kvm/memslot_perf_test.c | 6 + tools/testing/selftests/kvm/steal_time.c | 3 + .../kvm/system_counter_offset_test.c | 4 + .../kvm/x86_64/vmx_tsc_adjust_test.c | 5 - 14 files changed, 80 insertions(+), 290 deletions(-) base-commit: f1a1d3aff0cc2e68a9ebbd8810d7dcd8cfe2714b -- 2.39.0.rc1.256.g54fd8350bd-goog