[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 11/13] x86/shadow: vCPU-s never have "no mode"


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Mar 2023 13:31:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pm/MJtSEloG9bhupNLw1FgcnGKAOHIGYAu+yof1N0B0=; b=iTHvTioKrh+sf5KlqVV7ZCT85hBZzRAAY+jAmogZviG3mp9mgDzBKEpn2zX61Nx8Z0ADKrsqpS1SPhEFKKnh/m2BLLM2VvxlpFErlL69zKuwfyplduJJVPVVmw4Fmq6ZqFBOkAtO0JrqiFedaGrAPdf5LRxyypbwaHj3xmZyO6CP2ZuXfFxtVkXDIoTAj8Qf82kgxS17ZUlKSG0FCV+giPvcC224enuiWzRgiQ44+0giHgv/fka7uvMnsvnQMuqYxJWehcLVZrJYEpGt1MEz6GvzJzHBPpdTlQ7i9GzuKcWAa/D1Oso737mSJdgGN80DDJYwpXep0N2jihCIk1spbA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEAezTPRfpOrOzkIsF8PtVUubNazP3Ic4XJR6GZQMJWEraX0SyOlJi6Ox3kwI1+EORJoiva3YLktEXGPCqlmDZaSRDhvf/+4S8RehFG4CJ9zPnR0XgEP/IPjrLy0pJtNqX5UCtCtkLen0sL502qNxkPQmwdnM+uoHYpYksTSwB2hVv0bxCxEbAGX/7nBLq+gmV5sVCvPGztUS5pFks5We6LY/GnrC9Vokj2BFeQByPguO2rOaRKPgFVhdKwmExbbpyQIxNSbt63WMi3jh/AfZjVlvXzh7Z6N27SY6G1awiRGUdGPq8Hn5P7Q7r6xCt85Qsai4DozL0CGOFl3HnE8cg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>
  • Delivery-date: Thu, 30 Mar 2023 11:31:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

With an initial mode installed by shadow_vcpu_init(), there's no need
for sh_update_paging_modes() to deal with the "mode is still unset"
case. Leave an assertion, though.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1864,6 +1864,8 @@ static void sh_update_paging_modes(struc
             make_cr3(v, mmfn);
             hvm_update_host_cr3(v);
         }
+        else if ( !old_mode )
+            ASSERT_UNREACHABLE();
         else if ( v->arch.paging.mode != old_mode )
         {
             SHADOW_PRINTK("new paging mode: %pv pe=%d gl=%u "
@@ -1872,11 +1874,10 @@ static void sh_update_paging_modes(struc
                           hvm_paging_enabled(v),
                           v->arch.paging.mode->guest_levels,
                           v->arch.paging.mode->shadow.shadow_levels,
-                          old_mode ? old_mode->guest_levels : 0,
-                          old_mode ? old_mode->shadow.shadow_levels : 0);
-            if ( old_mode &&
-                 (v->arch.paging.mode->shadow.shadow_levels !=
-                  old_mode->shadow.shadow_levels) )
+                          old_mode->guest_levels,
+                          old_mode->shadow.shadow_levels);
+            if ( v->arch.paging.mode->shadow.shadow_levels !=
+                 old_mode->shadow.shadow_levels )
             {
                 /* Need to make a new monitor table for the new mode */
                 mfn_t new_mfn, old_mfn;




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.