From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (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 5DDA9337688 for ; Tue, 11 Aug 2026 17:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786468725; cv=none; b=kNCkEsrz5e6Zdlzu1GEt48RTfOKd0a5yuBE3rJzGRgI6dAa3D12imd4/Tvfsbt0aV50jZj1LPgUTTi5eMl/jsh5iwPCtMGe0g9DG0R5wJTuOQs+wrgkHRofLpcyHzWpyvZpKWQ2Z4yPKeAYg7qEmTKItcU/8mzKE0463fIQZ2bY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786468725; c=relaxed/simple; bh=aM8t6gbWVSBH/PXjIpG3X2PBmAzOnCTHTBlY6ixW2I4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=t7qaQ6JR9cuU+FUHyuStxHE8kv4CRNCfABL/yjachn56yL9R0Gr8vfuwGF0A40Y2BP+DbpDzWv+6bvuMF8noqJPqloIhteIZ01o4m10Dvblbu5+PrFIHRulFLTYe1oXdlM0CA5i6bBp5+4XBQQFCBNe4xG4Tk+VnfR3bNYYIOc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=PjPKjjuo; arc=none smtp.client-ip=209.85.210.198 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--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PjPKjjuo" Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8487eb67173so167685b3a.2 for ; Tue, 11 Aug 2026 10:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786468722; x=1787073522; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AtIGM2NHe8OV4DKgN1nHk9aAoS7uuH7cfv4s5R8wW14=; b=PjPKjjuo/kiiHk3D/NmXAOnm7hm0O0fvRyA/GKIo5QfScQs9FF5gxVLgpjLGYP4yLC HzF/oRCpdr7bpaT3z3O7cdHK3LJtrMpsgQMBrRad0kgOBTVjsW4x4LhWHq0+pi+G7gLJ 0FSoLSlKFIUYg6z92Tez3eTZHCM04F0iZsed2iHPJCFbUWIV+AOenQSoQ3Xp24m7oxEj bc9mMpoLAt8zJ+nLm5BrmUq5e2d1Ge6uejQkV5SydtuNXhUOhVg7mVZbWqDYbKljK3PX a9yp+a652GgCSo0C6guGDc/X6foXtFhNFJCN4YkP+RFDacMhJ/YvEiNsdrBGqzvd8Y+X DSQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786468722; x=1787073522; h=content-type: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:content-type; bh=AtIGM2NHe8OV4DKgN1nHk9aAoS7uuH7cfv4s5R8wW14=; b=UsD5iJbGcTrR/oVleX0dahYTtQj+qmRyv38mmESEd8t7pSSQpoMYIa1aKcZ3yNdAHY HusJFqm7gP2lOdBb5jM6ouutkSMIhkyWAROO5uPRMTaU5kBSqvwMC3ETXU8/aNPcwFg4 MFmD94Djustufk5qwP0P/dBVL/IJAHBVGZ1mLuk8VkpuxcM2BW38QBQyqv1FbP5eaOfG ePBopsuXlDN6dNeSIGdzQkg10wTVSb9ivjwoM6M9SIISXhIK84ICTc14X04Eyaf/FZhn CjNJKnxufGyh+mHibYlgNKQc6X04kDSAjMKv3hi6Q1hDGMVs4vLwOdnClqGconmrNXRw Sjuw== X-Forwarded-Encrypted: i=1; AHgh+Roy8dAIdpuOonUIqsCRaPsndI08og2fnb/XPn+9EldXb/O08Gqqi80FyWfjTjhITLZ3YcsVswm/o1vBtco=@vger.kernel.org X-Gm-Message-State: AOJu0YzmAkRkTy/1izjgiXSKnjorRj6UZW1dX3/h/7KkwJanDTHQoB/P bLLCPZsCvkcmKGqbzQLSYcpzeRzvVaAjMgmpvaYzWauYMdsyCp+YSwIwdqJl1FQxirZfWGjHXTw +IuHvMg== X-Received: from pfbds7.prod.google.com ([2002:a05:6a00:4ac7:b0:848:2a35:eb83]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:139e:b0:848:5ed6:9d27 with SMTP id d2e1a72fcca58-84fafa6094dmr1722392b3a.36.1786468722299; Tue, 11 Aug 2026 10:18:42 -0700 (PDT) Date: Tue, 11 Aug 2026 10:18:41 -0700 In-Reply-To: <20260811060134.106973-4-jinyu.tang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260811060134.106973-1-jinyu.tang@linux.dev> <20260811060134.106973-4-jinyu.tang@linux.dev> Message-ID: Subject: Re: [PATCH 3/3] KVM: selftests: Enable pre_fault_memory_test for RISC-V From: Sean Christopherson To: Jinyu Tang Cc: Anup Patel , Anup Patel , Paolo Bonzini , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Andrew Jones , Conor Dooley , Yong-Xuan Wang , Nutty Liu , Jinyu Tang Content-Type: text/plain; charset="us-ascii" On Tue, Aug 11, 2026, Jinyu Tang wrote: > RISC-V now supports KVM_PRE_FAULT_MEMORY, so include the generic > pre_fault_memory_test in the RISC-V KVM selftest build. > > The test uses PAGE_SIZE from the architecture processor header. Define > the normal 4K RISC-V selftest page size so the generic test can build > for RISC-V. > > RISC-V selects VM_MODE_DEFAULT at runtime. Initialize the supported > guest modes before creating the VM so the generic test can run on > RISC-V hosts where the default mode is discovered from KVM > capabilities. > > Signed-off-by: Jinyu Tang > --- ... > diff --git a/tools/testing/selftests/kvm/pre_fault_memory_test.c b/tools/testing/selftests/kvm/pre_fault_memory_test.c > index a0fcae3cb7a8..6eebf0524673 100644 > --- a/tools/testing/selftests/kvm/pre_fault_memory_test.c > +++ b/tools/testing/selftests/kvm/pre_fault_memory_test.c > @@ -8,6 +8,7 @@ > #include > > #include > +#include > #include > #include > #include > @@ -219,6 +220,8 @@ static void test_pre_fault_memory(unsigned long vm_type, bool private) > > int main(int argc, char *argv[]) > { > + guest_modes_append_default(); Can we do this for all selftests in kvm_selftest_init()? Or perhaps even better, handle it in kvm_selftest_arch_init() to avoid the gnarly #ifdefs? Unless there's a meaningful downside to configuring the supported and default modes, I don't see any reason to force tests to manually do this work. > + > TEST_REQUIRE(kvm_check_cap(KVM_CAP_PRE_FAULT_MEMORY)); > > test_pre_fault_memory(0, false); > -- > 2.43.0 >