x86/shadow: OOS mode is HVM-only

XEN_DOMCTL_CDF_oos_off is forced set for PV domains, so the logic can't
ever be engaged for them. Conditionalize respective fields and remove
the respective bit from SHADOW_OPTIMIZATIONS when !HVM. As a result the
SH_type_oos_snapshot constant can disappear altogether in that case, and
a couple of #ifdef-s can also be dropped/combined.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Jan Beulich committed 2023-03-24 11:20:59 +01:00
1 parent 36053bddde
commit 9fa4258753
3 files changed
+4 -11

No files matched your search

+1 -3
View File
@@ -113,10 +113,10 @@ struct shadow_domain {
/* Fast MMIO path heuristic */
bool has_fast_mmio_entries;
#ifdef CONFIG_HVM
/* OOS */
bool_t oos_active;
#ifdef CONFIG_HVM
/* Has this domain ever used HVMOP_pagetable_dying? */
bool_t pagetable_dying_op;
#endif
@@ -152,7 +152,6 @@ struct shadow_vcpu {
unsigned long last_emulated_frame;
/* Last MFN that we emulated a write successfully */
unsigned long last_emulated_mfn;
#endif
/* Shadow out-of-sync: pages that this vcpu has let go out of sync */
mfn_t oos[SHADOW_OOS_PAGES];
@@ -163,7 +162,6 @@ struct shadow_vcpu {
unsigned long off[SHADOW_OOS_FIXUPS];
} oos_fixup[SHADOW_OOS_PAGES];
#ifdef CONFIG_HVM
bool_t pagetable_dying;
#endif
#endif
-2
View File
@@ -296,7 +296,6 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
switch ( mfn_to_page(smfn)->u.sh.type )
{
#ifdef CONFIG_HVM
case SH_type_l1_32_shadow:
case SH_type_fl1_32_shadow:
return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 2)
@@ -306,7 +305,6 @@ static int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn,
case SH_type_fl1_pae_shadow:
return SHADOW_INTERNAL_NAME(sh_rm_write_access_from_sl1p, 3)
(d, gmfn, smfn, off);
#endif
case SH_type_l1_64_shadow:
case SH_type_fl1_64_shadow:
+3 -6
View File
@@ -69,7 +69,8 @@ extern int shadow_audit_enable;
#ifdef CONFIG_HVM
#define SHADOW_OPTIMIZATIONS 0x1ff
#else
#define SHADOW_OPTIMIZATIONS (0x1ff & ~SHOPT_FAST_EMULATION)
#define SHADOW_OPTIMIZATIONS (0x1ff & ~(SHOPT_OUT_OF_SYNC | \
SHOPT_FAST_EMULATION))
#endif
@@ -205,8 +206,7 @@ extern void shadow_audit_tables(struct vcpu *v);
#define SH_type_max_shadow 6U
#define SH_type_p2m_table 7U /* in use as the p2m table */
#define SH_type_monitor_table 8U /* in use as a monitor table */
#define SH_type_oos_snapshot 9U /* in use as OOS snapshot */
#define SH_type_unused 10U
#define SH_type_unused 9U
#endif
#ifndef CONFIG_PV32 /* Unused (but uglier to #ifdef above): */
@@ -323,8 +323,6 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
#define SHF_out_of_sync (1u << (SH_type_max_shadow + 1))
#define SHF_oos_may_write (1u << (SH_type_max_shadow + 2))
#endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */
static inline int sh_page_has_multiple_shadows(struct page_info *pg)
{
u32 shadows;
@@ -335,7 +333,6 @@ static inline int sh_page_has_multiple_shadows(struct page_info *pg)
return shadows && (shadows & (shadows - 1));
}
#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC)
/* The caller must verify this is reasonable to call; i.e., valid mfn,
* domain is translated, &c */
static inline int page_is_out_of_sync(struct page_info *p)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.