Skip to contentSkip to conversation

x86: bool_t to bool cleanup

PATCH In review Wei Liu 3 participants 19 messages Jun 28, 2017 – Jun 29, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover x86: bool_t to bool cleanup

Did some cleanup while I'm looking for files to break apart under x86/.

Wei Liu (8):
x86/irq.c: use plain bool
x86/platform_hypercall.c: use plain bool
x86/domain.c: use plain bool
x86/dom0_build.c: use plain bool
x86/crash.c: use plain bool
x86/time.c: use plain bool
x86/nmi.c: use plain bool
x86/setup.c: use plain bool

 xen/arch/x86/crash.c              |  4 ++--
 xen/arch/x86/dom0_build.c         | 12 ++++++------
 xen/arch/x86/domain.c             | 16 ++++++++--------
 xen/arch/x86/irq.c                | 25 +++++++++++++------------
 xen/arch/x86/nmi.c                | 34 +++++++++++++++++-----------------
 xen/arch/x86/platform_hypercall.c | 10 +++++-----
 xen/arch/x86/setup.c              | 24 ++++++++++++------------
 xen/arch/x86/time.c               | 28 ++++++++++++++--------------
 xen/include/asm-x86/apic.h        |  4 ++--
 xen/include/asm-x86/domain.h      |  6 +++---
 10 files changed, 82 insertions(+), 81 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

PATCH 1/8 x86/irq.c: use plain bool

Replace bool_t with bool and adjust code accordingly.

---
 xen/arch/x86/irq.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
xen/arch/x86/irq.c +13 -12
index 113667cdea..32800ce165 100644
@@ -29,7 +29,7 @@
 static void parse_irq_vector_map_param(char *s);
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
-bool_t __read_mostly opt_noirqbalance = 0;
+bool __read_mostly opt_noirqbalance;
 boolean_param("noirqbalance", opt_noirqbalance);
 
 unsigned int __read_mostly nr_irqs_gsi = 16;
@@ -1070,7 +1070,7 @@ struct pending_eoi {
 static DEFINE_PER_CPU(struct pending_eoi, pending_eoi[NR_DYNAMIC_VECTORS]);
 #define pending_eoi_sp(p) ((p)[NR_DYNAMIC_VECTORS-1].vector)
 
-bool_t cpu_has_pending_apic_eoi(void)
+bool cpu_has_pending_apic_eoi(void)
 {
     return (pending_eoi_sp(this_cpu(pending_eoi)) != 0);
 }
@@ -1802,11 +1802,12 @@ void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
         cleanup_domain_irq_pirq(d, irq, pirq);
 }
 
-static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
+static bool pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
 {
     struct irq_desc *desc;
     irq_guest_action_t *action, *oldaction = NULL;
-    int i, bound = 0;
+    int i;
+    bool bound = false;
 
     WARN_ON(!spin_is_locked(&d->event_lock));
 
@@ -1830,7 +1831,7 @@ static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
     if ( i == action->nr_guests )
         goto out;
 
-    bound = 1;
+    bound = true;
     oldaction = __pirq_guest_unbind(d, pirq, desc);
 
  out:
@@ -1846,8 +1847,8 @@ static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
     return bound;
 }
 
