From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 5C8432D9ED1 for ; Tue, 23 Dec 2025 23:16:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766531787; cv=none; b=STj/khkXufjraylwKuZsrbwkKloSm1vi4A+PYZaA6vwDTB5F9h4Y0zCxyQG7yLSrzg1bJbGfS3Nu1h2lUTIWDdQ8AZxw3WL2w/Ym/OjfUU5+4wDORCIiaijHsfTDUugMTo6a9bZNpQNKJq9WC4QPb/igeNX0f8uqNHdAwfDnD64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766531787; c=relaxed/simple; bh=wcfa8UCv1PFDrNKXW7+gpOHbHZSoTaU1Ak8Xrx/H8XQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=dKwcXDHL+ercEZOdu+bvSmfZ4R85/nhW/17X7cPdLxDSA/hchTxMgykDRmBgsLxgdq1KtQLvg3urAWtNozQbuu5OyNu4HrTe9PBF2oFjpiaj3RgPrqJ63eViHmubYwX0ZaVuVeGJbw+cRHbuQ16jQ9pyO3ORydLXLaLnJt6m6nE= 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=G0TnDdIS; arc=none smtp.client-ip=209.85.216.74 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="G0TnDdIS" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-34aa6655510so7103798a91.1 for ; Tue, 23 Dec 2025 15:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766531784; x=1767136584; 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=KAsurit4CoffeQfZgLilT9SXN5ZmTqi2oQd1rjMHsLU=; b=G0TnDdIS3hGXKtYExvTsDB8wBQ9o/JxGYs7vEUK5CBbKBwXutribtcq+gpQ/IOh2Cx 9djxxnXOG8KXJBkBb6vq0yasHCYNp6Aie3aET+fNh7NLD8gM5+l0A/qxczhUk8MRwCb5 QI8zkaiwj3eNKao/p7ixXiiXXVMvGnJGMVJlWDrQwdxPTUaeLILpdJbZKzDPZfOqrBHN ICXsbOUUbbK0Y1CFlg2jzuH+1rrwKip2gQahYvGCJJooBHrhRFlkHgakx2q8wTZZ98KX 23yY1KjEEtUY0g8OObbZaMSFWYWYHs5uaQ8j35tLnMHrucLRbxrpBI4qnN8mZWmCNJnV hQdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766531784; x=1767136584; 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=KAsurit4CoffeQfZgLilT9SXN5ZmTqi2oQd1rjMHsLU=; b=HbpJqUopVekqHd9JP8nYpVoALAxSkKyY9LDlia1B33XuRlcXUNQBFeSj5SYlNSTB1C +dwSrgVwLV57NY94Hl2vgVGhcV2dURRqkLue9RcszCm8q1pQxrcpEh+Uo43Pekx36ax2 SPA9xH9ZFlJawB0wi7b8tk1rkGhHf0hpz6LhknfdEne12eK7ca+SkjQmrLXl4/xZEysW uEtwYegzWblDf31HEAvVo/K6zU3Nx5qM2Ovt+1Y09pBWjDQ1alFb3Gxc+fnHAZjEpozX RRYbHt4MFfe6erTwsILUJ1EpI+mm2AQo4/SI35reocWmTMi4mMQ5nGJ7eg2E53w0d0pq GZjA== X-Forwarded-Encrypted: i=1; AJvYcCXgYFljPTRreViPYkz/r+Mte8716EWCpc1o6AA26F4acMC/oB4kOVoDRZG/7bhQnhdi0xR67ZlKS1Ot/9M=@vger.kernel.org X-Gm-Message-State: AOJu0Ywq02vuwjwd5JkmPYyEZVBCOp5pGXHURh824JUYzYPBOBy+463w mYE/nY4yr8xd5SejEHzfBo6M62daeSLqc1Ji4tTfEBTaODOQnsU9rIrQBymEvnUvmuFFJqF+RlD 4Gli4/A== X-Google-Smtp-Source: AGHT+IEGNORU4c06vu8tvcskbqaqO03iRG+VRpk9JFm8QEVM69jU830aaoUkr6cc7Thzn2v7b01iAuatSnE= X-Received: from pjgg4.prod.google.com ([2002:a17:90b:57c4:b0:34c:4048:b62b]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4ad1:b0:34e:5aa2:cf68 with SMTP id 98e67ed59e1d1-34e921e7148mr13890093a91.30.1766531784584; Tue, 23 Dec 2025 15:16:24 -0800 (PST) Date: Tue, 23 Dec 2025 15:16:23 -0800 In-Reply-To: <20251127013440.3324671-9-yosry.ahmed@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251127013440.3324671-1-yosry.ahmed@linux.dev> <20251127013440.3324671-9-yosry.ahmed@linux.dev> Message-ID: Subject: Re: [PATCH v3 08/16] KVM: selftests: Use a nested MMU to share nested EPTs between vCPUs From: Sean Christopherson To: Yosry Ahmed Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Thu, Nov 27, 2025, Yosry Ahmed wrote: > diff --git a/tools/testing/selftests/kvm/lib/x86/vmx.c b/tools/testing/selftests/kvm/lib/x86/vmx.c > index a3e2eae981da..5d799ec5f7c6 100644 > --- a/tools/testing/selftests/kvm/lib/x86/vmx.c > +++ b/tools/testing/selftests/kvm/lib/x86/vmx.c > @@ -56,6 +56,16 @@ int vcpu_enable_evmcs(struct kvm_vcpu *vcpu) > return evmcs_ver; > } > > +void vm_enable_ept(struct kvm_vm *vm) > +{ > + TEST_ASSERT(kvm_cpu_has_ept(), "KVM doesn't support nested EPT"); > + if (vm->arch.nested.mmu) Make this an assert, attempting to enable EPT multiple times for a single VM is a test bug. That way we don't have to worry about silly situations in the future, e.g. like trying to change from 4-level to 5-level after the MMU has already been created. Ditto for the NPT code. > + return; > + > + /* EPTP_PWL_4 is always used */ > + vm->arch.nested.mmu = mmu_create(vm, 4, NULL);