From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991352; cv=none; d=zohomail.com; s=zohoarc; b=TGQRS3h6t5F3eKCaGE+ila9Wv7nK8h4z+B5YlDPMm61WI+rpk6eBQxip2iOi58Dgg4jIsAyJspKLZiYMU7ssZlPJqDr3eTzl7xzwhOC3JCZkep5EwMF5elA6jeGSvhpOFgBAGtQ4lXXKSW5Y9oKhkpxFnUlwYObWeQdto0kDOYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991352; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bNif3eZYUBF7BnQ1Yw5FaGeiL/S3aKagQmr0I2wcHsM=; b=XQ0+tGAL4lr6YVyks6I0B01yEOKH+hluCkbpXd2RxjYZHS4IzREQ1DC07hhA4Y7jm5u10sHsK8adEDA7Bcq7JcK488wUnTM4V/BjsTlFa9onaH1GJvBZvE0z6U2QIKei7+2a9zQrfZnjVzn44f+/JWBJtpo9z2EqfRVyqR/uoZg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713991352265855.2886433175645; Wed, 24 Apr 2024 13:42:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711651.1111783 (Exim 4.92) (envelope-from ) id 1rzjRZ-0004VY-2Q; Wed, 24 Apr 2024 20:42:17 +0000 Received: by outflank-mailman (output) from mailman id 711651.1111783; Wed, 24 Apr 2024 20:42:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRY-0004VR-VO; Wed, 24 Apr 2024 20:42:16 +0000 Received: by outflank-mailman (input) for mailman id 711651; Wed, 24 Apr 2024 20:42:16 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRY-0004VD-3n for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:16 +0000 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [2a00:1450:4864:20::329]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 220f9bda-027b-11ef-909a-e314d9c70b13; Wed, 24 Apr 2024 22:42:14 +0200 (CEST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-417f5268b12so2931075e9.1 for ; Wed, 24 Apr 2024 13:42:14 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:13 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 220f9bda-027b-11ef-909a-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991334; x=1714596134; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bNif3eZYUBF7BnQ1Yw5FaGeiL/S3aKagQmr0I2wcHsM=; b=Y2b9qzWL2MJ/3Abwm59/U8BCH/32r/XgZc0ej7URKqcFouGFL+XZZtNeXht25HxjW3 XmGEkuzTjsTAW9i4zsiek9cdx8oYe1zXIHkWTKkJQJeOwCobxa1cgCDEcvwuXajuwugd 5IQEU5lfSw/dFRnGs6ZQKjX3RX24OqUgZeie4/psHI3apqUu5EyJH0iDGSXj3+wyZBWj XKyVNWjWMVMoxESendBtIHu/Ti92z896NuZ4eyvk4Jsfmti/tsPUlhuqVgpGDA284DBT z0xq38zLJs4P/0lTiaXN6gMrqn518NEffI/vN3lFUY+4vQUan5RtxRypRpR8+pmNiubo Js+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991334; x=1714596134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bNif3eZYUBF7BnQ1Yw5FaGeiL/S3aKagQmr0I2wcHsM=; b=N/B3EEO8hAd0RymcOfT5aTl76yp7MxQeuBTNOU4K7Pg1MOlwi7TYZQHdvy7qryeg9/ vYL9Wh5tqpBfjvVakUNd2YVG8Sl6wQu7v9wk2W/mzjyxtPZtihLTTkdLfshPAQLeZXaJ Xo6oQq8BaEJ9KceWEkgpoRX2kKfE0SpMfuSipouaShBfsibPTsxwinBC+YUapnZU2i+M QYDkqiK7F5EmtamDg1DUMqyk7fC/v8oT0ov7/w9crEkp6R8rXtxqk3sGRUlR5dmSSKcp ipY7VfSCoJUe5u0XS7rR9Y5IrbvTTYiXJaMu/43mSAZM88V9VVMxRnh+Q26jtYrzqN6G evRA== X-Gm-Message-State: AOJu0YxiXgF5n5qsJDaIaKytxI3NJWEruB0inr7o97gph1hxPupcj7oi NePmh4h1isYlf3IpFvwNfORppR/IEM0Sqj6AKbJk83IVnOC/4pZE1LvmedoP X-Google-Smtp-Source: AGHT+IEr1q6Hh6qsszswB55jxWD2BOHUU9L25Wm0Mrr0J5+StMuOuFvWwTlUvqoBvCcmp3IiMLAgWA== X-Received: by 2002:a05:600c:1c1e:b0:418:f6b7:429a with SMTP id j30-20020a05600c1c1e00b00418f6b7429amr2721049wms.27.1713991334081; Wed, 24 Apr 2024 13:42:14 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , George Dunlap , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/7] x86/p2m: Add braces for better code clarity Date: Wed, 24 Apr 2024 20:41:59 +0000 Message-Id: <2e6e4f07b9e8f50ae65697c8644995aa4851cdac.1713990376.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991353989100001 From: Petr Bene=C5=A1 No functional change. Signed-off-by: Petr Bene=C5=A1 Reviewed-by: Stefano Stabellini --- xen/arch/x86/mm/p2m.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index ce742c12e0..eb7996170d 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -106,6 +106,7 @@ void p2m_change_entry_type_global(struct domain *d, unsigned int i; =20 for ( i =3D 0; i < MAX_ALTP2M; i++ ) + { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { struct p2m_domain *altp2m =3D d->arch.altp2m_p2m[i]; @@ -114,6 +115,7 @@ void p2m_change_entry_type_global(struct domain *d, change_entry_type_global(altp2m, ot, nt); p2m_unlock(altp2m); } + } } =20 p2m_unlock(hostp2m); @@ -139,6 +141,7 @@ void p2m_memory_type_changed(struct domain *d) unsigned int i; =20 for ( i =3D 0; i < MAX_ALTP2M; i++ ) + { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { struct p2m_domain *altp2m =3D d->arch.altp2m_p2m[i]; @@ -147,6 +150,7 @@ void p2m_memory_type_changed(struct domain *d) _memory_type_changed(altp2m); p2m_unlock(altp2m); } + } } =20 p2m_unlock(hostp2m); --=20 2.34.1 From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991355; cv=none; d=zohomail.com; s=zohoarc; b=LuIfhkTTAGA5cqhHM0CJ9nayBNQT2cgGec3RtnVaJvI/Fz/KChL8NIcXDq0JYNNH6WU1c/ErpgWvO1k9jtuxLMSPFtQF4TrSVLp5jtSG0TF/oMkcD3YWF5f+PhMDlJRJ9xe+5FVFxxpAV4nISKvqIy3HN7NagSgw3riJOOtt810= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991355; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rtmRGO2sNugbwwUMKoj3jAhZKPNDueX11T7dOt/OTR0=; b=ZDPprgJ//dgf64Zk5EwZd4KpempoDvjBEmPL27AXAOZc2BOWYAaJLZ5O6oOyr5naFITFkIhYZLUy9bR/SDrVu5pR99N+q0Xr/5CyCFsoYKcfvgB+6Cfob4jKdVyRg/qnJAEcplbkYME8J3W/EzI/QZfUqxHZYccIvyRF0oRwre4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713991355211503.9756683037723; Wed, 24 Apr 2024 13:42:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711652.1111793 (Exim 4.92) (envelope-from ) id 1rzjRb-0004l2-BO; Wed, 24 Apr 2024 20:42:19 +0000 Received: by outflank-mailman (output) from mailman id 711652.1111793; Wed, 24 Apr 2024 20:42:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRb-0004kt-6w; Wed, 24 Apr 2024 20:42:19 +0000 Received: by outflank-mailman (input) for mailman id 711652; Wed, 24 Apr 2024 20:42:17 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRZ-0004VD-OJ for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:17 +0000 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [2a00:1450:4864:20::42c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2374edd0-027b-11ef-909a-e314d9c70b13; Wed, 24 Apr 2024 22:42:17 +0200 (CEST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-343d7ff2350so192285f8f.0 for ; Wed, 24 Apr 2024 13:42:17 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:16 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2374edd0-027b-11ef-909a-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991336; x=1714596136; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rtmRGO2sNugbwwUMKoj3jAhZKPNDueX11T7dOt/OTR0=; b=ImMDH9ujhm3A6f7PM/OCahBncT2sYc3LNlfNziJqPTpGb88ICHhIkKCdgjmrr6t6fg abP07Wp9Wu9iu6CpuMcXdPF4hRm+tWdb2E7cYVfSUcbD6DPgInGm8BzNfTeEHWb/Oobn Mn+C6xKBSbhrlX/malxSlK0JZ3fbnG+Ig4AqH2WzJmIGcCmzCbGQ+qYgZUW+iB1nL70A A61AbDsR0Ft9KMymkfeef+kqbYsciS3i66tRYT2LksTCQHIEZR4v8R5anmIKVxOIAMRw /M3ccCOzv+FgoSuYofFNL9bzXndkbGCtJbhPUTujnAIf7VijKiP2SoRWIjdBYM5ExxyR qV6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991336; x=1714596136; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rtmRGO2sNugbwwUMKoj3jAhZKPNDueX11T7dOt/OTR0=; b=WdTe5nZ7MyR5uo/UvuMD7ANNviaVD+39lvBjI5PO3MYRf8ajsp7qR7GgCLlBociG7b Botgwk/F01sH8uikdevZutht8ZuAU8nIVBCs8RqWM8RAoX3AkqVDb/PXcvZwZoShVdou 91RoHHQ8WOjEWGsi6eSy8eqV/fssWSs4veXt5VIkX6JzuW/oxFjM/5wlYyU+NDDwngfn OcQl64kHD9IY5RtCT3x2yMi9joZMGPIjb7y9USycg8XTm83NLXDd5jRKFKSHFBU8IkLV GkDMy6QrkTr9N+bq+WPZe4GSpaIjCDe4RD2RR8xrNGkcYUEbSXBsbrpTBHnuw9pPRQOj viEA== X-Gm-Message-State: AOJu0Yy1F1TYSX3b0NHtWSuAi0cpahbvQeZJmdaxKZmAfFpHT1WAgjiP WjbJDLpTylMentonVE0KsEyavXhQsVlbNmExs/wN8/LTI9HnnKMMzW25hPN9 X-Google-Smtp-Source: AGHT+IG8sceugR+jYafGwjUSLrOZpBOsjUm5hfGUZZCkEVCwELdsm33t7ujhWc20qe82/1Y2jbn3Uw== X-Received: by 2002:adf:ee50:0:b0:346:c746:289e with SMTP id w16-20020adfee50000000b00346c746289emr2566925wro.48.1713991336491; Wed, 24 Apr 2024 13:42:16 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , George Dunlap , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , =?UTF-8?q?Petr=20Bene=C5=A1?= Subject: [PATCH 2/7] x86/hap: Refactor boolean field assignments Date: Wed, 24 Apr 2024 20:42:00 +0000 Message-Id: <8203e5e06e326ad320878439e5342f7f1acc685d.1713990376.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991355814100003 From: Petr Bene=C5=A1 No functional change. Signed-off-by: Petr Bene=C5=A1 Acked-by: Jan Beulich --- xen/arch/x86/mm/hap/hap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 9f964c1d87..d2011fde24 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -522,7 +522,7 @@ int hap_enable(struct domain *d, u32 mode) goto out; } =20 - d->arch.altp2m_active =3D 0; + d->arch.altp2m_active =3D false; } =20 /* Now let other users see the new mode */ @@ -585,7 +585,7 @@ void hap_teardown(struct domain *d, bool *preempted) for_each_vcpu ( d, v ) altp2m_vcpu_disable_ve(v); =20 - d->arch.altp2m_active =3D 0; + d->arch.altp2m_active =3D false; =20 FREE_XENHEAP_PAGE(d->arch.altp2m_eptp); FREE_XENHEAP_PAGE(d->arch.altp2m_visible_eptp); --=20 2.34.1 From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991360; cv=none; d=zohomail.com; s=zohoarc; b=P5VplZhLEAXY88QydtVsJWWbL1bLwMaREXwb7hA1b+LS4wZx26YwCTEe9BUUgKA9bxDfRoFlS1CNc4NfU97BXb7RzBCDSgR4Z1o3YaJdiL7DUqnXqJBYL7AQ0Qqr3ToBWJ+j9g5DyyGui7Ie0dX+MBkOzJ0uGmCNI54SRWk+NVE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991360; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WAfYjJvPkpeUwPoknaRyn26fL3ELoKrAImMs8sUBNG8=; b=Bxnlej5WK74eJSCSmMxSatOUSwpYFS0gWmUhf59yhmXnkpzrqnHXC1FKcPtIAQADDooqIo0OSG+rv4iw4NBpdQtmM4D57qh91s05RSq9J5Q3RmUrXQNV1Lh5UZjPfXl2jqcltur0Ze65jYlz9z0XICxh8553CorISm5Cp1Jkwws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713991360165385.2584823531788; Wed, 24 Apr 2024 13:42:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711653.1111803 (Exim 4.92) (envelope-from ) id 1rzjRc-000511-IG; Wed, 24 Apr 2024 20:42:20 +0000 Received: by outflank-mailman (output) from mailman id 711653.1111803; Wed, 24 Apr 2024 20:42:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRc-00050p-ES; Wed, 24 Apr 2024 20:42:20 +0000 Received: by outflank-mailman (input) for mailman id 711653; Wed, 24 Apr 2024 20:42:19 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRb-0004VD-3q for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:19 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 243981a5-027b-11ef-909a-e314d9c70b13; Wed, 24 Apr 2024 22:42:18 +0200 (CEST) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56e1baf0380so263663a12.3 for ; Wed, 24 Apr 2024 13:42:18 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:17 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 243981a5-027b-11ef-909a-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991338; x=1714596138; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WAfYjJvPkpeUwPoknaRyn26fL3ELoKrAImMs8sUBNG8=; b=SOsPle97auYOjpzF2f51OdRJHUdYEudkOWf40mLxrmeBPlbqoTwO9wMocM9skXR4+s vgy3Xikp0LecJQmdssHUeyEaMjqWUe9VghU6OGoWB99cAF23xDxlF9f5qXE8ubEC8mvn i9Si9gesouI8rVBhO+4fTxgTfB30t/5hA0BsEZQmNhK8WgOR9yEJp9MBRdnqxD/EmXxz 3d6/5lvAYbUxT/86pcc4RCF0POHpKiw1IpzYYIUFbNulZFiZIJmtEZl7Il5LggunTFbe pPDSvk1IJE5j8zsEPvn3O9Y76Cq+cxdKLEBQu0hVUkFcwF5odokLD2PnMRdjzGP9C7s8 6ZxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991338; x=1714596138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WAfYjJvPkpeUwPoknaRyn26fL3ELoKrAImMs8sUBNG8=; b=al8qx01C6QSWCJXjykHkY3ScD/WPmROcAIpd2cmcYSD2imsIlGfrbpqYGBq10kvPqI 0Jd50+AK1TqhRLuKf30iJbpxIutybSUIqYMEk4ICBC1aGrwCPTZ76l+yHc9eMMoGINYZ RRiDO8Ucq9GLIfkYVFcAy1Nv1ZmAngee0qSFjZL1yaPSgWt5avEVSCk16IOAGtkThysC bEwTaIzhOtcePVxRufe9EeKIkT1iXFLBQxDoxReN0AlOLNnNd4wu/wkuQopJm2ZBeWU4 AtU1ZGkoHmuv65KCCwQydMFPpq9sgWcKWrKA1dqgK+RHyo4z0GBiBl+AEWaW1bqA6b7t 6ZNw== X-Gm-Message-State: AOJu0YzwQ3b/hdqXoIUjuxcEB9OQDA348DVOnn6LPd4SFsH8Su0krGON IctiRuLkz1GwizDiCLns4edvBl23eYZTKcR9UYUgB/6LU0uP2fiXUk4MymZ3 X-Google-Smtp-Source: AGHT+IHFIqilA6ppmChvKbdGy65AZ1DtFc0sTUjMQj2t5Za1Zus3DuheSe6yl/lh8MmS4Ib8mN4lBw== X-Received: by 2002:a17:906:7d2:b0:a55:adec:7139 with SMTP id m18-20020a17090607d200b00a55adec7139mr2282736ejc.60.1713991337459; Wed, 24 Apr 2024 13:42:17 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , George Dunlap , Nick Rosbrook , Anthony PERARD , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Juergen Gross Subject: [PATCH 3/7] tools/xl: Add max_altp2m parameter Date: Wed, 24 Apr 2024 20:42:01 +0000 Message-Id: <67b5dd52435132d0fb65e7b301970e17e092fa87.1713990376.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991361939100003 From: Petr Bene=C5=A1 Introduce a new max_altp2m parameter to control the maximum number of altp2m views a domain can use. By default, if max_altp2m is unspecified and altp2m= is enabled, the value is set to 10, reflecting the legacy behavior. Signed-off-by: Petr Bene=C5=A1 --- tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 8 ++++++++ tools/libs/light/libxl_create.c | 9 +++++++++ tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 4 ++++ xen/include/public/domctl.h | 1 + 7 files changed, 26 insertions(+) diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/h= elpers.gen.go index 78bdb08b15..4458d5bcbb 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1158,6 +1158,7 @@ if err :=3D x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.m= sr_relaxed);err !=3D nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } x.Altp2M =3D Altp2MMode(xc.altp2m) +x.MaxAltp2M =3D uint32(xc.max_altp2m) x.VmtraceBufKb =3D int(xc.vmtrace_buf_kb) if err :=3D x.Vpmu.fromC(&xc.vpmu);err !=3D nil { return fmt.Errorf("converting field Vpmu: %v", err) @@ -1674,6 +1675,7 @@ if err :=3D x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr= _relaxed); err !=3D nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } xc.altp2m =3D C.libxl_altp2m_mode(x.Altp2M) +xc.max_altp2m =3D C.uint32_t(x.MaxAltp2M) xc.vmtrace_buf_kb =3D C.int(x.VmtraceBufKb) if err :=3D x.Vpmu.toC(&xc.vpmu); err !=3D nil { return fmt.Errorf("converting field Vpmu: %v", err) diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/typ= es.gen.go index ccfe18019e..7139bcf324 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -602,6 +602,7 @@ ArchX86 struct { MsrRelaxed Defbool } Altp2M Altp2MMode +MaxAltp2M uint32 VmtraceBufKb int Vpmu Defbool } diff --git a/tools/include/libxl.h b/tools/include/libxl.h index 62cb07dea6..c73d9f2ff1 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -1239,6 +1239,14 @@ typedef struct libxl__ctx libxl_ctx; */ #define LIBXL_HAVE_ALTP2M 1 =20 +/* + * LIBXL_HAVE_MAX_ALTP2M + * If this is defined, then libxl supports setting the maximum number of + * alternate p2m tables. + */ +#define LIBXL_HAVE_MAX_ALTP2M 1 +#define LIBXL_MAX_ALTP2M_DEFAULT (~(uint32_t)0) + /* * LIBXL_HAVE_REMUS * If this is defined, then libxl supports remus. diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index 41252ec553..6ccc1fa158 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -483,6 +483,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, return -ERROR_INVAL; } =20 + if (b_info->max_altp2m =3D=3D LIBXL_MAX_ALTP2M_DEFAULT) { + if ((libxl_defbool_val(b_info->u.hvm.altp2m) || + b_info->altp2m !=3D LIBXL_ALTP2M_MODE_DISABLED)) + b_info->max_altp2m =3D 10; + else + b_info->max_altp2m =3D 0; + } + /* Assume that providing a bootloader user implies enabling restrict. = */ libxl_defbool_setdefault(&b_info->bootloader_restrict, !!b_info->bootloader_user); @@ -645,6 +653,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_conf= ig *d_config, .ssidref =3D info->ssidref, .max_vcpus =3D b_info->max_vcpus, .max_evtchn_port =3D b_info->event_channels, + .max_altp2m =3D b_info->max_altp2m, .max_grant_frames =3D b_info->max_grant_frames, .max_maptrack_frames =3D b_info->max_maptrack_frames, .grant_opts =3D XEN_DOMCTL_GRANT_version(b_info->max_grant_ver= sion), diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index 470122e768..c887d8ea8c 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -728,6 +728,7 @@ libxl_domain_build_info =3D Struct("domain_build_info",[ # Alternate p2m is not bound to any architecture or guest type, as it = is # supported by x86 HVM and ARM support is planned. ("altp2m", libxl_altp2m_mode), + ("max_altp2m", uint32, {'init_val': 'LIBXL_MAX_ALTP2M_DEFAULT'}), =20 # Size of preallocated vmtrace trace buffers (in KBYTES). # Use zero value to disable this feature. diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index ab09d0288b..741668e10a 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2061,6 +2061,10 @@ void parse_config_data(const char *config_source, } } =20 + if (!xlu_cfg_get_long(config, "max_altp2m", &l, 1)) { + b_info->max_altp2m =3D l; + } + if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) { b_info->vmtrace_buf_kb =3D l; } diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a33f9ec32b..7a34465c21 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -77,6 +77,7 @@ struct xen_domctl_createdomain { */ uint32_t max_vcpus; uint32_t max_evtchn_port; + uint32_t max_altp2m; int32_t max_grant_frames; int32_t max_maptrack_frames; =20 --=20 2.34.1 From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991361; cv=none; d=zohomail.com; s=zohoarc; b=cJCKjvSapUawauAdNCMLTkyDJ+jSStEKbC+XmTIzGEnlhcyo4QEREBxoW238Tjg2p86iLsTMy8N/fyb4ERBadaLwLMvunsW8xQbva/R21wWoFicZEXvnLxWPCbonWNdfsC7/ZDBAR/Ojj411906P9FVUn0JWfJlHW5km0ssO7WY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991361; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JBfj+N3t2vst9UyJVN7uxPweKAIqyhS3H5x3l711fQA=; b=OTTaKikNzbpqyqqrzSH40YOH45rDBHfAZS+UpzvCpmE+FdShaRrbZyJKfxJRKLwoKvex6QwYS7T2qtgxvN/lSdeyMczgA+0Zn3WTDt19DF8wblmFDiIyzBps+J21WQlxGPJi2xwi5Q/MWd1CxGDrKR0Ib+d89lzeDcYkFkgXqUE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713991361509103.9982166579764; Wed, 24 Apr 2024 13:42:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711655.1111818 (Exim 4.92) (envelope-from ) id 1rzjRe-0005Kz-Cs; Wed, 24 Apr 2024 20:42:22 +0000 Received: by outflank-mailman (output) from mailman id 711655.1111818; Wed, 24 Apr 2024 20:42:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRe-0005Jq-4u; Wed, 24 Apr 2024 20:42:22 +0000 Received: by outflank-mailman (input) for mailman id 711655; Wed, 24 Apr 2024 20:42:20 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRc-0004Gx-PB for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:20 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 24a80008-027b-11ef-b4bb-af5377834399; Wed, 24 Apr 2024 22:42:19 +0200 (CEST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5176f217b7bso478571e87.0 for ; Wed, 24 Apr 2024 13:42:19 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:17 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 24a80008-027b-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991338; x=1714596138; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JBfj+N3t2vst9UyJVN7uxPweKAIqyhS3H5x3l711fQA=; b=FaQmwM4dEoP/C/LsjQC3XSB8pioFJGsZbYeyfkUxcZTIgw9Fo9a+w571AhvGDYYgnE dpgUTzxrFPhVIfdpYu7w0+Z9/uyxTdJeArITGG7g57/bHCVN4v69jXJ/z7lojVpHRWZ8 buslYq6Azr8w/EBbv1CEPYulwn02NxHN0AnRCGLwWZHAHn2XsN68Hnh0+rC49v3r2l36 CJgPfuOXP+i2QJ3PnR5hE/RLQzC73QoyYUv8kKipM9LJUqyz+HWkV/hsEfI1GDQSs+im 0CBXlRGJIpb4YsY2BumeFs/V5dM57e7K7trQuQqmNj4sk5AIPjscOoRd53gYNagMbMX4 iVfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991338; x=1714596138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JBfj+N3t2vst9UyJVN7uxPweKAIqyhS3H5x3l711fQA=; b=CwITv0IxUF5rpq0u/If6q1rxAGJ81BfsV9LiwS3Nc8Ye2z9SKFhSq2yz/u0rEhnpLK IJz3Iiy5RMr7D4k4V2q6hXw1MdDc9EBM33+bzVbbHkKyOEybbooTmAK5uSKvICiLjuZk /injfihX0fyix/i0RmsfVwHxedIKM+ibcxzfju57juhoSs4MQCo3eX2WiG+J1NyqHUvM 24tBKgrhGuTxY0mSer7AUmZ4IDtbSEANwrpFk7BtCJQIp5+nTmCnztJ9s4ePFp5RVltW rGsme1/Poyzw1yseUa+uoGnwJAWVLOQOeHNBpF50iEWiuiubl/jo+mCjjOVENeFWLCQ9 jJbg== X-Gm-Message-State: AOJu0Yy1JEqCaytKHAPJkeMiJH1ReLY+GEyGG2sBPZyMB3gIKMir3d9H ufIKS3YS3nQfQS+XsvkhZ+xFLIqxW61x/S/I+zK6LLV8ZqIBjjouMul+kL3q X-Google-Smtp-Source: AGHT+IGl5czEozgynTrUnsTEFba8tXwOaOGTAjiGH8fJprif433sUaL3kFhMwC+ZGaHuYI3+LEqBgg== X-Received: by 2002:a19:f813:0:b0:518:c82a:bdf9 with SMTP id a19-20020a19f813000000b00518c82abdf9mr2997959lff.44.1713991338189; Wed, 24 Apr 2024 13:42:18 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Christian Lindig , David Scott , Anthony PERARD Subject: [PATCH 4/7] tools/ocaml: Add max_altp2m parameter Date: Wed, 24 Apr 2024 20:42:02 +0000 Message-Id: <9e9be821c2fe0ac4a7b66d652c10b2edbf5e42be.1713990376.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991361910100001 From: Petr Bene=C5=A1 Allow developers using the OCaml bindings to set the max_altp2m parameter. Signed-off-by: Petr Bene=C5=A1 Acked-by: Christian Lindig --- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + tools/ocaml/libs/xc/xenctrl_stubs.c | 17 ++++++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 55923857ec..ed851bb071 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -82,6 +82,7 @@ type domctl_create_config =3D iommu_opts: domain_create_iommu_opts list; max_vcpus: int; max_evtchn_port: int; + max_altp2m: int; max_grant_frames: int; max_maptrack_frames: int; max_grant_version: int; diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 9b4b45db3a..971b269d85 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -74,6 +74,7 @@ type domctl_create_config =3D { iommu_opts: domain_create_iommu_opts list; max_vcpus: int; max_evtchn_port: int; + max_altp2m: int; max_grant_frames: int; max_maptrack_frames: int; max_grant_version: int; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 2b6d3c09df..0b70cc9b08 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -207,12 +207,13 @@ CAMLprim value stub_xc_domain_create(value xch_val, v= alue wanted_domid, value co #define VAL_IOMMU_OPTS Field(config, 3) #define VAL_MAX_VCPUS Field(config, 4) #define VAL_MAX_EVTCHN_PORT Field(config, 5) -#define VAL_MAX_GRANT_FRAMES Field(config, 6) -#define VAL_MAX_MAPTRACK_FRAMES Field(config, 7) -#define VAL_MAX_GRANT_VERSION Field(config, 8) -#define VAL_VMTRACE_BUF_KB Field(config, 9) -#define VAL_CPUPOOL_ID Field(config, 10) -#define VAL_ARCH Field(config, 11) +#define VAL_MAX_ALTP2M Field(config, 6) +#define VAL_MAX_GRANT_FRAMES Field(config, 7) +#define VAL_MAX_MAPTRACK_FRAMES Field(config, 8) +#define VAL_MAX_GRANT_VERSION Field(config, 9) +#define VAL_VMTRACE_BUF_KB Field(config, 10) +#define VAL_CPUPOOL_ID Field(config, 11) +#define VAL_ARCH Field(config, 12) =20 uint32_t domid =3D Int_val(wanted_domid); uint64_t vmtrace_size =3D Int32_val(VAL_VMTRACE_BUF_KB); @@ -226,6 +227,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co .ssidref =3D Int32_val(VAL_SSIDREF), .max_vcpus =3D Int_val(VAL_MAX_VCPUS), .max_evtchn_port =3D Int_val(VAL_MAX_EVTCHN_PORT), + .max_altp2m =3D Int_val(VAL_MAX_ALTP2M), .max_grant_frames =3D Int_val(VAL_MAX_GRANT_FRAMES), .max_maptrack_frames =3D Int_val(VAL_MAX_MAPTRACK_FRAMES), .grant_opts =3D @@ -257,7 +259,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co #if defined(__i386__) || defined(__x86_64__) =20 /* Quick & dirty check for ABI changes. */ - BUILD_BUG_ON(sizeof(cfg) !=3D 64); + BUILD_BUG_ON(sizeof(cfg) !=3D 68); =20 /* Mnemonics for the named fields inside xen_x86_arch_domainconfig= */ #define VAL_EMUL_FLAGS Field(arch_domconfig, 0) @@ -291,6 +293,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co #undef VAL_MAX_GRANT_VERSION #undef VAL_MAX_MAPTRACK_FRAMES #undef VAL_MAX_GRANT_FRAMES +#undef VAL_MAX_ALTP2M #undef VAL_MAX_EVTCHN_PORT #undef VAL_MAX_VCPUS #undef VAL_IOMMU_OPTS --=20 2.34.1 From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991361; cv=none; d=zohomail.com; s=zohoarc; b=VW7B21fvMtCy87CjSCKNELNydtvb17kTQvWVTrejambnaD1BmSxMFPcb+n8WJA3QN9h6u8cl63jpYtoeqtDJp98OurvpXVCpOJIxDBNZO+1EgZz8HCWHOqSvwctVxe9n2h+ZKYHrwQL7HtljapBTQU4XhOplyjvI4H7rvfEjRjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991361; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M5idciq4z6LmfOUeSzwtHh7qUWkne+GPf19nH7mQTjs=; b=SQzbv6fTOhQhaclRsRpYinwUpAKAuTH1RJOFL/+J/NpsvSoLuc/GbSk5ekOEQW+yxb/GKhWzoLTk/46WzskoHVS2gmnqfd1bNvVwaYsy8KRx63O9Xkvi08bPdKZ/lMvpa14dgKxYCa7F08iFz0oRjLmXZf7KBWE5joQ35doXN1g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17139913610371013.4005098956119; Wed, 24 Apr 2024 13:42:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711654.1111813 (Exim 4.92) (envelope-from ) id 1rzjRd-0005Hj-Vh; Wed, 24 Apr 2024 20:42:21 +0000 Received: by outflank-mailman (output) from mailman id 711654.1111813; Wed, 24 Apr 2024 20:42:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRd-0005HY-Rs; Wed, 24 Apr 2024 20:42:21 +0000 Received: by outflank-mailman (input) for mailman id 711654; Wed, 24 Apr 2024 20:42:20 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRc-0004VD-Ef for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:20 +0000 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [2a00:1450:4864:20::533]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 251980cc-027b-11ef-909a-e314d9c70b13; Wed, 24 Apr 2024 22:42:19 +0200 (CEST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-56e78970853so2487386a12.0 for ; Wed, 24 Apr 2024 13:42:19 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:18 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 251980cc-027b-11ef-909a-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991339; x=1714596139; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M5idciq4z6LmfOUeSzwtHh7qUWkne+GPf19nH7mQTjs=; b=g3VHQisNx417pAwj31P4qqfA4Acl5zqT5MZI48Y6LsE9QCs8YI/mLDunLl10GQoSZN eoaloQ7fUfEMoa+OFVXIGUX4WAQEQmJHz+AQxBTkdJYV8BAxdFYjLUGbOnLbgu62YXr6 iqpcqH9+OxT2BuU6dYtnASn1dx0f9BVFbgFPTebYckCO9hwyPE/Ba5rvo5AGuzRJul14 ZIovrZMdnvzJoEKwoJEPSGGp6KDDvdPHmuWJN3e9N/FvXUNWOGz4F262UanF7tgvetBS r1RlbGkfmtgeiwgN1AhFHnK5DEXpEbDHhxGfssmjNvT6zVv8Nwo48cNALsN+ZoE1R8fV GYZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991339; x=1714596139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M5idciq4z6LmfOUeSzwtHh7qUWkne+GPf19nH7mQTjs=; b=Mz6/dbHwpseCLzfM4f7Ca+5SqN0HWAs/iNe4lsOnFrIPzsgQp8AULYZjwkW+Y5YOJ3 0plW6lhqnYhewolaKbyIR3HZ61kDPbSCfZtQvKXyX2R/VQ1zRTTJkrm+rTy/EKAz5+94 868THtOtgECdbISyWsQgH1FJ2REQjJzbf1yKjIL2Y/bEeUqGYKLsxevgkviP2tGhfOho TkEsp7FbRiVfkXq6xcnLIO13a+avFfJyD9AHCRFA2yq8iEV1yt8yQem76H0a39ECKLEa kJFrRmRT9owWoQE5z4TGDZfNZPsI2eEWOA0r5ywiki7jA0mR/xdnbkoFgywja4B7Rfj/ QJbQ== X-Gm-Message-State: AOJu0YxFaRqld/54x06FYierzbvQV1/QOXg6nWj3W3NuGMCSlAySRgMr 5cwJfTdJs1bgp+Sq3CpzRlQ9WsIcl+cETAqKjUG11iqJby2pzGDwVNvhnF/l X-Google-Smtp-Source: AGHT+IGc5OS3C3WX6mjQ3IlpqklHm9dcEPH3m3Ih0O36UTGDKHDOCX4seUN5412zu60YzRbTWD88Cg== X-Received: by 2002:a17:906:3716:b0:a55:43e5:3372 with SMTP id d22-20020a170906371600b00a5543e53372mr728923ejc.20.1713991339014; Wed, 24 Apr 2024 13:42:19 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD Subject: [PATCH 5/7] docs/man: Add max_altp2m parameter to the xl.cfg manual Date: Wed, 24 Apr 2024 20:42:03 +0000 Message-Id: <4d631207d60c8c6e80348d0e1fa368b3270b9c9e.1713990376.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991361916100002 From: Petr Bene=C5=A1 Update manual pages to include detailed information about the max_altp2m configuration parameter. Signed-off-by: Petr Bene=C5=A1 --- docs/man/xl.cfg.5.pod.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 8f2b375ce9..2d4ea35736 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -2039,6 +2039,20 @@ a single guest HVM domain. B: While the option "altp2mhvm" is deprecated, legacy applications f= or x86 systems will continue to work using it. =20 +=3Ditem B + +Specifies the maximum number of alternate-p2m views available to the guest. +This setting is crucial in domain introspection scenarios that require +multiple physical-to-machine (p2m) memory mappings to be established +simultaneously. + +Enabling multiple p2m views may increase memory usage. It is advisable to +review and adjust the B setting as necessary to accommodate +the additional memory requirements. + +B: This option is ignored if B is disabled. The default value +is 10. + =3Ditem B =20 Enable or disables guest access to hardware virtualisation features, --=20 2.34.1 From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991361; cv=none; d=zohomail.com; s=zohoarc; b=WMyv73IbMhS1NOba4ZVkAHLyovk7paHkZ1MKngJ2iPVts/veTazJtNT4jAV+/J+XS/S3wS9WTT6+y/rZ7MLnBVgsc4v7lXAwoC0jv/MuPG/9IUOkW5u6Ezs+bGqwrz94mPq7G9+hMUUyrZLfT8cIxAR6VCtKvamuepiJpW4IAtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991361; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dmNQTA7PqXi42pL4/xj2JJ0wWnGzNEVC+OcN1zwb0qI=; b=Abkb6t8JpEp8cGzaUQudLoxCvDZDeo/814VZkF4FMpHC2PuUjUjBEsVENV9F9Whrz8RjIZQDqp+tYTjwRbNZV1maWnDifKItM6dwsNEq2WhFPYUpzsaiO5HD+v7qTK9oTpourshvTeA5wod2TPDbqV3g/L4S12sg+2OL7/USRqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713991361639208.28962804308833; Wed, 24 Apr 2024 13:42:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711657.1111838 (Exim 4.92) (envelope-from ) id 1rzjRh-0005tq-4B; Wed, 24 Apr 2024 20:42:25 +0000 Received: by outflank-mailman (output) from mailman id 711657.1111838; Wed, 24 Apr 2024 20:42:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRg-0005sO-RO; Wed, 24 Apr 2024 20:42:24 +0000 Received: by outflank-mailman (input) for mailman id 711657; Wed, 24 Apr 2024 20:42:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRf-0004Gx-Gk for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:23 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 25be5100-027b-11ef-b4bb-af5377834399; Wed, 24 Apr 2024 22:42:21 +0200 (CEST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a55b78510bbso35536666b.0 for ; Wed, 24 Apr 2024 13:42:21 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:19 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 25be5100-027b-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991340; x=1714596140; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dmNQTA7PqXi42pL4/xj2JJ0wWnGzNEVC+OcN1zwb0qI=; b=CGtmcGlSiy39msAAEKGhE0Nays5/rNEKPp6rdkU78QYlGh2wT7d1MdpnflqfWuOAOt kfwrY+yaKrRBpAQiCQ9eZDu8f8ySMuvDRL9A3NJFhAOqJs66u4HVyp/8ms6N5TWNRUff OPDnf4K6/Tiuh0t5R6GGqfwWQiv3yGNMnKAr0XA0br1r2pqgroHLtocWLtTRaqBNBmi2 KubD4cUmcg3i4YLVV0sMRaxM1nkjvVI/oLu62X94B4pn/uPvZfJCnvtUzqYVp+mJ7efu 3toELr5xVOJxwGiEqiS/AQaHgocStEfrx4JvFBY/E9UUT+r7TebRfrJiK4elr8pxQg1Y of9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991340; x=1714596140; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dmNQTA7PqXi42pL4/xj2JJ0wWnGzNEVC+OcN1zwb0qI=; b=FJnr7CfnSt1+30n0SXv772MIV4RNEiuw0l3jaiDZP/cBgHitOsoZxmxsQNFjXNq920 fvzBK2QO6AtjzzY8Ou0iPAsdEqgzeJVksS5WUG9W5Wl6yVVo0U2U5npR07m7k4SvIbJ5 vir9X+NhA6TYz1i8aIF4Q5yAJVYIq/joq935Cf5vmgu3NYCNnn/AiggLYEW7BpmGKJm4 Km41/LOV7Q3Mpfs/aTYrraxfQbZ+iakW5CeH/kdr9Im4inbn9IWs9nc6tBZdR6GZjxBd epWtInTp/aw8D+pDmffwFGisJrIv8i8h3dSK/DTygSps1tXfpvxNNekrRT0MhKbfb5Cd xqng== X-Gm-Message-State: AOJu0Yxxc5ZTfLh3gWzUZf0agca7Zs3fx4KNehHk6FPeo/GeSaUm1m0B WDL1chrIH0cEbKEwQgxKbKcAT4Oorpa05/AgUKKT1r65BIY0NpwdM6f8ccnv X-Google-Smtp-Source: AGHT+IH9M+Z1J3Yzu2Mbi3ilt/SmbQRdRKV44wCjFjm/CfAroqOoXJmZYT/DTBwF5sy5WfdYH6DzfQ== X-Received: by 2002:a17:906:29cd:b0:a58:7dab:28a2 with SMTP id y13-20020a17090629cd00b00a587dab28a2mr2094556eje.48.1713991339964; Wed, 24 Apr 2024 13:42:19 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , George Dunlap , Julien Grall , Stefano Stabellini , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [PATCH 6/7] x86: Make the maximum number of altp2m views configurable Date: Wed, 24 Apr 2024 20:42:04 +0000 Message-Id: <234ad6cfd6292a83ffdfaf99cda54a76b0018203.1713990376.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991361939100004 From: Petr Bene=C5=A1 This commit introduces the ability to configure the maximum number of altp2m tables during domain creation. Previously, the limits were hardcoded to a maximum of 10. This change allows for greater flexibility in environments t= hat require more or fewer altp2m views. Signed-off-by: Petr Bene=C5=A1 --- xen/arch/x86/domain.c | 6 ++++ xen/arch/x86/hvm/hvm.c | 8 ++++- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/domain.h | 7 ++--- xen/arch/x86/include/asm/p2m.h | 4 +-- xen/arch/x86/mm/altp2m.c | 27 +++++++++++++++-- xen/arch/x86/mm/hap/hap.c | 6 ++-- xen/arch/x86/mm/mem_access.c | 14 ++++----- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 6 ++-- xen/arch/x86/mm/p2m.c | 50 +++++++++++++++---------------- xen/common/domain.c | 7 +++++ xen/include/xen/sched.h | 2 ++ 13 files changed, 92 insertions(+), 49 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 4f851aa81f..95ae675ad0 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -679,6 +679,12 @@ int arch_sanitise_domain_config(struct xen_domctl_crea= tedomain *config) return -EINVAL; } =20 + if ( config->max_altp2m > MAX_EPTP ) + { + dprintk(XENLOG_INFO, "max_altp2m must be <=3D %u\n", MAX_EPTP); + return -EINVAL; + } + if ( config->vmtrace_size ) { unsigned int size =3D config->vmtrace_size; diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 0ce45b177c..9b70fe7cfc 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4633,6 +4633,12 @@ static int do_altp2m_op( goto out; } =20 + if ( d->max_altp2m =3D=3D 0 ) + { + rc =3D -EINVAL; + goto out; + } + if ( (rc =3D xsm_hvm_altp2mhvm_op(XSM_OTHER, d, mode, a.cmd)) ) goto out; =20 @@ -5222,7 +5228,7 @@ void hvm_fast_singlestep(struct vcpu *v, uint16_t p2m= idx) if ( !hvm_is_singlestep_supported() ) return; =20 - if ( p2midx >=3D MAX_ALTP2M ) + if ( p2midx >=3D v->domain->max_altp2m ) return; =20 v->arch.hvm.single_step =3D true; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 0935762378..eadde4dbcb 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4888,7 +4888,7 @@ bool asmlinkage vmx_vmenter_helper(const struct cpu_u= ser_regs *regs) { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; ++i ) + for ( i =3D 0; i < currd->max_altp2m; ++i ) { if ( currd->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/d= omain.h index f5daeb182b..5bb0bcae81 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -258,11 +258,10 @@ struct paging_vcpu { struct shadow_vcpu shadow; }; =20 +#define INVALID_ALTP2M 0xffff +#define MAX_EPTP ((unsigned int)(PAGE_SIZE / sizeof(uint64_t))) #define MAX_NESTEDP2M 10 =20 -#define MAX_ALTP2M 10 /* arbitrary */ -#define INVALID_ALTP2M 0xffff -#define MAX_EPTP (PAGE_SIZE / sizeof(uint64_t)) struct p2m_domain; struct time_scale { int shift; @@ -353,7 +352,7 @@ struct arch_domain =20 /* altp2m: allow multiple copies of host p2m */ bool altp2m_active; - struct p2m_domain *altp2m_p2m[MAX_ALTP2M]; + struct p2m_domain **altp2m_p2m; mm_lock_t altp2m_list_lock; uint64_t *altp2m_eptp; uint64_t *altp2m_visible_eptp; diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h index 111badf89a..2086bcb633 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -881,7 +881,7 @@ static inline struct p2m_domain *p2m_get_altp2m(struct = vcpu *v) if ( index =3D=3D INVALID_ALTP2M ) return NULL; =20 - BUG_ON(index >=3D MAX_ALTP2M); + BUG_ON(index >=3D v->domain->max_altp2m); =20 return v->domain->arch.altp2m_p2m[index]; } @@ -891,7 +891,7 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsig= ned int idx) { struct p2m_domain *orig; =20 - BUG_ON(idx >=3D MAX_ALTP2M); + BUG_ON(idx >=3D v->domain->max_altp2m); =20 if ( idx =3D=3D vcpu_altp2m(v).p2midx ) return false; diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c index a04297b646..c91e0fbfd1 100644 --- a/xen/arch/x86/mm/altp2m.c +++ b/xen/arch/x86/mm/altp2m.c @@ -13,6 +13,12 @@ void altp2m_vcpu_initialise(struct vcpu *v) { + struct domain *d =3D v->domain; + + /* Skip initialisation if no altp2m will be used. */ + if ( d->max_altp2m =3D=3D 0 ) + return; + if ( v !=3D current ) vcpu_pause(v); =20 @@ -28,8 +34,13 @@ altp2m_vcpu_initialise(struct vcpu *v) void altp2m_vcpu_destroy(struct vcpu *v) { + struct domain *d =3D v->domain; struct p2m_domain *p2m; =20 + /* Skip destruction if no altp2m was used. */ + if ( d->max_altp2m =3D=3D 0 ) + return; + if ( v !=3D current ) vcpu_pause(v); =20 @@ -120,7 +131,13 @@ int p2m_init_altp2m(struct domain *d) struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); =20 mm_lock_init(&d->arch.altp2m_list_lock); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + + if ( (d->arch.altp2m_p2m =3D xzalloc_array(struct p2m_domain *, d->max= _altp2m)) =3D=3D NULL ) + { + return -ENOMEM; + } + + for ( i =3D 0; i < d->max_altp2m; i++ ) { d->arch.altp2m_p2m[i] =3D p2m =3D p2m_init_one(d); if ( p2m =3D=3D NULL ) @@ -141,7 +158,10 @@ void p2m_teardown_altp2m(struct domain *d) unsigned int i; struct p2m_domain *p2m; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + if ( !d->arch.altp2m_p2m ) + return; + + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( !d->arch.altp2m_p2m[i] ) continue; @@ -149,6 +169,9 @@ void p2m_teardown_altp2m(struct domain *d) d->arch.altp2m_p2m[i] =3D NULL; p2m_free_one(p2m); } + + xfree(d->arch.altp2m_p2m); + d->arch.altp2m_p2m =3D NULL; } =20 /* diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index d2011fde24..7aff5fa664 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -515,7 +515,7 @@ int hap_enable(struct domain *d, u32 mode) d->arch.altp2m_visible_eptp[i] =3D mfn_x(INVALID_MFN); } =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { rv =3D p2m_alloc_table(d->arch.altp2m_p2m[i]); if ( rv !=3D 0 ) @@ -538,7 +538,7 @@ void hap_final_teardown(struct domain *d) unsigned int i; =20 if ( hvm_altp2m_supported() ) - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) p2m_teardown(d->arch.altp2m_p2m[i], true, NULL); =20 /* Destroy nestedp2m's first */ @@ -590,7 +590,7 @@ void hap_teardown(struct domain *d, bool *preempted) FREE_XENHEAP_PAGE(d->arch.altp2m_eptp); FREE_XENHEAP_PAGE(d->arch.altp2m_visible_eptp); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { p2m_teardown(d->arch.altp2m_p2m[i], false, preempted); if ( preempted && *preempted ) diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c index 60a0cce68a..1bf40cb746 100644 --- a/xen/arch/x86/mm/mem_access.c +++ b/xen/arch/x86/mm/mem_access.c @@ -347,12 +347,12 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, = uint32_t nr, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || + if ( altp2m_idx >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; =20 - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->max_= altp2m)]; } =20 if ( !xenmem_access_to_p2m_access(p2m, access, &a) ) @@ -403,12 +403,12 @@ long p2m_set_mem_access_multi(struct domain *d, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || + if ( altp2m_idx >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; =20 - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->max_= altp2m)]; } =20 p2m_lock(p2m); @@ -466,12 +466,12 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, x= enmem_access_t *access, } else if ( altp2m_idx ) /* altp2m view 0 is treated as the hostp2m */ { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || + if ( altp2m_idx >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; =20 - p2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->max_a= ltp2m)]; } =20 return _p2m_get_mem_access(p2m, gfn, access); @@ -486,7 +486,7 @@ void arch_p2m_set_access_required(struct domain *d, boo= l access_required) if ( altp2m_active(d) ) { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { struct p2m_domain *p2m =3D d->arch.altp2m_p2m[i]; =20 diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index da28266ef0..3aaf1a3b8d 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -912,7 +912,7 @@ static int nominate_page(struct domain *d, gfn_t gfn, =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { ap2m =3D d->arch.altp2m_p2m[i]; if ( !ap2m ) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index f83610cb8c..6b75fafd49 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -1293,7 +1293,7 @@ static void ept_set_ad_sync(struct domain *d, bool va= lue) { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { struct p2m_domain *p2m; =20 @@ -1500,7 +1500,7 @@ void setup_ept_dump(void) =20 void p2m_init_altp2m_ept(struct domain *d, unsigned int i) { - struct p2m_domain *p2m =3D array_access_nospec(d->arch.altp2m_p2m, i); + struct p2m_domain *p2m =3D d->arch.altp2m_p2m[array_index_nospec(i, d-= >max_altp2m)]; struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); struct ept_data *ept; =20 @@ -1519,7 +1519,7 @@ unsigned int p2m_find_altp2m_by_eptp(struct domain *d= , uint64_t eptp) =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index eb7996170d..a7144fc8e1 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -105,7 +105,7 @@ void p2m_change_entry_type_global(struct domain *d, { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -140,7 +140,7 @@ void p2m_memory_type_changed(struct domain *d) { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -913,7 +913,7 @@ void p2m_change_type_range(struct domain *d, { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -986,7 +986,7 @@ int p2m_finish_type_change(struct domain *d, { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -1780,7 +1780,7 @@ bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, uns= igned int idx) struct domain *d =3D v->domain; bool rc =3D false; =20 - if ( idx >=3D MAX_ALTP2M ) + if ( idx >=3D d->max_altp2m ) return rc; =20 altp2m_list_lock(d); @@ -1886,8 +1886,8 @@ static void p2m_reset_altp2m(struct domain *d, unsign= ed int idx, { struct p2m_domain *p2m; =20 - ASSERT(idx < MAX_ALTP2M); - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + ASSERT(idx < d->max_altp2m); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->max_altp2m)]; =20 p2m_lock(p2m); =20 @@ -1912,7 +1912,7 @@ void p2m_flush_altp2m(struct domain *d) =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { p2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE); d->arch.altp2m_eptp[i] =3D mfn_x(INVALID_MFN); @@ -1928,9 +1928,9 @@ static int p2m_activate_altp2m(struct domain *d, unsi= gned int idx, struct p2m_domain *hostp2m, *p2m; int rc; =20 - ASSERT(idx < MAX_ALTP2M); + ASSERT(idx < d->max_altp2m); =20 - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->max_altp2m)]; hostp2m =3D p2m_get_hostp2m(d); =20 p2m_lock(p2m); @@ -1968,7 +1968,7 @@ int p2m_init_altp2m_by_id(struct domain *d, unsigned = int idx) int rc =3D -EINVAL; struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); =20 - if ( idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( idx >=3D min(d->max_altp2m, MAX_EPTP) ) return rc; =20 altp2m_list_lock(d); @@ -1995,7 +1995,7 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t *= idx, =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) continue; @@ -2017,7 +2017,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsign= ed int idx) struct p2m_domain *p2m; int rc =3D -EBUSY; =20 - if ( !idx || idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( !idx || idx >=3D min(d->max_altp2m, MAX_EPTP) ) return rc; =20 rc =3D domain_pause_except_self(d); @@ -2030,7 +2030,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsign= ed int idx) if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] !=3D mfn_x(INVALID_MFN) ) { - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->max_altp2m)]; =20 if ( !_atomic_read(p2m->active_vcpus) ) { @@ -2055,7 +2055,7 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, = unsigned int idx) struct vcpu *v; int rc =3D -EINVAL; =20 - if ( idx >=3D MAX_ALTP2M ) + if ( idx >=3D d->max_altp2m ) return rc; =20 rc =3D domain_pause_except_self(d); @@ -2090,13 +2090,13 @@ int p2m_change_altp2m_gfn(struct domain *d, unsigne= d int idx, mfn_t mfn; int rc =3D -EINVAL; =20 - if ( idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( idx >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] =3D=3D mfn_x(INVALID_MFN) ) return rc; =20 hp2m =3D p2m_get_hostp2m(d); - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + ap2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->max_altp2m)]; =20 p2m_lock(hp2m); p2m_lock(ap2m); @@ -2152,7 +2152,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn= _t gfn, =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { p2m_type_t t; p2m_access_t a; @@ -2175,7 +2175,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn= _t gfn, else { /* At least 2 altp2m's impacted, so reset everything */ - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->max_altp2m; i++ ) { if ( i =3D=3D last_reset_idx || d->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) @@ -2575,12 +2575,12 @@ int p2m_set_suppress_ve_multi(struct domain *d, =20 if ( sve->view > 0 ) { - if ( sve->view >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) = || + if ( sve->view >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(sve->view, MAX_EPTP)] = =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; =20 - p2m =3D ap2m =3D array_access_nospec(d->arch.altp2m_p2m, sve->view= ); + p2m =3D ap2m =3D d->arch.altp2m_p2m[array_index_nospec(sve->view, = d->max_altp2m)]; } =20 p2m_lock(host_p2m); @@ -2643,12 +2643,12 @@ int p2m_get_suppress_ve(struct domain *d, gfn_t gfn= , bool *suppress_ve, =20 if ( altp2m_idx > 0 ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || + if ( altp2m_idx >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; =20 - p2m =3D ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_id= x); + p2m =3D ap2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx,= d->max_altp2m)]; } else p2m =3D host_p2m; @@ -2679,9 +2679,9 @@ int p2m_set_altp2m_view_visibility(struct domain *d, = unsigned int altp2m_idx, =20 /* * Eptp index is correlated with altp2m index and should not exceed - * min(MAX_ALTP2M, MAX_EPTP). + * min(d->max_altp2m, MAX_EPTP). */ - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( altp2m_idx >=3D min(d->max_altp2m, MAX_EPTP) || d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] =3D= =3D mfn_x(INVALID_MFN) ) rc =3D -EINVAL; diff --git a/xen/common/domain.c b/xen/common/domain.c index 6773f7fb90..18785cc22a 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -568,6 +568,12 @@ static int sanitise_domain_config(struct xen_domctl_cr= eatedomain *config) } } =20 + if ( config->max_altp2m && !hvm_altp2m_supported() ) + { + dprintk(XENLOG_INFO, "altp2m requested but not available\n"); + return -EINVAL; + } + if ( config->vmtrace_size && !vmtrace_available ) { dprintk(XENLOG_INFO, "vmtrace requested but not available\n"); @@ -610,6 +616,7 @@ struct domain *domain_create(domid_t domid, if ( config ) { d->options =3D config->flags; + d->max_altp2m =3D config->max_altp2m; d->vmtrace_size =3D config->vmtrace_size; } =20 diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 132b841995..46436fcb0b 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -602,6 +602,8 @@ struct domain unsigned int guest_request_sync : 1; } monitor; =20 + unsigned int max_altp2m; /* Maximum number of altp2m tables */ + unsigned int vmtrace_size; /* Buffer size in bytes, or 0 to disable. */ =20 #ifdef CONFIG_ARGO --=20 2.34.1 From nobody Sat May 18 23:55:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1713991363; cv=none; d=zohomail.com; s=zohoarc; b=NCJVk5fQ2guIHNndMijP+3ATYa8GErnnMbkGZPYKOZYj4Y+NI6k7xjfKqXYF70isJ8Ua7DYoh7L3my/2RcG62rv2V520t7rSVCsMB902nWi46SLZFderIDUeHl7LOHwPYd63IQnJQJ6a4c3GV05gT8586FmUgf+muKEeVW6O2C0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713991363; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VaVPevDI7mTli+wad6D33iRtuC6KkdRRxbwuuGTBCyg=; b=gpASBSPPL625W6SH3xIoIa5BN2c6bj6NLypTWJNn/2IeObiNYX5csrqqLuQ9gELZ/Z3O8LZS+fyuMt6xXgAVEKsSjGEm7HY/W7XqWr50Ic3grSgNQ51aGm6aJMAQ2vNT5WwA3nAF12WWcO1RggUUqWrUyMyRRVDnxKxfkeKSNWc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1713991363052994.677488353806; Wed, 24 Apr 2024 13:42:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.711656.1111832 (Exim 4.92) (envelope-from ) id 1rzjRg-0005q1-JB; Wed, 24 Apr 2024 20:42:24 +0000 Received: by outflank-mailman (output) from mailman id 711656.1111832; Wed, 24 Apr 2024 20:42:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRg-0005pq-Fn; Wed, 24 Apr 2024 20:42:24 +0000 Received: by outflank-mailman (input) for mailman id 711656; Wed, 24 Apr 2024 20:42:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rzjRf-0004Gx-9Y for xen-devel@lists.xenproject.org; Wed, 24 Apr 2024 20:42:23 +0000 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [2a00:1450:4864:20::62e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2616d243-027b-11ef-b4bb-af5377834399; Wed, 24 Apr 2024 22:42:21 +0200 (CEST) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a55b93f5540so37777166b.1 for ; Wed, 24 Apr 2024 13:42:21 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id cd9-20020a170906b34900b00a5264576138sm8740067ejb.35.2024.04.24.13.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 13:42:20 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2616d243-027b-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713991341; x=1714596141; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VaVPevDI7mTli+wad6D33iRtuC6KkdRRxbwuuGTBCyg=; b=GK/4OYI1oYIA7Qk3oDJIQU1QQqXq5m0ybTuTGvCVgBLvyWcwcg+YfL+dNWFWcxaH6z tbjNiO1kd5AGwFEocDNtS1D3eFrJuusWc9MMhbSA+csNDKtbPBTfHLr2cgDRwGUpTMUB nUjQDFeVkhELrSFIsyuHyKWPniZYPszn7F4qtSBvMo2zPJeTtwWm+56sq5j8DWKphRwq HuOwJhDtPjoX71dUn5kURfPnlc6KEZL8jWh+R/AdWcQF5VsSPLLvhRoLuyQAzqsRk4r+ 8sHK/cGDtBe4DYZuQ9OEHaGZYRnuwC+qSjMu6gVLBvRYyC6Jvu/6/ZetnPflUhJ5ttRe U2vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713991341; x=1714596141; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VaVPevDI7mTli+wad6D33iRtuC6KkdRRxbwuuGTBCyg=; b=bNQnx7/X+yRrRPn6j6OMtG6hlEcp1SM8501BuzAoxabbZ7+dfU8ZPf+cQoaQ38R/xi ze9Gm6nSHKT104dqc6kfnSe/gyyXqOXsC5CkYWzsMciMo5b2/P8IrFfvqSoR/o1T8Z45 FImViOB2IihXQOrSHvSjWXnMray72eAns3DDVJlqAdsVqxoqkA+Sw2GQU/1FPHDjSdN9 vzQNRmpprVf/d1fBxdpQiOllc+eUqQeZm/kKpOWB+LQ5Ru9tVybuSHlC43HIrkCF0Six asLUtPlapb8iEKxaJiHi/tYEhqv5xpaCsuZKNK3XVmAIbqho7B2KcOPa485Rw1h3YA3L EVGA== X-Gm-Message-State: AOJu0YwnJIjEbhequRVC9mLIOsgoor8dGOY/M7SbvEcODNEydrnAPHCW HS4/3iGvYn6jOujkxDgzZTCVAxKuXlVW0R4umfoZCE923ruwV+q0J+j6QRjl X-Google-Smtp-Source: AGHT+IFCW5hMprZMfrpRZlKrrGduxFVWsVSJ+kjV7nV9wO4iON20FpRdnPsCE5jIa5xuH2VZFNAZJg== X-Received: by 2002:a17:906:f2d8:b0:a55:b99d:74a7 with SMTP id gz24-20020a170906f2d800b00a55b99d74a7mr2373463ejb.11.1713991340822; Wed, 24 Apr 2024 13:42:20 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 7/7] x86/hap: Increase the number of initial mempool_size to 1024 pages Date: Wed, 24 Apr 2024 20:42:05 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1713991363852100009 From: Petr Bene=C5=A1 This change anticipates scenarios where `max_altp2m` is set to its maximum supported value (i.e., 512), ensuring sufficient memory is allocated upfront to accommodate all altp2m tables without initialization failure. Signed-off-by: Petr Bene=C5=A1 --- tools/tests/paging-mempool/test-paging-mempool.c | 2 +- xen/arch/x86/mm/hap/hap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/tests/paging-mempool/test-paging-mempool.c b/tools/tests= /paging-mempool/test-paging-mempool.c index 1ebc13455a..91b06fa0cf 100644 --- a/tools/tests/paging-mempool/test-paging-mempool.c +++ b/tools/tests/paging-mempool/test-paging-mempool.c @@ -35,7 +35,7 @@ static struct xen_domctl_createdomain create =3D { =20 static uint64_t default_mempool_size_bytes =3D #if defined(__x86_64__) || defined(__i386__) - 256 << 12; /* Only x86 HAP for now. x86 Shadow needs more work. */ + 1024 << 12; /* Only x86 HAP for now. x86 Shadow needs more work. */ #elif defined (__arm__) || defined(__aarch64__) 16 << 12; #endif diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 7aff5fa664..fab7e256a4 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -468,7 +468,7 @@ int hap_enable(struct domain *d, u32 mode) if ( old_pages =3D=3D 0 ) { paging_lock(d); - rv =3D hap_set_allocation(d, 256, NULL); + rv =3D hap_set_allocation(d, 1024, NULL); if ( rv !=3D 0 ) { hap_set_allocation(d, 0, NULL); --=20 2.34.1