[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/mm: Drop duplicate l1_disallow_mask() calls
commit d834c3d24132366a0700363516b3e64cf0df1130 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Apr 28 18:09:39 2022 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Jul 22 18:18:00 2024 +0100 x86/mm: Drop duplicate l1_disallow_mask() calls Even in release builds where the message is omitted, gdprintk() evalues its parameters for side effects, and l1_disallow_mask() is full of them. Calculate the disallow mask once and reuse the variable, resulting in better code generation: add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-207 (-207) Function old new delta mod_l1_entry 1947 1860 -87 get_page_from_l1e 1391 1271 -120 Also, render the bad flags message with a 0x prefix. No practical change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/mm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 648d6dd475..0ecea0f707 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -842,7 +842,7 @@ get_page_from_l1e( { unsigned long mfn = l1e_get_pfn(l1e); struct page_info *page = mfn_to_page(_mfn(mfn)); - uint32_t l1f = l1e_get_flags(l1e); + uint32_t l1f = l1e_get_flags(l1e), disallow; struct vcpu *curr = current; struct domain *real_pg_owner; bool write, valid; @@ -853,10 +853,10 @@ get_page_from_l1e( return 0; } - if ( unlikely(l1f & l1_disallow_mask(l1e_owner)) ) + disallow = l1_disallow_mask(l1e_owner); + if ( unlikely(l1f & disallow) ) { - gdprintk(XENLOG_WARNING, "Bad L1 flags %x\n", - l1f & l1_disallow_mask(l1e_owner)); + gdprintk(XENLOG_WARNING, "Bad L1 flags %#x\n", l1f & disallow); return -EINVAL; } @@ -2155,11 +2155,12 @@ static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e, if ( l1e_get_flags(nl1e) & _PAGE_PRESENT ) { struct page_info *page = NULL; + uint32_t disallow = l1_disallow_mask(pt_dom); - if ( unlikely(l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom)) ) + if ( unlikely(l1e_get_flags(nl1e) & disallow) ) { - gdprintk(XENLOG_WARNING, "Bad L1 flags %x\n", - l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom)); + gdprintk(XENLOG_WARNING, "Bad L1 flags %#x\n", + l1e_get_flags(nl1e) & disallow); return -EINVAL; } -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |