From mboxrd@z Thu Jan 1 00:00:00 1970 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 BBAD02C029A for ; Mon, 3 Nov 2025 21:08:11 +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=1762204093; cv=none; b=LEmYbWFh2xpDfgg04hrzSczmzy7cGT8b/G8p778uUhRMkM4XI9rAk/XzAzwGkMkYTuP5sqpHKXIxYHXBO6wzPQvFk5xDsJdW9sHIT4NOXTF5b7zDNoOvi/nuHEfHOub4SurOPkNlDvSiKBUqKaF6PNBFx5hZrc5+VemRwl+KNec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762204093; c=relaxed/simple; bh=lqImQkBIX2RKNa9y7sFTmTERfIUIhbfGh0MuI1pu61o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Png0wwKMDx3jR20Q3LOh6VtR7zWow0vDs+H1oJ62XzNiCHn4XGSczYidVx0De811LnxZ9VkbsWkl94bSWbXGk52poSfd1Cak3bR3fc4WKrz50yQtN7bMZ/DlU/Rc/MgqX854hqYcMFzMw3ghM9elaiDGMhgCPVMN3+26JYhwN+A= 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=eCGCodej; 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--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="eCGCodej" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-295915934bfso27332305ad.0 for ; Mon, 03 Nov 2025 13:08:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762204091; x=1762808891; 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=l1jgaIFuU1qR4r59NFbF5NuManKscXsOZ/dpS/a+5oA=; b=eCGCodejYxIbRi6xz1jEs9HBMB7LwkeyOzfAzlVXxjTM1twbMmA1yFNpWKFJaH5PDi 022sg5dtHoXgDiwJ4GS7iXHb8nHS2G+867udMtu7SrpOtECOzrkQLzZwM/YLP6zcwCHj gldTYTQ6OT+DMnBpRRloew+OUe+2rKQGOi8PmCmq43YOyGzfObvz+t2YSer6GAMfl4wJ 4Pnqf5OPPCNl2Ida9wmsSvT9JutQcI83vYPFB5gbjlj/UC+X4LRwWiTpOMpBhQsvy/tS rMtY4caX/ZYkyjy3Z4c5Fu1u01+Tq8rqxJW7CSoK6B3ErZ8bza16gs3IeOQGDmFcmlcx VEtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762204091; x=1762808891; 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=l1jgaIFuU1qR4r59NFbF5NuManKscXsOZ/dpS/a+5oA=; b=kqCIUkvw39G+fhxhwG2OBmBZlS6r+Z1ANjc/9Oufp4vGER0Y0ufhxIHmC7Wgc2x4+Z 4b8xJZVWGBigJc/nwQqKdSNfQU5XE2ciQ2LV1H93HqI/pwL3wgfoeiw5MYLo2OOY9hl+ 7XB5/yQOlOK/R/virlBCWE2ZT1anKvZZikFgMw17NemUXQuVzSk1oTA53HWFQMtTijHn ZlgByNEhc8UeR/FeEh4W+qPoEdrb2SK88YWFs+CFEQJ8vY3eGZPIgHLbmgUi1AeYBzmP 5yJOYwCWRGEvNPJSxuB1Uv8fmaLEh7GKh7cV+W/OSMP9fBg+CmrnqhUGYvJ7Fyx6KkVY SO+g== X-Forwarded-Encrypted: i=1; AJvYcCUl+8LMpAlIDRyZcIzFIntOvemH0bzhQeEwOoze32FLqtQAlZixx8SY1yIAEufjIjF7YNhEy7DPlOPYY00=@vger.kernel.org X-Gm-Message-State: AOJu0YzpftCK8nlPg3+68hueJWiOJcFXlhof4HjlMG5zLz4q1Wdlqr5l gwswLej260VBgyRb+NK1m24cmnH4638ygZ5Y7NGOaAtkcLNWoH06OioYXKAyUkpXs62YdNPSbVt 8dAhKxg== X-Google-Smtp-Source: AGHT+IFmLCYVwXdeteTbsVspNCQQNa07ZbCjVAqI5KUDK7A2fmNFJ3jDRmAVUCA7gp+ckzqh33TY6g3AxJw= X-Received: from plbmn15.prod.google.com ([2002:a17:903:a4f:b0:261:3bf9:662a]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:c947:b0:295:1e50:e7cb with SMTP id d9443c01a7336-2951e50eb4amr164854455ad.23.1762204090972; Mon, 03 Nov 2025 13:08:10 -0800 (PST) Date: Mon, 3 Nov 2025 13:08:06 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251013151502.6679-1-jackabt.amazon@gmail.com> <20251013151502.6679-3-jackabt.amazon@gmail.com> Message-ID: Subject: Re: [PATCH v2 2/4] KVM: selftests: Fix unaligned mmap allocations From: Sean Christopherson To: Jack Thomson Cc: maz@kernel.org, oliver.upton@linux.dev, pbonzini@redhat.com, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, isaku.yamahata@intel.com, roypat@amazon.co.uk, kalyazin@amazon.co.uk, jackabt@amazon.com Content-Type: text/plain; charset="us-ascii" On Tue, Oct 28, 2025, Jack Thomson wrote: > > > On 23/10/2025 6:16 pm, Sean Christopherson wrote: > > On Mon, Oct 13, 2025, Jack Thomson wrote: > > > From: Jack Thomson > > > > > > When creating a VM using mmap with huge pages, and the memory amount does > > > not align with the underlying page size. The stored mmap_size value does > > > not account for the fact that mmap will automatically align the length > > > to a multiple of the underlying page size. During the teardown of the > > > test, munmap is used. However, munmap requires the length to be a > > > multiple of the underlying page size. > > > > What happens when selftests use the wrong map_size? E.g. is munmap() silently > > failing? If so, then I should probably take this particular patch through > > kvm-x86/gmem, otherwise it means we'll start getting asserts due to: > > > > 3223560c93eb ("KVM: selftests: Define wrappers for common syscalls to assert success") > > > > If munmap() isn't failing, then that begs the question of what this patch is > > actually doing :-) > > > > Hi Sean, sorry I completely missed your reply. > > Yeah currently with a misaligned map_size it causes munmap() to fail, I > noticed when tested with different backings. Exactly which tests fail? I ask because I'm not sure we want to fix this by having vm_mem_add() paper over test issues (I vaguely recall looking at this in the past, but I can't find or recall the details).