Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3477226pxj; Tue, 11 May 2021 05:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ82B13PRtnwz60Nrsu1MdRmgx40Bs3jrPwkdTPyLc9BV4LGZjAFXQDezcSnuiQp6oJRME X-Received: by 2002:a92:6b05:: with SMTP id g5mr25971789ilc.40.1620736279834; Tue, 11 May 2021 05:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620736279; cv=none; d=google.com; s=arc-20160816; b=tE/BBrZGsAqwLDWj/iEJSiqP+PGRXgDD9Hsx9i4rYGY2otXyl4xccy0hAmxINl66y1 Iys6swjIykeFnqWTWNVST4t4aZ2bnGioBK38esP7pmMAOURpt8K4pgut+nGBemS3NbNo 1u0xPLse14j3U/yYVSIbDC1EoZt1nBVoxqfZEuFv/h+5EcWUYhuTfup2yu8o3hJRUTEb OBBJOi5Z/u7HBARjnydCBup4E1aQ9qKJxLto66Er7zsgicHUW5VHeXqIB97OCP4p3t/0 nPe54CwQsQQaABJGjGZg3HAdF8ctUGStV1aYIV7BX/XLmkl3AZq5cJFIPBQ5YLaWS8Jv nfAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=dLt4baXejMx1mF4IuobQDiIt/HLGnvYzsAB2scCdR3g=; b=zEUdSD93kMt+d9E5S2vc1/i/5BrhRHq/ya7DYRahQuXwzVtudH4Kk/gFY6k+QKnFc1 XN9V4xWy9GRptY1r18Uk1w7gzELQQOf9OiptR7QHGNIY8Oer1RFFlJi4DnpI/2WRqCck 1wdodTuwUsy9e3hasE3MV6Zn6spBgtv7JQj3m0EXi8NUUvNaLQlVdV/Z+vCopJjQAklB b+KQUJgK/xMxXFwvOrzPGt9JhLlGtn2twEXi24yk5hHSKIO3mDwPL4RcHragM2HBdQBK CAHE+WhuSxrHUWl02kEk1H+3aH71C/52tyGqJhIBo5VBwaQPedwXelxBBLu83s/5gX9P uekw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si19351565ilq.100.2021.05.11.05.31.06; Tue, 11 May 2021 05:31:19 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231576AbhEKMbh (ORCPT + 99 others); Tue, 11 May 2021 08:31:37 -0400 Received: from mga14.intel.com ([192.55.52.115]:23526 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231432AbhEKMbf (ORCPT ); Tue, 11 May 2021 08:31:35 -0400 IronPort-SDR: ZMp9bP8vZBOS/6OitNw0BHzbQoZBmM0F6hUTnPgbkYLOAfoot52Cemoku/6oR18g88W7twWrBp 5W4H+qJRh4Sg== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="199108941" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="199108941" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 05:30:26 -0700 IronPort-SDR: iZsLdeOIW/rdw0bWGu15JHNiN+raV5v41OwxlkIvP9QvlOABntQoU6krP2S5Held2csza33y9g 18uqcib9GL6g== X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="436634130" Received: from duan-client-optiplex-7080.bj.intel.com ([10.238.156.114]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 05:30:24 -0700 From: Zhenzhong Duan To: linux-kernel@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, shuah@kernel.org, Zhenzhong Duan Subject: [PATCH] selftests: kvm: make allocation of extra memory take effect Date: Wed, 12 May 2021 12:31:06 +0800 Message-Id: <20210512043107.30076-1-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The extra memory pages is missed to be allocated during VM creating. perf_test_util and kvm_page_table_test use it to alloc extra memory currently. Fix it by adding extra_mem_pages to the total memory calculation before allocate. Signed-off-by: Zhenzhong Duan --- tools/testing/selftests/kvm/lib/kvm_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index fc83f6c5902d..159f4d62241d 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -295,7 +295,7 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus, */ uint64_t vcpu_pages = (DEFAULT_STACK_PGS + num_percpu_pages) * nr_vcpus; uint64_t extra_pg_pages = (extra_mem_pages + vcpu_pages) / PTES_PER_MIN_PAGE * 2; - uint64_t pages = DEFAULT_GUEST_PHY_PAGES + vcpu_pages + extra_pg_pages; + uint64_t pages = DEFAULT_GUEST_PHY_PAGES + extra_mem_pages + vcpu_pages + extra_pg_pages; struct kvm_vm *vm; int i; -- 2.25.1