[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/paging: tidy paging_mfn_is_dirty()
commit dc773e0e8997f10c4d369f9b60bc529a05de0b79 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Jan 12 08:53:05 2022 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Jan 12 08:53:05 2022 +0100 x86/paging: tidy paging_mfn_is_dirty() The function returning a boolean indicator, make it return bool. Also constify its struct domain parameter, albeit requiring to also adjust mm_locked_by_me(). Furthermore the function is used by shadow code only. Since mm_locked_by_me() needs touching anyway, also switch its return type to bool. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/include/asm/paging.h | 2 +- xen/arch/x86/mm/mm-locks.h | 2 +- xen/arch/x86/mm/paging.c | 23 ++++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h index 308f1115dd..2ddcfb022c 100644 --- a/xen/arch/x86/include/asm/paging.h +++ b/xen/arch/x86/include/asm/paging.h @@ -173,7 +173,7 @@ void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn); /* is this guest page dirty? * This is called from inside paging code, with the paging lock held. */ -int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn); +bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn); /* * Log-dirty radix tree indexing: diff --git a/xen/arch/x86/mm/mm-locks.h b/xen/arch/x86/mm/mm-locks.h index d6c073dc5c..fcfd4706ba 100644 --- a/xen/arch/x86/mm/mm-locks.h +++ b/xen/arch/x86/mm/mm-locks.h @@ -40,7 +40,7 @@ static inline void mm_lock_init(mm_lock_t *l) l->unlock_level = 0; } -static inline int mm_locked_by_me(mm_lock_t *l) +static inline bool mm_locked_by_me(const mm_lock_t *l) { return (l->lock.recurse_cpu == current->processor); } diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index dd6b2bdf6f..c8fd50822a 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -351,14 +351,14 @@ void paging_mark_dirty(struct domain *d, mfn_t gmfn) paging_mark_pfn_dirty(d, pfn); } - +#ifdef CONFIG_SHADOW_PAGING /* Is this guest page dirty? */ -int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn) +bool paging_mfn_is_dirty(const struct domain *d, mfn_t gmfn) { pfn_t pfn; mfn_t mfn, *l4, *l3, *l2; unsigned long *l1; - int rv; + bool dirty; ASSERT(paging_locked_by_me(d)); ASSERT(paging_mode_log_dirty(d)); @@ -367,36 +367,37 @@ int paging_mfn_is_dirty(struct domain *d, mfn_t gmfn) pfn = _pfn(get_gpfn_from_mfn(mfn_x(gmfn))); /* Invalid pages can't be dirty. */ if ( unlikely(!VALID_M2P(pfn_x(pfn))) ) - return 0; + return false; mfn = d->arch.paging.log_dirty.top; if ( !mfn_valid(mfn) ) - return 0; + return false; l4 = map_domain_page(mfn); mfn = l4[L4_LOGDIRTY_IDX(pfn)]; unmap_domain_page(l4); if ( !mfn_valid(mfn) ) - return 0; + return false; l3 = map_domain_page(mfn); mfn = l3[L3_LOGDIRTY_IDX(pfn)]; unmap_domain_page(l3); if ( !mfn_valid(mfn) ) - return 0; + return false; l2 = map_domain_page(mfn); mfn = l2[L2_LOGDIRTY_IDX(pfn)]; unmap_domain_page(l2); if ( !mfn_valid(mfn) ) - return 0; + return false; l1 = map_domain_page(mfn); - rv = test_bit(L1_LOGDIRTY_IDX(pfn), l1); + dirty = test_bit(L1_LOGDIRTY_IDX(pfn), l1); unmap_domain_page(l1); - return rv; -} + return dirty; +} +#endif /* Read a domain's log-dirty bitmap and stats. If the operation is a CLEAN, * clear the bitmap and stats as well. */ -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |