[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/4] xen/arch: Switch local_irq_restore() to being a static inline helper
There is no need for these to be macros, so change them for symetry with local_irq_save(). Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Julien Grall <julien.grall@xxxxxxx> RFC, as I expect this patch to get some objection for removing the IRQ safety check, but the only reasons that change was made in e5fc6434d7 was because I talk talked into doing it while trying to clean up some unnecessary use of magic numbers. No users are changing any flags (seeing as I've auditing them all in this series), and the improvement in emitted code nets us: add/remove: 1/2 grow/shrink: 2/50 up/down: 835/-2049 (-1214) Function old new delta __page_fault_type - 692 +692 reprogram_hpet_evt_channel 243 354 +111 do_page_fault 1249 1281 +32 time_latch_stamps 73 62 -11 vmx_cpu_down 152 136 -16 setup_boot_APIC_clock 896 880 -16 send_IPI_mask_flat 181 165 -16 resource_access 311 295 -16 map_domain_page 1204 1188 -16 lapic_resume 1100 1084 -16 hvm_do_IRQ_dpci 210 194 -16 generic_set_mtrr 258 242 -16 flush_area_local 604 588 -16 dump_runq 293 277 -16 dpci_softirq 726 710 -16 csched2_sys_cntl 237 221 -16 csched2_init_pdata 229 213 -16 csched2_deinit_pdata 354 338 -16 csched2_alloc_domdata 402 386 -16 __printk_ratelimit 332 316 -16 vmx_load_vmcs 156 139 -17 timer_irq_works 85 68 -17 switch_cr3_cr4 249 232 -17 send_IPI_mask_x2apic_phys 199 182 -17 setup_APIC_timer 31 13 -18 serial_tx_interrupt 286 268 -18 console_unlock_recursive_irqrestore 38 20 -18 _spin_unlock_irqrestore 49 31 -18 send_IPI_mask_x2apic_cluster 423 404 -19 csched2_dump 1297 1278 -19 __sync_local_execstate 83 64 -19 enter_state_helper 1210 1190 -20 vprintk_common 346 322 -24 unmap_domain_page 475 451 -24 set_mtrr 346 322 -24 lapic_suspend 742 718 -24 kill_timer 562 538 -24 ipi_handler 155 131 -24 init_percpu_time 411 387 -24 generic_set_all 703 679 -24 csched2_free_domdata 138 114 -24 send_IPI_mask_phys 305 278 -27 call_rcu 223 196 -27 self_nmi 144 112 -32 erst_write 620 588 -32 _ehci_dbgp_poll 473 433 -40 timer_expires_before 328 285 -43 check_for_livepatch_work 813 767 -46 stop_timer 400 352 -48 set_timer 499 450 -49 init_timer 395 346 -49 csched2_dom_cntl 1573 1516 -57 setup_IO_APIC 4797 4738 -59 hpet_next_event 84 - -84 spurious_page_fault 756 - -756 Total: Before=3301185, After=3299971, chg -0.04% which in particular changes some inlining considerations. We could have an assertion that system flags dont change, and might want to consider having some kind of CONFIG_HARDEN for use in release builds, but given 6 years of hindsight, it would be better for developer builds to complain loudly for misuses, rather than to silenty squash the error. --- xen/include/asm-arm/arm32/system.h | 14 +++++--------- xen/include/asm-arm/arm64/system.h | 15 ++++++--------- xen/include/asm-x86/system.h | 14 ++++---------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/asm-arm/arm32/system.h index f7c8e53..2fef536 100644 --- a/xen/include/asm-arm/arm32/system.h +++ b/xen/include/asm-arm/arm32/system.h @@ -26,15 +26,11 @@ static inline unsigned long local_irq_save(void) return flags; } -#define local_irq_restore(x) \ -({ \ - BUILD_BUG_ON(sizeof(x) != sizeof(long)); \ - asm volatile ( \ - "msr cpsr_c, %0 @ local_irq_restore\n" \ - : \ - : "r" (x) \ - : "memory", "cc"); \ -}) +static inline void local_irq_restore(unsigned long flags) +{ + asm volatile ("msr cpsr_c, %0 @ local_irq_restore\n" + :: "r" (flags) : "memory", "cc"); +} static inline bool local_irq_is_enabled(void) { diff --git a/xen/include/asm-arm/arm64/system.h b/xen/include/asm-arm/arm64/system.h index 67e2ed4..7330b0a 100644 --- a/xen/include/asm-arm/arm64/system.h +++ b/xen/include/asm-arm/arm64/system.h @@ -38,15 +38,12 @@ static inline unsigned long local_irq_save(void) return flags; } -#define local_irq_restore(x) \ -({ \ - BUILD_BUG_ON(sizeof(x) != sizeof(long)); \ - asm volatile ( \ - "msr daif, %0 // local_irq_restore" \ - : \ - : "r" (x) \ - : "memory"); \ -}) +static inline void local_irq_restore(unsigned long flags) +{ + asm volatile ( "msr daif, %0 // local_irq_restore" + :: "r" (flags) : "memory" ); + +} static inline bool local_irq_is_enabled(void) { diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h index 756b21f..b0906e7 100644 --- a/xen/include/asm-x86/system.h +++ b/xen/include/asm-x86/system.h @@ -271,16 +271,10 @@ static inline unsigned long local_irq_save(void) return flags; } -#define local_irq_restore(x) \ -({ \ - BUILD_BUG_ON(sizeof(x) != sizeof(long)); \ - asm volatile ( "pushfq\n\t" \ - "andq %0, (%%rsp)\n\t" \ - "orq %1, (%%rsp)\n\t" \ - "popfq" \ - : : "i?r" ( ~X86_EFLAGS_IF ), \ - "ri" ( (x) & X86_EFLAGS_IF ) ); \ -}) +static inline void local_irq_restore(unsigned long flags) +{ + asm volatile ( "push %0; popf;" :: "g" (flags) : "memory" ); +} static inline bool local_irq_is_enabled(void) { -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |