[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/4] xen/arch: Switch local_irq_save() to being a static inline helper



... rather than a macro which writes to its parameter by name.  Take the
opportunity to fold the assignment into the flags declaraion where
appropriate.

No functional change.

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>
---
 xen/arch/arm/mm.c                  |  4 ++--
 xen/arch/arm/p2m.c                 |  2 +-
 xen/arch/x86/acpi/power.c          |  2 +-
 xen/arch/x86/apic.c                | 10 +++++-----
 xen/arch/x86/cpu/mtrr/generic.c    |  4 ++--
 xen/arch/x86/cpu/mtrr/main.c       |  6 ++----
 xen/arch/x86/domain.c              |  2 +-
 xen/arch/x86/domain_page.c         |  4 ++--
 xen/arch/x86/flushtlb.c            |  4 ++--
 xen/arch/x86/genapic/x2apic.c      |  4 ++--
 xen/arch/x86/hpet.c                |  3 +--
 xen/arch/x86/hvm/vmx/vmcs.c        |  6 ++----
 xen/arch/x86/io_apic.c             |  2 +-
 xen/arch/x86/nmi.c                 |  3 ++-
 xen/arch/x86/platform_hypercall.c  |  2 +-
 xen/arch/x86/smp.c                 |  4 ++--
 xen/arch/x86/time.c                |  5 ++---
 xen/arch/x86/traps.c               |  2 +-
 xen/common/cpupool.c               |  2 +-
 xen/common/gdbstub.c               |  6 ++----
 xen/common/livepatch.c             |  4 ++--
 xen/common/rcupdate.c              |  2 +-
 xen/common/spinlock.c              |  3 +--
 xen/common/timer.c                 |  2 +-
 xen/drivers/char/console.c         |  5 ++---
 xen/drivers/char/serial.c          |  4 +---
 xen/drivers/passthrough/io.c       |  4 ++--
 xen/include/asm-arm/arm32/system.h | 14 +++++++++-----
 xen/include/asm-arm/arm64/system.h | 14 +++++++++-----
 xen/include/asm-x86/system.h       | 14 +++++++++-----
 xen/include/xen/rwlock.h           |  7 +++----
 xen/include/xen/spinlock.h         |  2 +-
 32 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 987fcb9..9b1da81 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -401,7 +401,7 @@ void *map_domain_page(mfn_t mfn)
     lpae_t pte;
     int i, slot;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     /* The map is laid out as an open-addressed hash table where each
      * entry is a 2MB superpage pte.  We use the available bits of each
@@ -467,7 +467,7 @@ void unmap_domain_page(const void *va)
     lpae_t *map = this_cpu(xen_dommap);
     int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
     ASSERT(map[slot].pt.avail != 0);
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 6c76298..81a98ef 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -146,7 +146,7 @@ static void p2m_force_tlb_flush_sync(struct p2m_domain *p2m)
     ovttbr = READ_SYSREG64(VTTBR_EL2);
     if ( ovttbr != p2m->vttbr )
     {
-        local_irq_save(flags);
+        flags = local_irq_save();
         WRITE_SYSREG64(p2m->vttbr, VTTBR_EL2);
         isb();
     }
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 93e967f..7d64904 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -197,7 +197,7 @@ static int enter_state(u32 state)
     console_start_sync();
     printk("Entering ACPI S%d state.\n", state);
 
-    local_irq_save(flags);
+    flags = local_irq_save();
     spin_debug_disable();
 
     if ( (error = device_power_down()) != SAVED_ALL )
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index 7120107..031b3ee 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -718,7 +718,7 @@ int lapic_suspend(void)
     if (maxlvt >= 5)
         apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
 
-    local_irq_save(flags);
+    flags = local_irq_save();
     disable_local_APIC();
     iommu_disable_x2apic_IR();
     local_irq_restore(flags);
@@ -734,7 +734,7 @@ int lapic_resume(void)
     if (!apic_pm_state.active)
         return 0;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     /*
      * Make sure the APICBASE points to the right address
@@ -1094,8 +1094,8 @@ static void __setup_APIC_LVTT(unsigned int clocks)
 
 static void setup_APIC_timer(void)
 {
-    unsigned long flags;
-    local_irq_save(flags);
+    unsigned long flags = local_irq_save();
+
     __setup_APIC_LVTT(0);
     local_irq_restore(flags);
 }
@@ -1302,7 +1302,7 @@ void __init setup_boot_APIC_clock(void)
 
     check_deadline_errata();
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     calibrate_APIC_clock();
 
diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c
index 8f9cf1b..3612b8a 100644
--- a/xen/arch/x86/cpu/mtrr/generic.c
+++ b/xen/arch/x86/cpu/mtrr/generic.c
@@ -493,7 +493,7 @@ static void generic_set_all(void)
        unsigned long flags;
        bool pge;
 
-       local_irq_save(flags);
+       flags = local_irq_save();
        pge = prepare_set();
 
        /* Actually set the state */
@@ -528,7 +528,7 @@ static void generic_set_mtrr(unsigned int reg, unsigned 
long base,
 
        vr = &mtrr_state.var_ranges[reg];
 
-       local_irq_save(flags);
+       flags = local_irq_save();
        pge = prepare_set();
 
        if (size == 0) {
diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c
index e9df53f..c0780e2 100644
--- a/xen/arch/x86/cpu/mtrr/main.c
+++ b/xen/arch/x86/cpu/mtrr/main.c
@@ -137,9 +137,7 @@ static void ipi_handler(void *info)
 */
 {
        struct set_mtrr_data *data = info;
-       unsigned long flags;
-
-       local_irq_save(flags);
+       unsigned long flags = local_irq_save();
 
        atomic_dec(&data->count);
        while(!atomic_read(&data->gate))
@@ -230,7 +228,7 @@ static void set_mtrr(unsigned int reg, unsigned long base,
        /* Start the ball rolling on other CPUs */
        on_selected_cpus(&allbutself, ipi_handler, &data, 0);
 
-       local_irq_save(flags);
+       flags = local_irq_save();
 
        while (atomic_read(&data.count))
                cpu_relax();
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b4d5948..c73d640 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1866,7 +1866,7 @@ int __sync_local_execstate(void)
     unsigned long flags;
     int switch_required;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     switch_required = (this_cpu(curr_vcpu) != current);
 
diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c
index 4a07cfb..0128577 100644
--- a/xen/arch/x86/domain_page.c
+++ b/xen/arch/x86/domain_page.c
@@ -92,7 +92,7 @@ void *map_domain_page(mfn_t mfn)
 
     perfc_incr(map_domain_page_count);
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     hashent = &vcache->hash[MAPHASH_HASHFN(mfn_x(mfn))];
     if ( hashent->mfn == mfn_x(mfn) )
@@ -196,7 +196,7 @@ void unmap_domain_page(const void *ptr)
     mfn = l1e_get_pfn(MAPCACHE_L1ENT(idx));
     hashent = &v->arch.pv.mapcache.hash[MAPHASH_HASHFN(mfn)];
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     if ( hashent->idx == idx )
     {
diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index ed0504c..b71a0be 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -82,7 +82,7 @@ static void do_tlb_flush(void)
     u32 t;
 
     /* This non-reentrant function is sometimes called in interrupt context. */
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     t = pre_flush();
 
@@ -108,7 +108,7 @@ void switch_cr3_cr4(unsigned long cr3, unsigned long cr4)
     unsigned long old_pcid = cr3_pcid(read_cr3());
 
     /* This non-reentrant function is sometimes called in interrupt context. */
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     t = pre_flush();
 
diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 7e2e89d..83ff5d9 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -113,7 +113,7 @@ static void send_IPI_mask_x2apic_phys(const cpumask_t 
*cpumask, int vector)
      */
     smp_mb();
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     for_each_cpu ( cpu, cpumask )
     {
@@ -137,7 +137,7 @@ static void send_IPI_mask_x2apic_cluster(const cpumask_t 
*cpumask, int vector)
 
     smp_mb(); /* See above for an explanation. */
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     cpumask_andnot(ipimask, &cpu_online_map, cpumask_of(cpu));
 
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index 4b08488..06a62ff 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -97,9 +97,8 @@ static inline unsigned long ns2ticks(unsigned long nsec, int 
shift,
 static int hpet_next_event(unsigned long delta, int timer)
 {
     uint32_t cnt, cmp;
-    unsigned long flags;
+    unsigned long flags = local_irq_save();
 
-    local_irq_save(flags);
     cnt = hpet_read32(HPET_COUNTER);
     cmp = cnt + delta;
     hpet_write32(cmp, HPET_Tn_CMP(timer));
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index dec21d1..f13b1d9 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -549,9 +549,7 @@ static void vmx_clear_vmcs(struct vcpu *v)
 
 static void vmx_load_vmcs(struct vcpu *v)
 {
-    unsigned long flags;
-
-    local_irq_save(flags);
+    unsigned long flags = local_irq_save();
 
     if ( v->arch.hvm.vmx.active_cpu == -1 )
     {
@@ -713,7 +711,7 @@ void vmx_cpu_down(void)
     if ( !this_cpu(vmxon) )
         return;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     while ( !list_empty(active_vmcs_list) )
         __vmx_clear_vmcs(list_entry(active_vmcs_list->next,
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index aca4f63..47b1649 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1883,7 +1883,7 @@ static void __init check_timer(void)
     unsigned long flags;
     cpumask_t mask_all;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     /*
      * get/set the timer IRQ vector:
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index d7fce28..3e94311 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -560,7 +560,8 @@ void self_nmi(void)
 {
     unsigned long flags;
     u32 id = get_apic_id();
-    local_irq_save(flags);
+
+    flags = local_irq_save();
     apic_wait_icr_idle();
     apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, id);
     local_irq_restore(flags);
diff --git a/xen/arch/x86/platform_hypercall.c 
b/xen/arch/x86/platform_hypercall.c
index b19f6ec..949fc69 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -147,7 +147,7 @@ void resource_access(void *info)
                                 unlikely(entry[1].idx == MSR_IA32_TSC);
 
                 if ( unlikely(read_tsc) )
-                    local_irq_save(flags);
+                    flags = local_irq_save();
 
                 ret = rdmsr_safe(entry->idx, entry->val);
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index b15d4f0..e324882 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -134,7 +134,7 @@ void send_IPI_mask_flat(const cpumask_t *cpumask, int 
vector)
     if ( mask == 0 )
         return;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     /*
      * Wait for idle.
@@ -165,7 +165,7 @@ void send_IPI_mask_phys(const cpumask_t *mask, int vector)
     unsigned long cfg, flags;
     unsigned int query_cpu;
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     for_each_cpu ( query_cpu, mask )
     {
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 24d4c27..f78d0fb 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1585,9 +1585,8 @@ static struct cpu_time_stamp ap_bringup_ref;
 
 void time_latch_stamps(void)
 {
-    unsigned long flags;
+    unsigned long flags = local_irq_save();
 
-    local_irq_save(flags);
     ap_bringup_ref.master_stime = read_platform_stime(NULL);
     ap_bringup_ref.local_tsc = rdtsc_ordered();
     local_irq_restore(flags);
@@ -1655,7 +1654,7 @@ void init_percpu_time(void)
         }
     }
 
-    local_irq_save(flags);
+    flags = local_irq_save();
     now = read_platform_stime(NULL);
     tsc = rdtsc_ordered();
     local_irq_restore(flags);
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 9471d89..4a9ab51 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1315,7 +1315,7 @@ static enum pf_type spurious_page_fault(unsigned long 
addr,
      * Disabling interrupts prevents TLB flushing, and hence prevents
      * page tables from becoming invalid under our feet during the walk.
      */
-    local_irq_save(flags);
+    flags = local_irq_save();
     pf_type = __page_fault_type(addr, regs);
     local_irq_restore(flags);
 
diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index e89bb67..995934d 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -739,7 +739,7 @@ void dump_runq(unsigned char key)
     struct cpupool **c;
 
     spin_lock(&cpupool_lock);
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     printk("sched_smt_power_savings: %s\n",
             sched_smt_power_savings? "enabled":"disabled");
diff --git a/xen/common/gdbstub.c b/xen/common/gdbstub.c
index 07095e1..0d60f57 100644
--- a/xen/common/gdbstub.c
+++ b/xen/common/gdbstub.c
@@ -603,7 +603,7 @@ __trap_to_gdb(struct cpu_user_regs *regs, unsigned long 
cookie)
 
     gdb_smp_pause();
 
-    local_irq_save(flags);
+    flags = local_irq_save();
 
     watchdog_disable();
     console_start_sync();
@@ -661,9 +661,7 @@ presmp_initcall(initialise_gdb);
 
 static void gdb_pause_this_cpu(void *unused)
 {
-    unsigned long flags;
-
-    local_irq_save(flags);
+    unsigned long flags = local_irq_save();
 
     atomic_set(&gdb_cpu[smp_processor_id()].ack, 1);
     atomic_inc(&gdb_smp_paused_count);
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index d6eaae6..1ad83e0 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -1357,7 +1357,7 @@ void check_for_livepatch_work(void)
 
         if ( !livepatch_spin(&livepatch_work.semaphore, timeout, cpus, "IRQ") )
         {
-            local_irq_save(flags);
+            flags = local_irq_save();
             /* Do the patching. */
             livepatch_do_action();
             /* Serialize and flush out the CPU via CPUID instruction (on x86). 
*/
@@ -1384,7 +1384,7 @@ void check_for_livepatch_work(void)
             cpu_relax();
 
         /* Disable IRQs and signal. */
-        local_irq_save(flags);
+        flags = local_irq_save();
         /*
          * We re-use the sempahore, so MUST have it reset by master before
          * we exit the loop above.
diff --git a/xen/common/rcupdate.c b/xen/common/rcupdate.c
index 3517790..1f8fe46 100644
--- a/xen/common/rcupdate.c
+++ b/xen/common/rcupdate.c
@@ -224,7 +224,7 @@ void call_rcu(struct rcu_head *head,
 
     head->func = func;
     head->next = NULL;
-    local_irq_save(flags);
+    flags = local_irq_save();
     rdp = &__get_cpu_var(rcu_data);
     *rdp->nxttail = head;
     rdp->nxttail = &head->next;
diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 6bc52d7..d87cedb 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -169,9 +169,8 @@ void _spin_lock_irq(spinlock_t *lock)
 
 unsigned long _spin_lock_irqsave(spinlock_t *lock)
 {
-    unsigned long flags;
+    unsigned long flags = local_irq_save();
 
-    local_irq_save(flags);
     _spin_lock(lock);
     return flags;
 }
diff --git a/xen/common/timer.c b/xen/common/timer.c
index 376581b..fc1b2d6 100644
--- a/xen/common/timer.c
+++ b/xen/common/timer.c
@@ -256,7 +256,7 @@ static inline bool_t timer_lock(struct timer *timer)
 
 #define timer_lock_irqsave(t, flags) ({         \
     bool_t __x;                                 \
-    local_irq_save(flags);                      \
+    flags = local_irq_save();                   \
     if ( !(__x = timer_lock(t)) )               \
         local_irq_restore(flags);               \
     __x;                                        \
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 675193a..89c4bb6 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -817,7 +817,7 @@ static void vprintk_common(const char *prefix, const char 
*fmt, va_list args)
     unsigned long flags;
 
     /* console_lock can be acquired recursively from __printk_ratelimit(). */
-    local_irq_save(flags);
+    flags = local_irq_save();
     spin_lock_recursive(&console_lock);
     state = &this_cpu(state);
 
@@ -1050,9 +1050,8 @@ void console_end_log_everything(void)
 
 unsigned long console_lock_recursive_irqsave(void)
 {
-    unsigned long flags;
+    unsigned long flags = local_irq_save();
 
-    local_irq_save(flags);
     spin_lock_recursive(&console_lock);
 
     return flags;
diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
index 09a20ac..0795602 100644
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -71,9 +71,7 @@ void serial_rx_interrupt(struct serial_port *port, struct 
cpu_user_regs *regs)
 void serial_tx_interrupt(struct serial_port *port, struct cpu_user_regs *regs)
 {
     int i, n;
-    unsigned long flags;
-
-    local_irq_save(flags);
+    unsigned long flags = local_irq_save();
 
     /*
      * Avoid spinning for a long time: if there is a long-term lock holder
diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index a6eb8a4..a7c4167 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -67,7 +67,7 @@ static void raise_softirq_for(struct hvm_pirq_dpci *pirq_dpci)
 
     get_knownalive_domain(pirq_dpci->dom);
 
-    local_irq_save(flags);
+    flags = local_irq_save();
     list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
     local_irq_restore(flags);
 
@@ -1057,7 +1057,7 @@ static void dpci_softirq(void)
             unsigned long flags;
 
             /* Put back on the list and retry. */
-            local_irq_save(flags);
+            flags = local_irq_save();
             list_add_tail(&pirq_dpci->softirq_list, &this_cpu(dpci_list));
             local_irq_restore(flags);
 
diff --git a/xen/include/asm-arm/arm32/system.h 
b/xen/include/asm-arm/arm32/system.h
index cbfa91d..f7c8e53 100644
--- a/xen/include/asm-arm/arm32/system.h
+++ b/xen/include/asm-arm/arm32/system.h
@@ -17,11 +17,15 @@ static inline unsigned long local_save_flags(void)
     return flags;
 }
 
-#define local_irq_save(x)                                        \
-({                                                               \
-    x = local_save_flags();                                      \
-    local_irq_disable();                                         \
-})
+static inline unsigned long local_irq_save(void)
+{
+    unsigned long flags = local_save_flags();
+
+    local_irq_disable();
+
+    return flags;
+}
+
 #define local_irq_restore(x)                                     \
 ({                                                               \
     BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
diff --git a/xen/include/asm-arm/arm64/system.h 
b/xen/include/asm-arm/arm64/system.h
index 89c5b64..67e2ed4 100644
--- a/xen/include/asm-arm/arm64/system.h
+++ b/xen/include/asm-arm/arm64/system.h
@@ -29,11 +29,15 @@ static inline unsigned long local_save_flags(void)
     return flags;
 }
 
-#define local_irq_save(x)                                        \
-({                                                               \
-    x = local_save_flags();                                      \
-    local_irq_disable();                                         \
-})
+static inline unsigned long local_irq_save(void)
+{
+    unsigned long flags = local_save_flags();
+
+    local_irq_disable();
+
+    return flags;
+}
+
 #define local_irq_restore(x)                                     \
 ({                                                               \
     BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h
index faf2efe..756b21f 100644
--- a/xen/include/asm-x86/system.h
+++ b/xen/include/asm-x86/system.h
@@ -262,11 +262,15 @@ static inline unsigned long local_save_flags(void)
     return flags;
 }
 
-#define local_irq_save(x)                                        \
-({                                                               \
-    x = local_save_flags();                                      \
-    local_irq_disable();                                         \
-})
+static inline unsigned long local_irq_save(void)
+{
+    unsigned long flags = local_save_flags();
+
+    local_irq_disable();
+
+    return flags;
+}
+
 #define local_irq_restore(x)                                     \
 ({                                                               \
     BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h
index 35657c5..10d0f56 100644
--- a/xen/include/xen/rwlock.h
+++ b/xen/include/xen/rwlock.h
@@ -79,8 +79,8 @@ static inline void _read_lock_irq(rwlock_t *lock)
 
 static inline unsigned long _read_lock_irqsave(rwlock_t *lock)
 {
-    unsigned long flags;
-    local_irq_save(flags);
+    unsigned long flags = local_irq_save();
+
     _read_lock(lock);
     return flags;
 }
@@ -136,9 +136,8 @@ static inline void _write_lock_irq(rwlock_t *lock)
 
 static inline unsigned long _write_lock_irqsave(rwlock_t *lock)
 {
-    unsigned long flags;
+    unsigned long flags = local_irq_save();
 
-    local_irq_save(flags);
     _write_lock(lock);
     return flags;
 }
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index a811b73..3c44c99 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -187,7 +187,7 @@ void _spin_unlock_recursive(spinlock_t *lock);
 
 #define spin_trylock_irqsave(lock, flags)       \
 ({                                              \
-    local_irq_save(flags);                      \
+    flags = local_irq_save();                   \
     spin_trylock(lock) ?                        \
     1 : ({ local_irq_restore(flags); 0; });     \
 })
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.