Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1714593pxb; Wed, 10 Feb 2021 15:12:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvCbktZ6eK9MRq80cIUqrtC56hZxmsS49J0yAntxkK5TLcTSfdmoR+uiF8ECkmRfoulFBL X-Received: by 2002:a17:906:d7bc:: with SMTP id pk28mr5223518ejb.370.1612998734136; Wed, 10 Feb 2021 15:12:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612998734; cv=none; d=google.com; s=arc-20160816; b=i0ljq4AOu9Fe1Gm2XcNyQnL6yInijqJ18woZ75ncpjcTI93aAuQJcG+EzjhytFE6dD z5Nh9RXwFWz9V+RQ7H3p9d3sxMNYlVNR/RyezbVbWkRj4ANTR6CQ2brwKwlJu9yER091 NKkmoCIAPdQP1NZ/A6L6ymUgby7kLd1VRCnRcG8RawpBiXnQoWr6JsS3L2EgzdBcW4EG Vw1RG3NMXO6MjM+YooW88GVzv2XOKWlqlnJP45O1okyaNqXM4kK5lW5vqbA5HEEaqI4i cj3D1TR2/+1jwE5AhUA8E+IyDpNx+OWspX7Fj+5VFgxdoZIlAEM8n+yEhavw+IONnf7h CLgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:sender:dkim-signature; bh=GEZo8w0hgK50yVJrGIa5NClbFF0q/1wZWPqztqSAI8U=; b=fjIUS/DDOfW162b+u4Jyg+cem+ZY8Ci8w0LEkci1Ure58Mhr1aF8qqbPF2gETdeyGU 80VQGXeIYMXSkf10OuaNg3vYObaKV/q0eLju5lsawcPIQpzCs1NRwTaGTxm5w7+zwp/Z 9Fg1qALhbxz67FHUSVYt4Zv71kcd/AcmTyadEaiwYSJeGMfQ+MAQXEiHDhmT2hZnNSwM q56N9Hke0tfi7rTtr/8hEtO9v1u21e0DaGCev+VKrC3Q2o18m7N+K912PnFBXA0wHEsF O5SA6B7OWKIe6PP6xFpp5guFU/dS6tsWDxUyup8Y3D2OhsFUcZOp4VVsK6eY7O9Lj2jE JhzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rn5yL60z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kz15si2203364ejc.110.2021.02.10.15.11.47; Wed, 10 Feb 2021 15:12:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rn5yL60z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233926AbhBJXIU (ORCPT + 99 others); Wed, 10 Feb 2021 18:08:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233792AbhBJXHy (ORCPT ); Wed, 10 Feb 2021 18:07:54 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C43C06178B for ; Wed, 10 Feb 2021 15:06:39 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id p22so4189487ybc.18 for ; Wed, 10 Feb 2021 15:06:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=GEZo8w0hgK50yVJrGIa5NClbFF0q/1wZWPqztqSAI8U=; b=rn5yL60zWHOSQ+4padKHXvkuITHPNRNSNM+Cf+9acwDztaCvEP/GBVQ46b4K61tWUh 0rBN1xLJTmrJEjlUWrvyxWAHzpYRU+matvsXKhc05IbcvNWPj8T75zjBFATONuPPrZxP omSVOmXteiC47KavBtmbXLlzcOdxpao3dOCmu9aeF4UKwlt2bQGEahNFJY4aBRP2PtFc rlr6BsK92Pffqxz8x+FWpJtjLmil2U1AXIjWuvO10GvEQ8DFttN4VfIiO+5fHXVjSRjP NwL5raeTygbl0rz7OCb3GgcHwErhtvIBEGR9Qc3TDbNsP7D8Sj/4OdNyyeNmRr5kUGvI yULg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=GEZo8w0hgK50yVJrGIa5NClbFF0q/1wZWPqztqSAI8U=; b=sxJ/GDJ0L0msgJs1ANFlGPusD7A4IsDVUPyyvyfeB2PD2u6bUp6CmrSqWV81auJMaj HOx31NCFyCKrNoqdh5Kyp9QmXJ4AfEcS8qG1d8GAdRhRPqTM5v8sYvU8ZaO0jmfPb7x1 ScUvW2gyvrnVOx4qXMfLyqgmWG1CT8BefcRzipYb9AIIxkW9h13RLA77RLe9uQlshapL I0JwlopTHt/K+0kY5RsKK7ZmCT/R2FU69i7LGeVGK1g7bDKJ4AEJTyHd9T9WGWHLEG0g lveKSjWTeag047i4e3NH7CKjqUr/TtEKra1+HFQrDPTDaGbvKqsX0AlqQdhz5qMKgBPG wMaQ== X-Gm-Message-State: AOAM532v9jcIH6sXZ8zJeNMK/urTlZwX1DYLLpJpLIo1325A81sY3JKX TWw4PCk1YwklDuZnZTWDZZW6mH1R/II= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:11fc:33d:bf1:4cb8]) (user=seanjc job=sendgmr) by 2002:a25:a241:: with SMTP id b59mr7767318ybi.289.1612998399020; Wed, 10 Feb 2021 15:06:39 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 10 Feb 2021 15:06:13 -0800 In-Reply-To: <20210210230625.550939-1-seanjc@google.com> Message-Id: <20210210230625.550939-4-seanjc@google.com> Mime-Version: 1.0 References: <20210210230625.550939-1-seanjc@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH 03/15] KVM: selftests: Align HVA for HugeTLB-backed memslots From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Ben Gardon , Yanan Wang , Andrew Jones , Peter Xu , Aaron Lewis Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Align the HVA for HugeTLB memslots, not just THP memslots. Add an assert so any future backing types are forced to assess whether or not they need to be aligned. Cc: Ben Gardon Cc: Yanan Wang Cc: Andrew Jones Cc: Peter Xu Cc: Aaron Lewis Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/kvm_util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 584167c6dbc7..deaeb47b5a6d 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -731,8 +731,11 @@ void vm_userspace_mem_region_add(struct kvm_vm *vm, alignment = 1; #endif - if (src_type == VM_MEM_SRC_ANONYMOUS_THP) + if (src_type == VM_MEM_SRC_ANONYMOUS_THP || + src_type == VM_MEM_SRC_ANONYMOUS_HUGETLB) alignment = max(huge_page_size, alignment); + else + ASSERT_EQ(src_type, VM_MEM_SRC_ANONYMOUS); /* Add enough memory to align up if necessary */ if (alignment > 1) -- 2.30.0.478.g8a0d178c01-goog