From nobody Fri Apr 3 10:56:02 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 87DB823817E for ; Fri, 20 Feb 2026 00:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771548165; cv=none; b=gk1oQdtDRGr2LHLBLzJsPHQvGxhGI7/KGtBXTFXz0fAbNcKc//fJfGH4vwtc7nKrhKK3eFkoEBRhpn+fejmjdzPnPrOf6fg1aCdzkVENAFu+rw++jKr+BbPNox7Dq5fVJW7V+b0JbZAHwJLFigdAC8U/YSgOFpvr6nPkYPl/drg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771548165; c=relaxed/simple; bh=nH/oZx+MWc3okEfNxfsJz9eIFuH8YKkF2kK0VK510Eg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=DtOOIxgF233PMoGxzbkTbYv82zx/drtGpz89qKOpq9LwV1ePOh7Kh3NU+N96q9vtKQq4To9K+LImxSQAWzYVoaPQMbG59oDS9up5iUguvLrvf284mOGSoJIBzRQvQHXMHzGnn40miPeJYuVWI47lx4HDABrRrjfXhd/XwjTEW1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TSE8+b8o; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TSE8+b8o" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2ad147cdf07so15131485ad.2 for ; Thu, 19 Feb 2026 16:42:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771548163; x=1772152963; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Bi3zoi6MjjV0Hs43Xpr7yQXYkYqYcEbMxP5Vqzg+1oE=; b=TSE8+b8oPemFStY+msnLMXacIYA5JhhA+6ALQ/SVhkKOx0+2n4+xh2yTl5x3JudL8T FrUQRa8FrAk+56xFNhaGssFNLRVCMZyGDDDNF0A4OumVbqHruP0WRd/RTc3RFfVeiz1u RxTm4hzuQfIIxxeXbyGKRRBh/b2oSLp4ZszX78ZClh+cznwVE3oBW72LDz+bhmrpgrQP omTLpfaY0/GD9kszYcm0vJtDG8N4dW/mg4dmiXBR5ZS2ti/s99rvoRYMfezJ2Zg4FRMC CqU9TljrN/R9aEtGwGwzI/RY35/WAnpgHL0vh+qrTVTHVxKH+ud9WnCZlsPGVYP6HOGK KSug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771548163; x=1772152963; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bi3zoi6MjjV0Hs43Xpr7yQXYkYqYcEbMxP5Vqzg+1oE=; b=sr/s8EZ2NiUwzxI8pAZxGF1ect86X0YR28SK60gzo9lFS5z4P/xXK0DrfEKqh/QkOB jiwlou52rQXZowlokk19Pqp9vhB5UNLT+BKCWbmMCOgZQ4d2L3csgxQZbcfmQXqoNl+E GNIRMRR1CaZ/Drj7UL04hXPT3bVLS+OWTmWaOdsx/lBZy7KZrZhg1zWLJAVHhlNHElKZ HPz35Sl0qRs25/OmAXslh7OXdWZWv9z4I6T+lqEVnUV2J8ybI1OpZRR4QzQKDl0LNdAE ddVLTdB7/AFIQuazViwYverY1/28lwaS5wxU41HBowGaYpEg3wdofiWgl3w4alySGYLN +xwQ== X-Forwarded-Encrypted: i=1; AJvYcCWI0XQINPsmUkDuI2O1f63KOLwPaj+O6PwvYkPVQmzPCnuDQOVycSHMtVWokmjKtTIoowliBpbbl2mm2/U=@vger.kernel.org X-Gm-Message-State: AOJu0YwQ4ECgZPCGzVmgmldqj+4MELRW9rl5mMB25nXfEctYVPkmCShT Cy/zfrPVuO8aKw1jfwfNMpisuwsJvjdG/mG8aSf78/PuCbBYAiWVwd4yTelFHEXT0cxUVvzfKP3 V/TkOoyvDNrSMAQ== X-Received: from plrt9.prod.google.com ([2002:a17:902:b209:b0:2a9:5ed9:f590]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ec82:b0:295:ceaf:8d76 with SMTP id d9443c01a7336-2ad1752516amr180602525ad.47.1771548162506; Thu, 19 Feb 2026 16:42:42 -0800 (PST) Date: Fri, 20 Feb 2026 00:42:18 +0000 In-Reply-To: <20260220004223.4168331-1-dmatlack@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260220004223.4168331-1-dmatlack@google.com> X-Mailer: git-send-email 2.53.0.414.gf7e9f6c205-goog Message-ID: <20260220004223.4168331-6-dmatlack@google.com> Subject: [PATCH v2 05/10] KVM: selftests: Use s64 instead of int64_t From: David Matlack To: Paolo Bonzini Cc: Ackerley Tng , Albert Ou , Alexandre Ghiti , Andrew Jones , Anup Patel , Atish Patra , Bibo Mao , Christian Borntraeger , Claudio Imbrenda , Colin Ian King , David Hildenbrand , David Matlack , Fuad Tabba , Huacai Chen , James Houghton , Janosch Frank , Joey Gouly , kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Lisa Wang , loongarch@lists.linux.dev, Marc Zyngier , Maxim Levitsky , Nutty Liu , Oliver Upton , Palmer Dabbelt , Paul Walmsley , "Pratik R. Sampat" , Rahul Kumar , Sean Christopherson , Shuah Khan , Suzuki K Poulose , Tianrui Zhao , Wu Fei , Yosry Ahmed , Zenghui Yu Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use s64 instead of int64_t to make the KVM selftests code more concise and more similar to the kernel (since selftests are primarily developed by kernel developers). This commit was generated with the following command: git ls-files tools/testing/selftests/kvm | xargs sed -i 's/int64_t/s64/g' Then by manually adjusting whitespace to make checkpatch.pl happy. No functional change intended. Signed-off-by: David Matlack --- tools/testing/selftests/kvm/arm64/sea_to_user.c | 2 +- tools/testing/selftests/kvm/arm64/set_id_regs.c | 2 +- tools/testing/selftests/kvm/guest_print_test.c | 2 +- tools/testing/selftests/kvm/include/test_util.h | 4 ++-- tools/testing/selftests/kvm/lib/test_util.c | 16 ++++++++-------- .../testing/selftests/kvm/lib/userfaultfd_util.c | 2 +- tools/testing/selftests/kvm/lib/x86/processor.c | 2 +- tools/testing/selftests/kvm/memslot_perf_test.c | 2 +- tools/testing/selftests/kvm/steal_time.c | 4 ++-- tools/testing/selftests/kvm/x86/kvm_clock_test.c | 2 +- .../selftests/kvm/x86/nested_tsc_adjust_test.c | 6 +++--- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/kvm/arm64/sea_to_user.c b/tools/testin= g/selftests/kvm/arm64/sea_to_user.c index 61954f2221e4..7285eade4acf 100644 --- a/tools/testing/selftests/kvm/arm64/sea_to_user.c +++ b/tools/testing/selftests/kvm/arm64/sea_to_user.c @@ -59,7 +59,7 @@ static bool far_invalid; static u64 translate_to_host_paddr(unsigned long vaddr) { u64 pinfo; - int64_t offset =3D vaddr / getpagesize() * sizeof(pinfo); + s64 offset =3D vaddr / getpagesize() * sizeof(pinfo); int fd; u64 page_addr; u64 paddr; diff --git a/tools/testing/selftests/kvm/arm64/set_id_regs.c b/tools/testin= g/selftests/kvm/arm64/set_id_regs.c index b88fddd71fa1..19f4a612137f 100644 --- a/tools/testing/selftests/kvm/arm64/set_id_regs.c +++ b/tools/testing/selftests/kvm/arm64/set_id_regs.c @@ -36,7 +36,7 @@ struct reg_ftr_bits { * For FTR_EXACT, safe_val is used as the exact safe value. * For FTR_LOWER_SAFE, safe_val is used as the minimal safe value. */ - int64_t safe_val; + s64 safe_val; }; =20 struct test_feature_reg { diff --git a/tools/testing/selftests/kvm/guest_print_test.c b/tools/testing= /selftests/kvm/guest_print_test.c index 894ef7d2481e..b059abcf1a5b 100644 --- a/tools/testing/selftests/kvm/guest_print_test.c +++ b/tools/testing/selftests/kvm/guest_print_test.c @@ -25,7 +25,7 @@ static struct guest_vals vals; =20 /* GUEST_PRINTF()/GUEST_ASSERT_FMT() does not support float or double. */ #define TYPE_LIST \ -TYPE(test_type_i64, I64, "%ld", int64_t) \ +TYPE(test_type_i64, I64, "%ld", s64) \ TYPE(test_type_u64, U64u, "%lu", u64) \ TYPE(test_type_x64, U64x, "0x%lx", u64) \ TYPE(test_type_X64, U64X, "0x%lX", u64) \ diff --git a/tools/testing/selftests/kvm/include/test_util.h b/tools/testin= g/selftests/kvm/include/test_util.h index 62fe83763021..d7489db738bf 100644 --- a/tools/testing/selftests/kvm/include/test_util.h +++ b/tools/testing/selftests/kvm/include/test_util.h @@ -101,8 +101,8 @@ do { \ =20 size_t parse_size(const char *size); =20 -int64_t timespec_to_ns(struct timespec ts); -struct timespec timespec_add_ns(struct timespec ts, int64_t ns); +s64 timespec_to_ns(struct timespec ts); +struct timespec timespec_add_ns(struct timespec ts, s64 ns); struct timespec timespec_add(struct timespec ts1, struct timespec ts2); struct timespec timespec_sub(struct timespec ts1, struct timespec ts2); struct timespec timespec_elapsed(struct timespec start); diff --git a/tools/testing/selftests/kvm/lib/test_util.c b/tools/testing/se= lftests/kvm/lib/test_util.c index d863705f6795..f5b460c445be 100644 --- a/tools/testing/selftests/kvm/lib/test_util.c +++ b/tools/testing/selftests/kvm/lib/test_util.c @@ -83,12 +83,12 @@ size_t parse_size(const char *size) return base << shift; } =20 -int64_t timespec_to_ns(struct timespec ts) +s64 timespec_to_ns(struct timespec ts) { - return (int64_t)ts.tv_nsec + 1000000000LL * (int64_t)ts.tv_sec; + return (s64)ts.tv_nsec + 1000000000LL * (s64)ts.tv_sec; } =20 -struct timespec timespec_add_ns(struct timespec ts, int64_t ns) +struct timespec timespec_add_ns(struct timespec ts, s64 ns) { struct timespec res; =20 @@ -101,15 +101,15 @@ struct timespec timespec_add_ns(struct timespec ts, i= nt64_t ns) =20 struct timespec timespec_add(struct timespec ts1, struct timespec ts2) { - int64_t ns1 =3D timespec_to_ns(ts1); - int64_t ns2 =3D timespec_to_ns(ts2); + s64 ns1 =3D timespec_to_ns(ts1); + s64 ns2 =3D timespec_to_ns(ts2); return timespec_add_ns((struct timespec){0}, ns1 + ns2); } =20 struct timespec timespec_sub(struct timespec ts1, struct timespec ts2) { - int64_t ns1 =3D timespec_to_ns(ts1); - int64_t ns2 =3D timespec_to_ns(ts2); + s64 ns1 =3D timespec_to_ns(ts1); + s64 ns2 =3D timespec_to_ns(ts2); return timespec_add_ns((struct timespec){0}, ns1 - ns2); } =20 @@ -123,7 +123,7 @@ struct timespec timespec_elapsed(struct timespec start) =20 struct timespec timespec_div(struct timespec ts, int divisor) { - int64_t ns =3D timespec_to_ns(ts) / divisor; + s64 ns =3D timespec_to_ns(ts) / divisor; =20 return timespec_add_ns((struct timespec){0}, ns); } diff --git a/tools/testing/selftests/kvm/lib/userfaultfd_util.c b/tools/tes= ting/selftests/kvm/lib/userfaultfd_util.c index 2f069ce6a446..ef8d76f71f83 100644 --- a/tools/testing/selftests/kvm/lib/userfaultfd_util.c +++ b/tools/testing/selftests/kvm/lib/userfaultfd_util.c @@ -27,7 +27,7 @@ static void *uffd_handler_thread_fn(void *arg) { struct uffd_reader_args *reader_args =3D (struct uffd_reader_args *)arg; int uffd =3D reader_args->uffd; - int64_t pages =3D 0; + s64 pages =3D 0; struct timespec start; struct timespec ts_diff; struct epoll_event evt; diff --git a/tools/testing/selftests/kvm/lib/x86/processor.c b/tools/testin= g/selftests/kvm/lib/x86/processor.c index 1dfcbe6e55ee..d4c6d9e24b7e 100644 --- a/tools/testing/selftests/kvm/lib/x86/processor.c +++ b/tools/testing/selftests/kvm/lib/x86/processor.c @@ -376,7 +376,7 @@ static u64 *__vm_get_page_table_entry(struct kvm_vm *vm, * Check that the vaddr is a sign-extended va_width value. */ TEST_ASSERT(vaddr =3D=3D - (((int64_t)vaddr << (64 - va_width) >> (64 - va_width))), + (((s64)vaddr << (64 - va_width) >> (64 - va_width))), "Canonical check failed. The virtual address is invalid."); =20 for (current_level =3D mmu->pgtable_levels; diff --git a/tools/testing/selftests/kvm/memslot_perf_test.c b/tools/testin= g/selftests/kvm/memslot_perf_test.c index d5161e8aee14..bf62b522d32e 100644 --- a/tools/testing/selftests/kvm/memslot_perf_test.c +++ b/tools/testing/selftests/kvm/memslot_perf_test.c @@ -1040,7 +1040,7 @@ static bool parse_args(int argc, char *argv[], =20 struct test_result { struct timespec slot_runtime, guest_runtime, iter_runtime; - int64_t slottimens, runtimens; + s64 slottimens, runtimens; u64 nloops; }; =20 diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selft= ests/kvm/steal_time.c index 27ff9e0890c5..0777ef2b5399 100644 --- a/tools/testing/selftests/kvm/steal_time.c +++ b/tools/testing/selftests/kvm/steal_time.c @@ -114,7 +114,7 @@ struct st_time { u64 st_time; }; =20 -static int64_t smccc(uint32_t func, u64 arg) +static s64 smccc(uint32_t func, u64 arg) { struct arm_smccc_res res; =20 @@ -131,7 +131,7 @@ static void check_status(struct st_time *st) static void guest_code(int cpu) { struct st_time *st; - int64_t status; + s64 status; =20 status =3D smccc(SMCCC_ARCH_FEATURES, PV_TIME_FEATURES); GUEST_ASSERT_EQ(status, 0); diff --git a/tools/testing/selftests/kvm/x86/kvm_clock_test.c b/tools/testi= ng/selftests/kvm/x86/kvm_clock_test.c index e986d289e19b..d885926c578d 100644 --- a/tools/testing/selftests/kvm/x86/kvm_clock_test.c +++ b/tools/testing/selftests/kvm/x86/kvm_clock_test.c @@ -18,7 +18,7 @@ =20 struct test_case { u64 kvmclock_base; - int64_t realtime_offset; + s64 realtime_offset; }; =20 static struct test_case test_cases[] =3D { diff --git a/tools/testing/selftests/kvm/x86/nested_tsc_adjust_test.c b/too= ls/testing/selftests/kvm/x86/nested_tsc_adjust_test.c index db0d44b8fbd6..a18b0cfd42e2 100644 --- a/tools/testing/selftests/kvm/x86/nested_tsc_adjust_test.c +++ b/tools/testing/selftests/kvm/x86/nested_tsc_adjust_test.c @@ -53,9 +53,9 @@ enum { /* The virtual machine object. */ static struct kvm_vm *vm; =20 -static void check_ia32_tsc_adjust(int64_t max) +static void check_ia32_tsc_adjust(s64 max) { - int64_t adjust; + s64 adjust; =20 adjust =3D rdmsr(MSR_IA32_TSC_ADJUST); GUEST_SYNC(adjust); @@ -117,7 +117,7 @@ static void l1_guest_code(void *data) GUEST_DONE(); } =20 -static void report(int64_t val) +static void report(s64 val) { pr_info("IA32_TSC_ADJUST is %ld (%lld * TSC_ADJUST_VALUE + %lld).\n", val, val / TSC_ADJUST_VALUE, val % TSC_ADJUST_VALUE); --=20 2.53.0.414.gf7e9f6c205-goog