All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Tim Deegan" <tim@xen.org>
Subject: [PATCH v2 11/13] x86/shadow: vCPU-s never have "no mode"
Date: Thu, 30 Mar 2023 13:31:19 +0200	[thread overview]
Message-ID: <6b41e44e-282a-6397-a8e1-1d0782ace5c0@suse.com> (raw)
In-Reply-To: <fae14dc0-83aa-4647-6755-dd6913b6dba4@suse.com>

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@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

--- 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;



  parent reply	other threads:[~2023-03-30 11:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 11:22 [PATCH v2 00/13] x86: assorted shadow mode adjustments Jan Beulich
2023-03-30 11:24 ` [PATCH v2 01/13] x86/shadow: rename SHADOW_FOREACH_L<N>E() to FOREACH_PRESENT_L<N>E() Jan Beulich
2023-03-30 12:20   ` Andrew Cooper
2023-03-30 11:26 ` [PATCH v2 02/13] x86/shadow: drop redundant present bit checks from FOREACH_PRESENT_L<N>E() "bodies" Jan Beulich
2023-03-30 11:26 ` [PATCH v2 03/13] x86/shadow: reduce explicit log-dirty recording for HVM Jan Beulich
2023-03-30 11:27 ` [PATCH v2 04/13] x86/shadow: call sh_update_cr3() directly from sh_page_fault() Jan Beulich
2023-03-30 11:28 ` [PATCH v2 05/13] x86/shadow: don't generate bogus "domain dying" trace entry " Jan Beulich
2023-03-30 11:28 ` [PATCH v2 06/13] x86/shadow: use lighter weight mode checks Jan Beulich
2023-03-30 11:29 ` [PATCH v2 07/13] x86/shadow: move OOS functions to their own file Jan Beulich
2023-03-30 11:30 ` [PATCH v2 08/13] x86/shadow: sh_rm_write_access_from_sl1p() is HVM-only Jan Beulich
2023-03-30 11:30 ` [PATCH v2 09/13] x86/shadow: drop is_hvm_...() where easily possible Jan Beulich
2023-03-30 11:30 ` [PATCH v2 10/13] x86/shadow: make monitor table create/destroy more consistent Jan Beulich
2023-03-30 11:31 ` Jan Beulich [this message]
2023-03-30 11:31 ` [PATCH v2 12/13] x86/shadow: "monitor table" is a HVM-only concept Jan Beulich
2023-03-30 11:32 ` [PATCH v2 13/13] x86/shadow: adjust monitor table prealloc amount Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b41e44e-282a-6397-a8e1-1d0782ace5c0@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.