Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1769038pxb; Wed, 10 Feb 2021 16:57:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJz64d/FzoW2dDfsQa1vV/x8ZtdrxrW00T0aKOfb2uGJyUk7cDZ5s+Mac1wJA77PxA8gSgiR X-Received: by 2002:a17:906:4707:: with SMTP id y7mr5573352ejq.445.1613005058313; Wed, 10 Feb 2021 16:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613005058; cv=none; d=google.com; s=arc-20160816; b=TGtLKPpXlAvA/0dVrxTk2ayMG5ajgw5Hip0kPUy9uWEQTcSC9SkwuXoeADu9aHvBO6 FpbGzW9kPbBTvbG57G85YJZMFr5oPUneeSMhRMynWTbgnldZq1UZbXAUStmq6hChCanT 5nXuyfRy7ubIrdpDOAdd8SXRcNY3NrEETMS2cVYcDivfTWd15es6j3USdyzM1T7qnTTa J/4gTP7acgoWbiQh9RlhP0ZUZX12kUKsB+xVcdSkwsdHKii+CiEvzeIDI6v4WBSIzMor gH+Ya/RiacQnaMfeIYNjI4bQcuOrx/XKJPLhqNddyaVI6Fq7P9vHR7RXrC8NhyaaW4iu OX8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=d8N9hPSbBu5axkXydL7by5ffIfcZ5d4zvwt+JbttAFg=; b=jWAZLjGtwPQIB6OIJBRR1v1JbpGU5ajR3WnoQ8rPus+/NySLYDyr3Sa4/feUjyUjn2 foPUFckLsPvm9ucnGpB7xu9hZ4W7uAHf1ROcBSOivL5j79hdvWcNJxdBOC6AZA344Qe8 gavTNSrEhwBSk2EJjPyIMcWPe0HHuOGqBVT5iwx4n4z8boEJ0+wgT+ZRN2R38DFi2/r8 oLSq0D4dfLiLzQlKeKUyzynSvmFmiE3aOVfLJZ8ui/eruwth0DpjnvDh2EVkqSJT4+g5 ZeULWEo3Fja9iy0NFOEPAEZ1UhK8OlZ4i9qKH6dIi3XziDz+kB31Xe8K/bHuXF12O/74 +4NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Z6E3jYo8; 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 r21si2770222ejo.142.2021.02.10.16.57.14; Wed, 10 Feb 2021 16:57:38 -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=Z6E3jYo8; 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 S231685AbhBKA4m (ORCPT + 99 others); Wed, 10 Feb 2021 19:56:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231603AbhBKAx3 (ORCPT ); Wed, 10 Feb 2021 19:53:29 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B872EC061786 for ; Wed, 10 Feb 2021 16:52:49 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id q5so3648928ilc.10 for ; Wed, 10 Feb 2021 16:52:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d8N9hPSbBu5axkXydL7by5ffIfcZ5d4zvwt+JbttAFg=; b=Z6E3jYo8SXInmt+VQduKkHUsMGMP8M1WWWItAepulVPM18vllH/qJOyrs0+LxyW4/i IFtNhPIK6xkYHujt1/Q5bOZop475K2CeaG/rYSqYg2QlHaA3M55KUsXwDGi0U7M4rTfB 2EaXoj7oe+sepcoxLiG0ZNIIdImxYD6M/257nRA6TLuYuG/HkplYGLbNff6MnFDtuFf0 iBcUAZ95j15uX0Ek6JEyKtRlxoihg6ytWkjr1bEjYE+oRBhui/v9AEwWq3Do7L98PwAg abN38cf+7L4FvbyS4l2RocfRexRTG2EZ2l7Zalp63XZO16qp976IOC+0oIFjClyrBJbd +HLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d8N9hPSbBu5axkXydL7by5ffIfcZ5d4zvwt+JbttAFg=; b=BYITOUtpi87y9jmlO/k95VRPY/f1Va1myiJWwOsxamNn+XFOExcWt+UDFeURO08wL3 Vr8iGE+NP3DDyOezDIJ2p2efL3Wfo4TQW//43zT9Vt+Y8t+xfG92TQfYdQqFg9tOcjrg PBOxOr3DI0Hg5Dl6ZiIoSvxSCtG2tKNC0pyM/mNliWVsT/ImfWE8InPWsIqTJipb3im6 fzaMdASKDE/lFPMj2+KgI01NyCk/3UyAciTkPTPUrkmC60bKnCYAsdvvz1ldyZQvcEP4 +Em4oxP/+4boQ07c4V5ymt3RMgO44IPgVcsXoxCQsQfKgoD8gNbzN3Z6K6G8VvkVvnkX p4MA== X-Gm-Message-State: AOAM533En4ERPuh8hKpfXYY2EYpfdKkPna/+jgdxLCvUW2fYI8zrwC9T D6gQUzr3ADTnK1Awm1vDUwoLjlxovDog13TBpthB/A== X-Received: by 2002:a92:c54e:: with SMTP id a14mr1089471ilj.285.1613004769134; Wed, 10 Feb 2021 16:52:49 -0800 (PST) MIME-Version: 1.0 References: <20210210230625.550939-1-seanjc@google.com> <20210210230625.550939-4-seanjc@google.com> In-Reply-To: <20210210230625.550939-4-seanjc@google.com> From: Ben Gardon Date: Wed, 10 Feb 2021 16:52:38 -0800 Message-ID: Subject: Re: [PATCH 03/15] KVM: selftests: Align HVA for HugeTLB-backed memslots To: Sean Christopherson Cc: Paolo Bonzini , kvm , LKML , 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 On Wed, Feb 10, 2021 at 3:06 PM Sean Christopherson wrote: > > 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 Reviewed-by: Ben Gardon > --- > 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 >