-static inline bool_t is_free_pirq(const struct domain *d,
-                                  const struct pirq *pirq)
+static inline bool is_free_pirq(const struct domain *d,
+                                const struct pirq *pirq)
 {
     return !pirq || (!pirq->arch.irq && (!is_hvm_domain(d) ||
         pirq->arch.hvm.emuirq == IRQ_UNBOUND));
@@ -2098,7 +2099,7 @@ int unmap_domain_pirq(struct domain *d, int pirq)
     struct irq_desc *desc;
     int irq, ret = 0, rc;
     unsigned int i, nr = 1;
-    bool_t forced_unbind;
+    bool forced_unbind;
     struct pirq *info;
     struct msi_desc *msi_desc = NULL;
 
@@ -2327,7 +2328,7 @@ static int __init setup_dump_irqs(void)
 __initcall(setup_dump_irqs);
 
 /* Reset irq affinities to match the given CPU mask. */
-void fixup_irqs(const cpumask_t *mask, bool_t verbose)
+void fixup_irqs(const cpumask_t *mask, bool verbose)
 {
     unsigned int irq;
     static int warned;
@@ -2335,7 +2336,7 @@ void fixup_irqs(const cpumask_t *mask, bool_t verbose)
 
     for ( irq = 0; irq < nr_irqs; irq++ )
     {
-        bool_t break_affinity = 0, set_affinity = 1;
+        bool break_affinity = false, set_affinity = true;
         unsigned int vector;
         cpumask_t affinity;
 
@@ -2363,7 +2364,7 @@ void fixup_irqs(const cpumask_t *mask, bool_t verbose)
         cpumask_and(&affinity, &affinity, mask);
         if ( cpumask_empty(&affinity) )
         {
-            break_affinity = 1;
+            break_affinity = true;
             cpumask_copy(&affinity, mask);
         }
 
@@ -2373,7 +2374,7 @@ void fixup_irqs(const cpumask_t *mask, bool_t verbose)
         if ( desc->handler->set_affinity )
             desc->handler->set_affinity(desc, &affinity);
         else if ( !(warned++) )
-            set_affinity = 0;
+            set_affinity = false;
 
         if ( desc->handler->enable )
             desc->handler->enable(desc);
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Re: [PATCH 1/8] x86/irq.c: use plain bool

Quoted 21 lines · Wei Liu

Replace bool_t with bool and adjust code accordingly.

---
 xen/arch/x86/irq.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
xen/arch/x86/irq.c +1 -1
index 113667cdea..32800ce165 100644
@@ -29,7 +29,7 @@
 static void parse_irq_vector_map_param(char *s);
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
-bool_t __read_mostly opt_noirqbalance = 0;
+bool __read_mostly opt_noirqbalance;
 boolean_param("noirqbalance", opt_noirqbalance);
 
 unsigned int __read_mostly nr_irqs_gsi = 16;

xen/arch/x86/irq.c struct pending_eoi { · line 1076

Quoted 8 lines
xen/arch/x86/irq.c +1 -1
@@ -1070,7 +1070,7 @@ struct pending_eoi {
 static DEFINE_PER_CPU(struct pending_eoi, pending_eoi[NR_DYNAMIC_VECTORS]);
 #define pending_eoi_sp(p) ((p)[NR_DYNAMIC_VECTORS-1].vector)
 
-bool_t cpu_has_pending_apic_eoi(void)
+bool cpu_has_pending_apic_eoi(void)
 {
     return (pending_eoi_sp(this_cpu(pending_eoi)) != 0);
 }

This function has a prototype which needs changing. On the style side, you can drop the brackets here as well.

Quoted 45 lines
xen/arch/x86/irq.c +7 -6
@@ -1802,11 +1802,12 @@ void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
         cleanup_domain_irq_pirq(d, irq, pirq);
 }
 
-static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
+static bool pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
 {
     struct irq_desc *desc;
     irq_guest_action_t *action, *oldaction = NULL;
-    int i, bound = 0;
+    int i;
+    bool bound = false;
 
     WARN_ON(!spin_is_locked(&d->event_lock));
 
@@ -1830,7 +1831,7 @@ static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
     if ( i == action->nr_guests )
         goto out;
 
-    bound = 1;
+    bound = true;
     oldaction = __pirq_guest_unbind(d, pirq, desc);
 
  out:
@@ -1846,8 +1847,8 @@ static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
     return bound;
 }
 
-static inline bool_t is_free_pirq(const struct domain *d,
-                                  const struct pirq *pirq)
+static inline bool is_free_pirq(const struct domain *d,
+                                const struct pirq *pirq)
 {
     return !pirq || (!pirq->arch.irq && (!is_hvm_domain(d) ||
         pirq->arch.hvm.emuirq == IRQ_UNBOUND));
@@ -2098,7 +2099,7 @@ int unmap_domain_pirq(struct domain *d, int pirq)
     struct irq_desc *desc;
     int irq, ret = 0, rc;
     unsigned int i, nr = 1;
-    bool_t forced_unbind;
+    bool forced_unbind;
     struct pirq *info;
     struct msi_desc *msi_desc = NULL;
 

xen/arch/x86/irq.c static int __init setup_dump_irqs(void) · line 2331

Quoted 5 lines
xen/arch/x86/irq.c +1 -1
@@ -2327,7 +2328,7 @@ static int __init setup_dump_irqs(void)
 __initcall(setup_dump_irqs);
 
 /* Reset irq affinities to match the given CPU mask. */
-void fixup_irqs(const cpumask_t *mask, bool_t verbose)
+void fixup_irqs(const cpumask_t *mask, bool verbose)

Same with the prototype here.

Otherwise, Reviewed-by: Andrew Cooper <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Re: [PATCH 1/8] x86/irq.c: use plain bool

Quoted 17 lines
Quoted 1 line
Quoted 1 line

Andrew Cooper <[email protected]> 06/28/17 4:30 PM >>>

Quoted 15 lines · Wei Liu
xen/arch/x86/irq.c +1 -1
@@ -29,7 +29,7 @@
 static void parse_irq_vector_map_param(char *s);
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
-bool_t __read_mostly opt_noirqbalance = 0;
+bool __read_mostly opt_noirqbalance;
 boolean_param("noirqbalance", opt_noirqbalance);
 
 unsigned int __read_mostly nr_irqs_gsi = 16;
@@ -1070,7 +1070,7 @@ struct pending_eoi {
 static DEFINE_PER_CPU(struct pending_eoi, pending_eoi[NR_DYNAMIC_VECTORS]);
 #define pending_eoi_sp(p) ((p)[NR_DYNAMIC_VECTORS-1].vector)
 
Quoted 8 lines

xen/arch/x86/irq.c struct pending_eoi { · line 1076

Quoted 5 lines
xen/arch/x86/irq.c +1 -1
-bool_t cpu_has_pending_apic_eoi(void)
+bool cpu_has_pending_apic_eoi(void)
 {
     return (pending_eoi_sp(this_cpu(pending_eoi)) != 0);
 }

This function has a prototype which needs changing. On the style side, you can drop the brackets here as well.

Same for the declaration of opt_noirqbalance.

Quoted 4 lines
Quoted 4 lines
xen/arch/x86/irq.c +0 -0
@@ -1802,11 +1802,12 @@ void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
         cleanup_domain_irq_pirq(d, irq, pirq);
 }
 
Quoted 8 lines

xen/arch/x86/irq.c void pirq_guest_unbind(struct domain *d, struct pirq *pirq) · line 1810

Quoted 8 lines
xen/arch/x86/irq.c +3 -2
-static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
+static bool pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
 {
     struct irq_desc *desc;
     irq_guest_action_t *action, *oldaction = NULL;
-    int i, bound = 0;
+    int i;
+    bool bound = false;

I have to admit that I find it a little odd that i isn't being converted to unsigned int at the same time, but I won't insist on this being done.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw

Re: [PATCH 1/8] x86/irq.c: use plain bool

Quoted 26 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line

Andrew Cooper <[email protected]> 06/28/17 4:30 PM >>>

Quoted 15 lines · Wei Liu
xen/arch/x86/irq.c +1 -1
@@ -29,7 +29,7 @@
 static void parse_irq_vector_map_param(char *s);
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
-bool_t __read_mostly opt_noirqbalance = 0;
+bool __read_mostly opt_noirqbalance;
 boolean_param("noirqbalance", opt_noirqbalance);
 
 unsigned int __read_mostly nr_irqs_gsi = 16;
@@ -1070,7 +1070,7 @@ struct pending_eoi {
 static DEFINE_PER_CPU(struct pending_eoi, pending_eoi[NR_DYNAMIC_VECTORS]);
 #define pending_eoi_sp(p) ((p)[NR_DYNAMIC_VECTORS-1].vector)
 
Quoted 8 lines

xen/arch/x86/irq.c struct pending_eoi { · line 1076

Quoted 5 lines
xen/arch/x86/irq.c +1 -1
-bool_t cpu_has_pending_apic_eoi(void)
+bool cpu_has_pending_apic_eoi(void)
 {
     return (pending_eoi_sp(this_cpu(pending_eoi)) != 0);
 }

This function has a prototype which needs changing. On the style side, you can drop the brackets here as well.

Quoted 1 line

Same for the declaration of opt_noirqbalance.

Already done.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
xen/arch/x86/irq.c +0 -0
@@ -1802,11 +1802,12 @@ void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
         cleanup_domain_irq_pirq(d, irq, pirq);
 }
 
Quoted 12 lines
Quoted 8 lines

xen/arch/x86/irq.c void pirq_guest_unbind(struct domain *d, struct pirq *pirq) · line 1810

Quoted 8 lines
xen/arch/x86/irq.c +3 -2
-static int pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
+static bool pirq_guest_force_unbind(struct domain *d, struct pirq *pirq)
 {
     struct irq_desc *desc;
     irq_guest_action_t *action, *oldaction = NULL;
-    int i, bound = 0;
+    int i;
+    bool bound = false;

I have to admit that I find it a little odd that i isn't being converted to unsigned int at the same time, but I won't insist on this being done.

Done as well.

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#5 lore raw

PATCH 2/8 x86/platform_hypercall.c: use plain bool

In reply to Wei Liu
---
 xen/arch/x86/platform_hypercall.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
xen/arch/x86/platform_hypercall.c +5 -5
index 10e7bcc161..ebc2f394ee 100644
@@ -62,7 +62,7 @@ long cpu_frequency_change_helper(void *data)
     return cpu_frequency_change((uint64_t)data);
 }
 
-static bool_t allow_access_msr(unsigned int msr)
+static bool allow_access_msr(unsigned int msr)
 {
     switch ( msr )
     {
@@ -70,10 +70,10 @@ static bool_t allow_access_msr(unsigned int msr)
     case MSR_IA32_CMT_EVTSEL:
     case MSR_IA32_CMT_CTR:
     case MSR_IA32_TSC:
-        return 1;
+        return true;
     }
 
-    return 0;
+    return false;
 }
 
 void check_resource_access(struct resource_access *ra)
@@ -143,8 +143,8 @@ void resource_access(void *info)
                  * If next entry is MSR_IA32_TSC read, then the actual rdtsc
                  * is performed together with current entry, with IRQ disabled.
                  */
-                bool_t read_tsc = (i < ra->nr_done - 1 &&
-                                   unlikely(entry[1].idx == MSR_IA32_TSC));
+                bool read_tsc = i < ra->nr_done - 1 &&
+                                unlikely(entry[1].idx == MSR_IA32_TSC);
 
                 if ( unlikely(read_tsc) )
                     local_irq_save(flags);
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#7 lore raw

PATCH 3/8 x86/domain.c: use plain bool

In reply to Wei Liu
---
 xen/arch/x86/domain.c        | 16 ++++++++--------
 xen/include/asm-x86/domain.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
xen/arch/x86/domain.c +8 -8
index f7873da323..4e176e4d56 100644
@@ -872,7 +872,7 @@ int arch_set_info_guest(
     else
     {
         unsigned long pfn = pagetable_get_pfn(v->arch.guest_table);
-        bool_t fail;
+        bool fail;
 
         if ( !compat )
         {
@@ -950,7 +950,7 @@ int arch_set_info_guest(
              test_bit(VMASST_TYPE_m2p_strict, &c.nat->vm_assist) &&
              atomic_read(&d->arch.pv_domain.nr_l4_pages) )
         {
-            bool_t done = 0;
+            bool done = false;
 
             spin_lock_recursive(&d->page_alloc_lock);
 
@@ -1472,15 +1472,15 @@ void paravirt_ctxt_switch_to(struct vcpu *v)
 }
 
 /* Update per-VCPU guest runstate shared memory area (if registered). */
-bool_t update_runstate_area(struct vcpu *v)
+bool update_runstate_area(struct vcpu *v)
 {
-    bool_t rc;
+    bool rc;
     struct guest_memory_policy policy =
         { .smap_policy = SMAP_CHECK_ENABLED, .nested_guest_mode = false };
     void __user *guest_handle = NULL;
 
     if ( guest_handle_is_null(runstate_guest(v)) )
-        return 1;
+        return true;
 
     update_guest_memory_policy(v, &policy);
 
@@ -1502,7 +1502,7 @@ bool_t update_runstate_area(struct vcpu *v)
 
         XLAT_vcpu_runstate_info(&info, &v->runstate);
         __copy_to_guest(v->runstate_guest.compat, &info, 1);
-        rc = 1;
+        rc = true;
     }
     else
         rc = __copy_to_guest(runstate_guest(v), &v->runstate, 1) !=
@@ -1528,7 +1528,7 @@ static void _update_runstate_area(struct vcpu *v)
         v->arch.pv_vcpu.need_update_runstate_area = 1;
 }
 
-static inline bool_t need_full_gdt(const struct domain *d)
+static inline bool need_full_gdt(const struct domain *d)
 {
     return is_pv_domain(d) && !is_idle_domain(d);
 }
@@ -1993,7 +1993,7 @@ void vcpu_kick(struct vcpu *v)
      * NB2. We save the running flag across the unblock to avoid a needless
      * IPI for domains that we IPI'd to unblock.
      */
-    bool_t running = v->is_running;
+    bool running = v->is_running;
     vcpu_unblock(v);
     if ( running && (in_irq() || (v != current)) )
         cpu_raise_softirq(v->processor, VCPU_KICK_SOFTIRQ);
xen/include/asm-x86/domain.h +1 -1
index 27d80eeff4..398193eefb 100644
@@ -592,7 +592,7 @@ void update_guest_memory_policy(struct vcpu *v,
 #define hvm_vmx         hvm_vcpu.u.vmx
 #define hvm_svm         hvm_vcpu.u.svm
 
-bool_t update_runstate_area(struct vcpu *);
+bool update_runstate_area(struct vcpu *);
 bool_t update_secondary_system_time(struct vcpu *,
                                     struct vcpu_time_info *);
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#9 lore raw

Re: [PATCH 3/8] x86/domain.c: use plain bool

In reply to Wei Liu

Review void vcpu_kick(struct vcpu *v)

Quoted 2 lines
Quoted 1 line
Quoted 1 line

Wei Liu <[email protected]> 06/28/17 4:18 PM >>>

(quoted diff) +0 -0
@@ -1993,7 +1993,7 @@ void vcpu_kick(struct vcpu *v)

>* NB2. We save the running flag across the unblock to avoid a needless >* IPI for domains that we IPI'd to unblock.
>*/

xen/arch/x86/domain.c void vcpu_kick(struct vcpu *v) · line 1996

Quoted 2 lines
xen/arch/x86/domain.c +1 -1
-    bool_t running = v->is_running;
+    bool running = v->is_running;
     >vcpu_unblock(v);

Please take the opportunity and also add the missing blank line here.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#10 lore raw

PATCH 4/8 x86/dom0_build.c: use plain bool

In reply to Wei Liu
---
 xen/arch/x86/dom0_build.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
xen/arch/x86/dom0_build.c +6 -6
index cc8acad688..0c125e61eb 100644
@@ -83,7 +83,7 @@ custom_param("dom0_max_vcpus", parse_dom0_max_vcpus);
 static __initdata unsigned int dom0_nr_pxms;
 static __initdata unsigned int dom0_pxms[MAX_NUMNODES] =
     { [0 ... MAX_NUMNODES - 1] = ~0 };
-static __initdata bool_t dom0_affinity_relaxed;
+static __initdata bool dom0_affinity_relaxed;
 
 static void __init parse_dom0_nodes(const char *s)
 {
@@ -92,12 +92,12 @@ static void __init parse_dom0_nodes(const char *s)
             dom0_pxms[dom0_nr_pxms] = simple_strtoul(s, &s, 0);
         else if ( !strncmp(s, "relaxed", 7) && (!s[7] || s[7] == ',') )
         {
-            dom0_affinity_relaxed = 1;
+            dom0_affinity_relaxed = true;
             s += 7;
         }
         else if ( !strncmp(s, "strict", 6) && (!s[6] || s[6] == ',') )
         {
-            dom0_affinity_relaxed = 0;
+            dom0_affinity_relaxed = false;
             s += 6;
         }
         else
@@ -208,7 +208,7 @@ custom_param("dom0", parse_dom0_param);
 static char __initdata opt_dom0_ioports_disable[200] = "";
 string_param("dom0_ioports_disable", opt_dom0_ioports_disable);
 
-static bool_t __initdata ro_hpet = 1;
+static bool __initdata ro_hpet = true;
 boolean_param("ro-hpet", ro_hpet);
 
 unsigned int __initdata dom0_memflags = MEMF_no_dma|MEMF_exact_node;
@@ -229,7 +229,7 @@ unsigned long __init dom0_compute_nr_pages(
 {
     nodeid_t node;
     unsigned long avail = 0, nr_pages, min_pages, max_pages;
-    bool_t need_paging;
+    bool need_paging;
 
     for_each_node_mask ( node, dom0_nodes )
         avail += avail_domheap_pages_region(node, 0, 0) +
@@ -253,7 +253,7 @@ unsigned long __init dom0_compute_nr_pages(
 
     need_paging = is_hvm_domain(d) &&
         (!iommu_hap_pt_share || !paging_mode_hap(d));
-    for ( ; ; need_paging = 0 )
+    for ( ; ; need_paging = false )
     {
         nr_pages = dom0_nrpages;
         min_pages = dom0_min_nrpages;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#11 lore raw

PATCH 5/8 x86/crash.c: use plain bool

In reply to Wei Liu
---
 xen/arch/x86/crash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/crash.c +2 -2
index f28f527912..82535c4df0 100644
@@ -33,7 +33,7 @@
 
 static cpumask_t waiting_to_crash;
 static unsigned int crashing_cpu;
-static DEFINE_PER_CPU_READ_MOSTLY(bool_t, crash_save_done);
+static DEFINE_PER_CPU_READ_MOSTLY(bool, crash_save_done);
 
 /* This becomes the NMI handler for non-crashing CPUs, when Xen is crashing. */
 static void noreturn do_nmi_crash(const struct cpu_user_regs *regs)
@@ -67,7 +67,7 @@ static void noreturn do_nmi_crash(const struct cpu_user_regs *regs)
         kexec_crash_save_cpu();
         __stop_this_cpu();
 
-        this_cpu(crash_save_done) = 1;
+        this_cpu(crash_save_done) = true;
         cpumask_clear_cpu(cpu, &waiting_to_crash);
     }
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#12 lore raw

PATCH 6/8 x86/time.c: use plain bool

In reply to Wei Liu
---
 xen/arch/x86/time.c          | 28 ++++++++++++++--------------
 xen/include/asm-x86/domain.h |  4 ++--
 2 files changed, 16 insertions(+), 16 deletions(-)
xen/arch/x86/time.c +14 -14
index 655af33cb3..75ea695ac5 100644
@@ -82,7 +82,7 @@ static struct timer calibration_timer;
 static DEFINE_SPINLOCK(pit_lock);
 static u16 pit_stamp16;
 static u32 pit_stamp32;
-static bool_t __read_mostly using_pit;
+static bool __read_mostly using_pit;
 
 /* Boot timestamp, filled in head.S */
 u64 __initdata boot_tsc_stamp;
@@ -304,7 +304,7 @@ static s64 __init init_pit(struct platform_timesource *pts)
     u64 start, end;
     unsigned long count;
 
-    using_pit = 1;
+    using_pit = true;
 
     /* Set the Gate high, disable speaker. */
     outb((portb & ~0x02) | 0x01, 0x61);
@@ -577,7 +577,7 @@ static void plt_overflow(void *unused)
     }
     if ( i != 0 )
     {
-        static bool_t warned_once;
+        static bool warned_once;
         if ( !test_and_set_bool(warned_once) )
             printk("Platform timer appears to have unexpectedly wrapped "
                    "%u%s times.\n", i, (i == 10) ? " or more" : "");
@@ -809,7 +809,7 @@ static unsigned long get_cmos_time(void)
     unsigned long res, flags;
     struct rtc_time rtc;
     unsigned int seconds = 60;
-    static bool_t __read_mostly cmos_rtc_probe;
+    static bool __read_mostly cmos_rtc_probe;
     boolean_param("cmos-rtc-probe", cmos_rtc_probe);
 
     if ( efi_enabled(EFI_RS) )
@@ -820,7 +820,7 @@ static unsigned long get_cmos_time(void)
     }
 
     if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) )
-        cmos_rtc_probe = 0;
+        cmos_rtc_probe = false;
     else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe )
         panic("System with no CMOS RTC advertised must be booted from EFI"
               " (or with command line option \"cmos-rtc-probe\")");
@@ -858,7 +858,7 @@ static unsigned long get_cmos_time(void)
         if ( seconds < 60 )
         {
             if ( rtc.sec != seconds )
-                cmos_rtc_probe = 0;
+                cmos_rtc_probe = false;
             break;
         }
 
@@ -987,15 +987,15 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
         v->arch.pv_vcpu.pending_system_time = _u;
 }
 
-bool_t update_secondary_system_time(struct vcpu *v,
-                                    struct vcpu_time_info *u)
+bool update_secondary_system_time(struct vcpu *v,
+                                  struct vcpu_time_info *u)
 {
     XEN_GUEST_HANDLE(vcpu_time_info_t) user_u = v->arch.time_info_guest;
     struct guest_memory_policy policy =
         { .smap_policy = SMAP_CHECK_ENABLED, .nested_guest_mode = false };
 
     if ( guest_handle_is_null(user_u) )
-        return 1;
+        return true;
 
     update_guest_memory_policy(v, &policy);
 
@@ -1003,7 +1003,7 @@ bool_t update_secondary_system_time(struct vcpu *v,
     if ( __copy_field_to_guest(user_u, u, version) == sizeof(u->version) )
     {
         update_guest_memory_policy(v, &policy);
-        return 0;
+        return false;
     }
     wmb();
     /* 2. Update all other userspace fields. */
@@ -1015,7 +1015,7 @@ bool_t update_secondary_system_time(struct vcpu *v,
 
     update_guest_memory_policy(v, &policy);
 
-    return 1;
+    return true;
 }
 
 void update_vcpu_system_time(struct vcpu *v)
@@ -1951,8 +1951,8 @@ void tsc_get_info(struct domain *d, uint32_t *tsc_mode,
                   uint64_t *elapsed_nsec, uint32_t *gtsc_khz,
                   uint32_t *incarnation)
 {
-    bool_t enable_tsc_scaling = is_hvm_domain(d) &&
-                                hvm_tsc_scaling_supported && !d->arch.vtsc;
+    bool enable_tsc_scaling = is_hvm_domain(d) &&
+                              hvm_tsc_scaling_supported && !d->arch.vtsc;
 
     *incarnation = d->arch.incarnation;
     *tsc_mode = d->arch.tsc_mode;
@@ -2017,7 +2017,7 @@ void tsc_set_info(struct domain *d,
 
     switch ( d->arch.tsc_mode = tsc_mode )
     {
-        bool_t enable_tsc_scaling;
+        bool enable_tsc_scaling;
 
     case TSC_MODE_DEFAULT:
     case TSC_MODE_ALWAYS_EMULATE:
xen/include/asm-x86/domain.h +2 -2
index 398193eefb..c10522b7f5 100644
@@ -593,8 +593,8 @@ void update_guest_memory_policy(struct vcpu *v,
 #define hvm_svm         hvm_vcpu.u.svm
 
 bool update_runstate_area(struct vcpu *);
-bool_t update_secondary_system_time(struct vcpu *,
-                                    struct vcpu_time_info *);
+bool update_secondary_system_time(struct vcpu *,
+                                  struct vcpu_time_info *);
 
 void vcpu_show_execution_state(struct vcpu *);
 void vcpu_show_registers(const struct vcpu *);
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#13 lore raw

Re: [PATCH 6/8] x86/time.c: use plain bool

Review static void plt_overflow(void *unused)

Quoted 2 lines
Quoted 1 line
Quoted 1 line

Wei Liu <[email protected]> 06/28/17 4:18 PM >>>

(quoted diff) +0 -0
@@ -577,7 +577,7 @@ static void plt_overflow(void *unused)
     >}
     >if ( i != 0 )
     >{

xen/arch/x86/time.c static void plt_overflow(void *unused) · line 580

Quoted 2 lines
xen/arch/x86/time.c +1 -1
-        static bool_t warned_once;
+        static bool warned_once;
         >if ( !test_and_set_bool(warned_once) )

Again, please also add the missing newline here.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#14 lore raw

PATCH 7/8 x86/nmi.c: use plain bool

In reply to Wei Liu

While at it, change check_nmi_watchdog to return void because its return value is not used anyway.

---
 xen/arch/x86/nmi.c         | 34 +++++++++++++++++-----------------
 xen/include/asm-x86/apic.h |  4 ++--
 2 files changed, 19 insertions(+), 19 deletions(-)
xen/arch/x86/nmi.c +17 -17
index ced61fd17e..8914581f66 100644
@@ -41,31 +41,31 @@ static DEFINE_PER_CPU(struct timer, nmi_timer);
 static DEFINE_PER_CPU(unsigned int, nmi_timer_ticks);
 
 /* opt_watchdog: If true, run a watchdog NMI on each processor. */
-bool_t __initdata opt_watchdog = 0;
+bool __initdata opt_watchdog;
 
 /* watchdog_force: If true, process unknown NMIs when running the watchdog. */
-bool_t watchdog_force = 0;
+bool watchdog_force;
 
 static void __init parse_watchdog(char *s)
 {
     if ( !*s )
     {
-        opt_watchdog = 1;
+        opt_watchdog = true;
         return;
     }
 
     switch ( parse_bool(s) )
     {
     case 0:
-        opt_watchdog = 0;
+        opt_watchdog = false;
         return;
     case 1:
-        opt_watchdog = 1;
+        opt_watchdog = true;
         return;
     }
 
     if ( !strcmp(s, "force") )
-        watchdog_force = opt_watchdog = 1;
+        watchdog_force = opt_watchdog = true;
 }
 custom_param("watchdog", parse_watchdog);
 
@@ -152,14 +152,14 @@ static void __init wait_for_nmis(void *p)
     } while( e - s < ticks );
 }
 
-int __init check_nmi_watchdog (void)
+void __init check_nmi_watchdog(void)
 {
     static unsigned int __initdata prev_nmi_count[NR_CPUS];
     int cpu;
-    bool_t ok = 1;
+    bool ok = true;
 
     if ( nmi_watchdog == NMI_NONE )
-        return 0;
+        return;
 
     printk("Testing NMI watchdog on all CPUs:");
 
@@ -178,7 +178,7 @@ int __init check_nmi_watchdog (void)
         if ( nmi_count(cpu) - prev_nmi_count[cpu] < 2 )
         {
             printk(" %d", cpu);
-            ok = 0;
+            ok = false;
         }
     }
 
@@ -196,7 +196,7 @@ int __init check_nmi_watchdog (void)
     if ( nmi_watchdog == NMI_LOCAL_APIC )
         nmi_hz = max(1ul, cpu_khz >> 20);
 
-    return 0;
+    return;
 }
 
 static void nmi_timer_fn(void *unused)
@@ -448,7 +448,7 @@ void watchdog_enable(void)
     atomic_dec(&watchdog_disable_count);
 }
 
-bool_t watchdog_enabled(void)
+bool watchdog_enabled(void)
 {
     return !atomic_read(&watchdog_disable_count);
 }
@@ -470,9 +470,9 @@ int __init watchdog_setup(void)
 }
 
 /* Returns false if this was not a watchdog NMI, true otherwise */
-bool_t nmi_watchdog_tick(const struct cpu_user_regs *regs)
+bool nmi_watchdog_tick(const struct cpu_user_regs *regs)
 {
-    bool_t watchdog_tick = 1;
+    bool watchdog_tick = true;
     unsigned int sum = this_cpu(nmi_timer_ticks);
 
     if ( (this_cpu(last_irq_sums) == sum) && watchdog_enabled() )
@@ -505,7 +505,7 @@ bool_t nmi_watchdog_tick(const struct cpu_user_regs *regs)
         {
             rdmsrl(MSR_P4_IQ_CCCR0, msr_content);
             if ( !(msr_content & P4_CCCR_OVF) )
-                watchdog_tick = 0;
+                watchdog_tick = false;
 
             /*
              * P4 quirks:
@@ -521,7 +521,7 @@ bool_t nmi_watchdog_tick(const struct cpu_user_regs *regs)
         {
             rdmsrl(MSR_P6_PERFCTR(0), msr_content);
             if ( msr_content & (1ULL << P6_EVENT_WIDTH) )
-                watchdog_tick = 0;
+                watchdog_tick = false;
 
             /*
              * Only P6 based Pentium M need to re-unmask the apic vector but
@@ -533,7 +533,7 @@ bool_t nmi_watchdog_tick(const struct cpu_user_regs *regs)
         {
             rdmsrl(MSR_K7_PERFCTR0, msr_content);
             if ( msr_content & (1ULL << K7_EVENT_WIDTH) )
-                watchdog_tick = 0;
+                watchdog_tick = false;
         }
         write_watchdog_counter(NULL);
     }
xen/include/asm-x86/apic.h +2 -2
index 342db73a9d..ea675b7f0a 100644
@@ -186,7 +186,7 @@ extern void release_lapic_nmi(void);
 extern void self_nmi(void);
 extern void disable_timer_nmi_watchdog(void);
 extern void enable_timer_nmi_watchdog(void);
-extern bool_t nmi_watchdog_tick (const struct cpu_user_regs *regs);
+extern bool nmi_watchdog_tick(const struct cpu_user_regs *regs);
 extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
@@ -196,7 +196,7 @@ extern void record_boot_APIC_mode(void);
 extern enum apic_mode current_local_apic_mode(void);
 extern void check_for_unexpected_msi(unsigned int vector);
 
-extern int check_nmi_watchdog (void);
+extern void check_nmi_watchdog(void);
 
 extern unsigned int nmi_watchdog;
 #define NMI_NONE	0
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#15 lore raw

PATCH 8/8 x86/setup.c: use plain bool

In reply to Wei Liu
---
 xen/arch/x86/setup.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
xen/arch/x86/setup.c +12 -12
index f7b927858c..db5df6956d 100644
@@ -53,7 +53,7 @@
 #include <asm/cpuid.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static bool_t __initdata opt_nosmp;
+static bool __initdata opt_nosmp;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */
@@ -151,8 +151,8 @@ static void __init parse_smap_param(char *s)
 }
 custom_param("smap", parse_smap_param);
 
-bool_t __read_mostly acpi_disabled;
-bool_t __initdata acpi_force;
+bool __read_mostly acpi_disabled;
+bool __initdata acpi_force;
 static char __initdata acpi_param[10] = "";
 static void __init parse_acpi_param(char *s)
 {
@@ -166,9 +166,9 @@ static void __init parse_acpi_param(char *s)
     }
     else if ( !strcmp(s, "force") )
     {
-        acpi_force = 1;
+        acpi_force = true;
         acpi_ht = 1;
-        acpi_disabled = 0;
+        acpi_disabled = false;
     }
     else if ( !strcmp(s, "ht") )
     {
@@ -338,7 +338,7 @@ static void *__init bootstrap_map(const module_t *mod)
 }
 
 static void *__init move_memory(
-    uint64_t dst, uint64_t src, unsigned int size, bool_t keep)
+    uint64_t dst, uint64_t src, unsigned int size, bool keep)
 {
     unsigned int blksz = BOOTSTRAP_MAP_LIMIT - BOOTSTRAP_MAP_BASE;
     unsigned int mask = (1L << L2_PAGETABLE_SHIFT) - 1;
@@ -515,14 +515,14 @@ static void __init kexec_reserve_area(struct e820map *e820)
 #ifdef CONFIG_KEXEC
     unsigned long kdump_start = kexec_crash_area.start;
     unsigned long kdump_size  = kexec_crash_area.size;
-    static bool_t __initdata is_reserved = 0;
+    static bool __initdata is_reserved = false;
 
     kdump_size = (kdump_size + PAGE_SIZE - 1) & PAGE_MASK;
 
     if ( (kdump_start == 0) || (kdump_size == 0) || is_reserved )
         return;
 
-    is_reserved = 1;
+    is_reserved = true;
 
     if ( !reserve_e820_ram(e820, kdump_start, kdump_start + kdump_size) )
     {
@@ -538,7 +538,7 @@ static void __init kexec_reserve_area(struct e820map *e820)
 #endif
 }
 
-static inline bool_t using_2M_mapping(void)
+static inline bool using_2M_mapping(void)
 {
     return !l1_table_offset((unsigned long)__2M_text_end) &&
            !l1_table_offset((unsigned long)__2M_rodata_start) &&
@@ -601,7 +601,7 @@ static void __init noreturn reinit_bsp_stack(void)
     reset_stack_and_jump(init_done);
 }
 
-static bool_t __init loader_is_grub2(const char *loader_name)
+static bool __init loader_is_grub2(const char *loader_name)
 {
     /* GRUB1="GNU GRUB 0.xx"; GRUB2="GRUB 1.xx" */
     const char *p = strstr(loader_name, "GRUB ");
@@ -638,7 +638,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     module_t *mod = (module_t *)__va(mbi->mods_addr);
     unsigned long nr_pages, raw_max_page, modules_headroom, *module_map;
     int i, j, e820_warn = 0, bytes = 0;
-    bool_t acpi_boot_table_init_done = 0;
+    bool acpi_boot_table_init_done = false;
     struct domain *dom0;
     struct ns16550_defaults ns16550 = {
         .data_bits = 8,
@@ -1166,7 +1166,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
              s >= (1ULL << 32) &&
              !acpi_boot_table_init() )
         {
-            acpi_boot_table_init_done = 1;
+            acpi_boot_table_init_done = true;
             srat_parse_regions(s);
             setup_max_pdx(raw_max_page);
         }
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#16 lore raw

Re: [PATCH 8/8] x86/setup.c: use plain bool

Quoted 19 lines · Wei Liu
---
 xen/arch/x86/setup.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
xen/arch/x86/setup.c +1 -1
index f7b927858c..db5df6956d 100644
@@ -53,7 +53,7 @@
 #include <asm/cpuid.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static bool_t __initdata opt_nosmp;
+static bool __initdata opt_nosmp;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */

xen/arch/x86/setup.c static void __init parse_smap_param(char *s) · line 155

Quoted 7 lines
xen/arch/x86/setup.c +2 -2
@@ -151,8 +151,8 @@ static void __init parse_smap_param(char *s)
 }
 custom_param("smap", parse_smap_param);
 
-bool_t __read_mostly acpi_disabled;
-bool_t __initdata acpi_force;
+bool __read_mostly acpi_disabled;
+bool __initdata acpi_force;

Prototypes?

Otherwise, patches 4-8 Reviewed-by: Andrew Cooper <[email protected]> (to save sending loads of emails)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#17 lore raw

Re: [PATCH 8/8] x86/setup.c: use plain bool

Quoted 23 lines · Andrew Cooper
Quoted 22 lines · Wei Liu
---
 xen/arch/x86/setup.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
xen/arch/x86/setup.c +1 -1
index f7b927858c..db5df6956d 100644
@@ -53,7 +53,7 @@
 #include <asm/cpuid.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static bool_t __initdata opt_nosmp;
+static bool __initdata opt_nosmp;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */
@@ -151,8 +151,8 @@ static void __init parse_smap_param(char *s)
 }
 custom_param("smap", parse_smap_param);
 
Quoted 7 lines

xen/arch/x86/setup.c static void __init parse_smap_param(char *s) · line 155

Quoted 4 lines
xen/arch/x86/setup.c +2 -2
-bool_t __read_mostly acpi_disabled;
-bool_t __initdata acpi_force;
+bool __read_mostly acpi_disabled;
+bool __initdata acpi_force;

Prototypes?

I discovered that these are declared in asm-x86/acpi.h, which is also ripe for similar cleanup. For now I only change the two variables touched in this patch to bool. Further cleanup to x86/acpi will deal with the rest.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#18 lore raw

Re: [PATCH 8/8] x86/setup.c: use plain bool

Quoted 30 lines · Wei Liu
Quoted 23 lines · Andrew Cooper
Quoted 22 lines · Wei Liu
---
 xen/arch/x86/setup.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
xen/arch/x86/setup.c +1 -1
index f7b927858c..db5df6956d 100644
@@ -53,7 +53,7 @@
 #include <asm/cpuid.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static bool_t __initdata opt_nosmp;
+static bool __initdata opt_nosmp;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */
@@ -151,8 +151,8 @@ static void __init parse_smap_param(char *s)
 }
 custom_param("smap", parse_smap_param);
 
Quoted 6 lines

xen/arch/x86/setup.c static void __init parse_smap_param(char *s) · line 155

Quoted 4 lines
xen/arch/x86/setup.c +2 -2
-bool_t __read_mostly acpi_disabled;
-bool_t __initdata acpi_force;
+bool __read_mostly acpi_disabled;
+bool __initdata acpi_force;

Prototypes?

Quoted 4 lines

I discovered that these are declared in asm-x86/acpi.h, which is also ripe for similar cleanup. For now I only change the two variables touched in this patch to bool. Further cleanup to x86/acpi will deal with the rest.

Ok fine. My R-by can stand.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel