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

[Xen-changelog] [xen staging] x86: replace remaining uses of __get_cpu_var()



commit 62b8949e9ddefa3191688ccc56e69aa6331b0da1
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jun 25 17:34:11 2019 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jun 25 17:34:11 2019 +0200

    x86: replace remaining uses of __get_cpu_var()
    
    this_cpu() is shorter, and when there are multiple uses in a function
    per_cpu() it's also more efficient.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/acpi/cpuidle_menu.c | 9 +++++----
 xen/arch/x86/irq.c               | 6 +++---
 xen/include/asm-x86/irq.h        | 4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/acpi/cpuidle_menu.c b/xen/arch/x86/acpi/cpuidle_menu.c
index bae16f81da..6ff5fb8ff2 100644
--- a/xen/arch/x86/acpi/cpuidle_menu.c
+++ b/xen/arch/x86/acpi/cpuidle_menu.c
@@ -146,7 +146,7 @@ static inline int which_bucket(unsigned int duration)
 
 static inline s_time_t avg_intr_interval_us(void)
 {
-    struct menu_device *data = &__get_cpu_var(menu_devices);
+    struct menu_device *data = &this_cpu(menu_devices);
     s_time_t    duration, now;
     s_time_t    avg_interval;
     unsigned int irq_sum;
@@ -187,7 +187,7 @@ static unsigned int get_sleep_length_us(void)
 
 static int menu_select(struct acpi_processor_power *power)
 {
-    struct menu_device *data = &__get_cpu_var(menu_devices);
+    struct menu_device *data = &this_cpu(menu_devices);
     int i;
     s_time_t    io_interval;
 
@@ -239,7 +239,7 @@ static int menu_select(struct acpi_processor_power *power)
 
 static void menu_reflect(struct acpi_processor_power *power)
 {
-    struct menu_device *data = &__get_cpu_var(menu_devices);
+    struct menu_device *data = &this_cpu(menu_devices);
     u64 new_factor;
 
     data->measured_us = power->last_residency;
@@ -294,7 +294,8 @@ static struct cpuidle_governor menu_governor =
 struct cpuidle_governor *cpuidle_current_governor = &menu_governor;
 void menu_get_trace_data(u32 *expected, u32 *pred)
 {
-    struct menu_device *data = &__get_cpu_var(menu_devices);
+    const struct menu_device *data = &this_cpu(menu_devices);
+
     *expected = data->expected_us;
     *pred = data->predicted_us;
 }
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index ccee68ff69..51322625c3 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -651,7 +651,7 @@ void irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
         unsigned int irq;
         unsigned int irr;
         struct irq_desc *desc;
-        irq = __get_cpu_var(vector_irq)[vector];
+        irq = per_cpu(vector_irq, me)[vector];
 
         if ((int)irq < 0)
             continue;
@@ -690,7 +690,7 @@ void irq_move_cleanup_interrupt(struct cpu_user_regs *regs)
         TRACE_3D(TRC_HW_IRQ_MOVE_CLEANUP,
                  irq, vector, smp_processor_id());
 
-        __get_cpu_var(vector_irq)[vector] = ~irq;
+        per_cpu(vector_irq, me)[vector] = ~irq;
         desc->arch.move_cleanup_count--;
 
         if ( desc->arch.move_cleanup_count == 0 )
@@ -822,7 +822,7 @@ void do_IRQ(struct cpu_user_regs *regs)
     uint32_t          tsc_in;
     struct irq_desc  *desc;
     unsigned int      vector = (u8)regs->entry_vector;
-    int irq = __get_cpu_var(vector_irq[vector]);
+    int               irq = this_cpu(vector_irq)[vector];
     struct cpu_user_regs *old_regs = set_irq_regs(regs);
     
     perfc_incr(irqs);
diff --git a/xen/include/asm-x86/irq.h b/xen/include/asm-x86/irq.h
index ee26e6d548..c0c6e7c799 100644
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
@@ -68,12 +68,12 @@ DECLARE_PER_CPU(struct cpu_user_regs *, __irq_regs);
 
 static inline struct cpu_user_regs *get_irq_regs(void)
 {
-       return __get_cpu_var(__irq_regs);
+       return this_cpu(__irq_regs);
 }
 
 static inline struct cpu_user_regs *set_irq_regs(struct cpu_user_regs 
*new_regs)
 {
-       struct cpu_user_regs *old_regs, **pp_regs = &__get_cpu_var(__irq_regs);
+       struct cpu_user_regs *old_regs, **pp_regs = &this_cpu(__irq_regs);
 
        old_regs = *pp_regs;
        *pp_regs = new_regs;
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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