Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3917737pxb; Mon, 30 Aug 2021 13:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznkFHND0XXSaw++cE+u48AKhlfhYKF5ue8DeBEsIhCnlP+xrV3BsxQdl3YIgnunhZ9OJ/I X-Received: by 2002:a05:6e02:c8b:: with SMTP id b11mr17508771ile.90.1630357171629; Mon, 30 Aug 2021 13:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630357171; cv=none; d=google.com; s=arc-20160816; b=yWASPz3dY3p2NKCiEI+SvcljM+M4yxLqdZ/QITmk1pROOFvJhYVm4bwihuym/HUjvq MV+aRWH+QyXzmgJzyYrCn6gH/L/hSrbb+z2T+Pj5uwB75ASh1Cb5HMYx3RNT5kSF3ufk J6ZNzS4HwK4wdY6vGdYTNOmLVfShtLwkR9hvxMIgxAUliP/K5qbvuIQIeUoXrTa5y64A iF57aF8L00TC43mv7MkOcXUBnFhQBnr/Ro3aECbNif1NroouILEbi/osDfgJbQ0GPLzO AJSFhObIYmZQjguisnaAlSQC/fTcDEtuzjZTpipg7n0/4Kl2G2lU3YJl2bdpacsWRKtB oJtg== 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=KI2RPuIRoh7NOePByo6KVOnUF9gby91sf7lNNFA6eIg=; b=Fs1TixsogHgF26ypKJUsSDdVUqhr//rMkZIU/Pj2lwL8+dQvRdymJP9gHa/szOgGpt JywMhGjYuDjXi8xFBZRdNzzDTCoY5b5PLRxZplIeEknHfp7AHthCd1+StFeI1sL5xc0v EKukH4Tw87nbaKX8vO1Nii6Fh10H2k2MRLJdljS8U49lRDg7oHzbrnwqK7xXc236R5Z9 o4wqFZ3UrnnjLCpJldHnBlG1I9Lcu+beeFp41BqRnpwZ18XxnfBAa2nz4ZCw5pYtAAto x4aPru5mDLfsx1yjzY6ydJRuSKs149BtnUrUrEnsxBuD8BjdCElWuMSM47XRBIHwY2dc Ulgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SBMG9yme; 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 j6si16026292ilu.92.2021.08.30.13.59.20; Mon, 30 Aug 2021 13:59:31 -0700 (PDT) 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=SBMG9yme; 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 S235921AbhH3U7a (ORCPT + 99 others); Mon, 30 Aug 2021 16:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235898AbhH3U7Z (ORCPT ); Mon, 30 Aug 2021 16:59:25 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5CF8C061575 for ; Mon, 30 Aug 2021 13:58:31 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id y3so17683632ilm.6 for ; Mon, 30 Aug 2021 13:58:31 -0700 (PDT) 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=KI2RPuIRoh7NOePByo6KVOnUF9gby91sf7lNNFA6eIg=; b=SBMG9ymeVS2vlI8RISsrSy2N4QQxU/x92frWOGSDNUosIAdgQmUR7yxj5yGIbqr0xg jeP/mvg9VN50cKoY/vFIR1GALIZN/fOOBtZYtxgQSzvByeUqH3ip5vB7nYQcbtLD+6JM KmSq46SN9goyVG1Jl3XZImHJ2zWbD947M+dP8o/ewFQ9lTBxpVgvdQpQkJk1ycsaZoJK hEdtbDsEpMCH4EwPHND0ichcKfPbaIi5HPGl445qZ+85dLm6GRP2OQFOeC330AFR8LKH hbpP7EQSX0SHL7QkTzQbZic901OxHkIWmUtod5X5bZPwDD4M7zevPmc4UR2qE9WupDjQ /EFg== 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=KI2RPuIRoh7NOePByo6KVOnUF9gby91sf7lNNFA6eIg=; b=TSrhN37p7mzXUdn4uwW9IpNIRJTp8LSUGN/bwc33zq3Shrvr8A5BNnNlHrYYAiolYW e19dFDoFvOHVtX8lzCeG1vaQwK47bDDhNCQvHgCm+qSyOik7jfe4RoJSZeh9o5BeMeXF rCXOxkK1JdKRoeTsfFeJA3PbbBZhAjPEPD+Nf5efMEi+kUcXgfzz+qyISqx5/roIFqwD of8cIAd6N4ADNBLgwvVbQqJ5K1pG1QDy4i8pnUvkztfwMrDf5139FHGptvlBNgLgHIp0 IRB6QurhL/vwwK44eWbFOFKFN+pi3bJqLVynyaZxSlW+f+uir/oMcOwvXRDK/jyizTX5 hgqw== X-Gm-Message-State: AOAM53359kkbKJIAzs5pQIfZmIybR5eRjliwkeqKI6371UYnHrWgrnqt K5KehAOD1KL/xmrmjX6qjclu0bzI9u0ImDNogVDIEQ== X-Received: by 2002:a05:6e02:1546:: with SMTP id j6mr17383378ilu.154.1630357110922; Mon, 30 Aug 2021 13:58:30 -0700 (PDT) MIME-Version: 1.0 References: <20210830044425.2686755-1-mizhang@google.com> <20210830044425.2686755-2-mizhang@google.com> In-Reply-To: <20210830044425.2686755-2-mizhang@google.com> From: Ben Gardon Date: Mon, 30 Aug 2021 13:58:19 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] selftests: KVM: align guest physical memory base address to 1GB To: Mingwei Zhang Cc: Paolo Bonzini , kvm , LKML , Sean Christopherson , David Matlack , Jing Zhang , Peter Xu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 29, 2021 at 9:44 PM Mingwei Zhang wrote: > > Existing selftest library function always allocates GPA range that aligns > to the end of GPA address space, ie., the allocated GPA range guarantees to > end at the last available GPA. This ends up with the fact that selftest > programs cannot control the alignment of the base GPA. Depending on the > size of the allocation, the base GPA may align only on a 4K based > bounday. > > The alignment of base GPA sometimes creates problems for dirty logging > selftest where a 2MB-aligned or 1GB-aligned base GPA is needed to > create NPT/EPT mappings for hugepages. > > So, fix this issue and ensure all GPA allocation starts from a 1GB bounary > in all architectures. > > Cc: Sean Christopherson > Cc: David Matlack > Cc: Jing Zhang > Cc: Peter Xu > > Suggested-by: Ben Gardon > Signed-off-by: Mingwei Zhang Reviewed-by: Ben Gardon > --- > tools/testing/selftests/kvm/lib/perf_test_util.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/selftests/kvm/lib/perf_test_util.c > index 0ef80dbdc116..96c30b8d6593 100644 > --- a/tools/testing/selftests/kvm/lib/perf_test_util.c > +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c > @@ -93,10 +93,10 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus, > guest_test_phys_mem = (vm_get_max_gfn(vm) - guest_num_pages) * > perf_test_args.guest_page_size; > guest_test_phys_mem &= ~(perf_test_args.host_page_size - 1); > -#ifdef __s390x__ > - /* Align to 1M (segment size) */ > - guest_test_phys_mem &= ~((1 << 20) - 1); > -#endif > + > + /* Align to 1G for all architectures */ > + guest_test_phys_mem &= ~((1 << 30) - 1); > + > pr_info("guest physical test memory offset: 0x%lx\n", guest_test_phys_mem); > > /* Add extra memory slots for testing */ > -- > 2.33.0.259.gc128427fd7-goog >