diff mbox

[v6,4/5] util: [ppc] Use new error_report_abort() instead of abort()

Message ID 145442965530.1539.10919507514033766738.stgit@localhost (mailing list archive)
State New, archived
Headers show

Commit Message

Lluís Vilanova Feb. 2, 2016, 4:14 p.m. UTC
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 target-ppc/kvm.c        |    4 ++--
 target-ppc/kvm_ppc.h    |   15 +++++++++------
 target-ppc/mmu-hash32.c |    5 +++--
 target-ppc/mmu_helper.c |    3 +--
 4 files changed, 15 insertions(+), 12 deletions(-)

Comments

Eric Blake Feb. 2, 2016, 7:34 p.m. UTC | #1
On 02/02/2016 09:14 AM, Lluís Vilanova wrote:
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  target-ppc/kvm.c        |    4 ++--
>  target-ppc/kvm_ppc.h    |   15 +++++++++------
>  target-ppc/mmu-hash32.c |    5 +++--
>  target-ppc/mmu_helper.c |    3 +--
>  4 files changed, 15 insertions(+), 12 deletions(-)
> 

> @@ -215,36 +218,36 @@ static inline int kvmppc_get_htab_fd(bool write)
>  static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
>                                     int64_t max_ns)
>  {
> -    abort();
> +    error_report_abort(" ");
>  }

I still strongly dislike this.  Reporting an error message with nothing
but a trailing whitespace is NOT helpful.  Straight 'abort()' is better
than this; if we can't come up with a useful message, then it is not
worth using the message-handling interface.
David Gibson Feb. 3, 2016, 5:06 a.m. UTC | #2
On Tue, Feb 02, 2016 at 05:14:15PM +0100, Lluís Vilanova wrote:
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  target-ppc/kvm.c        |    4 ++--
>  target-ppc/kvm_ppc.h    |   15 +++++++++------
>  target-ppc/mmu-hash32.c |    5 +++--
>  target-ppc/mmu_helper.c |    3 +--
>  4 files changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index 1bb87e6..b743811 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -587,7 +587,7 @@ static void kvm_get_one_spr(CPUState *cs, uint64_t id, int spr)
>  
>          default:
>              /* Don't handle this size yet */
> -            abort();
> +            error_report_abort("Unhandled size: %d", id & KVM_REG_SIZE_MASK);
>          }
>      }
>  }
> @@ -617,7 +617,7 @@ static void kvm_put_one_spr(CPUState *cs, uint64_t id, int spr)
>  
>      default:
>          /* Don't handle this size yet */
> -        abort();
> +        error_report_abort("Unhandled size: %d", id & KVM_REG_SIZE_MASK);
>      }
>  
>      ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
> diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
> index 62406ce..f82582e 100644
> --- a/target-ppc/kvm_ppc.h
> +++ b/target-ppc/kvm_ppc.h
> @@ -9,6 +9,9 @@
>  #ifndef __KVM_PPC_H__
>  #define __KVM_PPC_H__
>  
> +#include "qemu/error-report.h"
> +
> +
>  #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
>  
>  #ifdef CONFIG_KVM
> @@ -215,36 +218,36 @@ static inline int kvmppc_get_htab_fd(bool write)
>  static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
>                                     int64_t max_ns)
>  {
> -    abort();
> +    error_report_abort(" ");

Nack.  The empty message report is just awful.  I don't think we
should feel the need to get rid of every bare abort() or assert().
diff mbox

Patch

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 1bb87e6..b743811 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -587,7 +587,7 @@  static void kvm_get_one_spr(CPUState *cs, uint64_t id, int spr)
 
         default:
             /* Don't handle this size yet */
-            abort();
+            error_report_abort("Unhandled size: %d", id & KVM_REG_SIZE_MASK);
         }
     }
 }
@@ -617,7 +617,7 @@  static void kvm_put_one_spr(CPUState *cs, uint64_t id, int spr)
 
     default:
         /* Don't handle this size yet */
-        abort();
+        error_report_abort("Unhandled size: %d", id & KVM_REG_SIZE_MASK);
     }
 
     ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &reg);
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index 62406ce..f82582e 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -9,6 +9,9 @@ 
 #ifndef __KVM_PPC_H__
 #define __KVM_PPC_H__
 
+#include "qemu/error-report.h"
+
+
 #define TYPE_HOST_POWERPC_CPU "host-" TYPE_POWERPC_CPU
 
 #ifdef CONFIG_KVM
@@ -215,36 +218,36 @@  static inline int kvmppc_get_htab_fd(bool write)
 static inline int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize,
                                    int64_t max_ns)
 {
-    abort();
+    error_report_abort(" ");
 }
 
 static inline int kvmppc_load_htab_chunk(QEMUFile *f, int fd, uint32_t index,
                                          uint16_t n_valid, uint16_t n_invalid)
 {
-    abort();
+    error_report_abort(" ");
 }
 
 static inline uint64_t kvmppc_hash64_read_pteg(PowerPCCPU *cpu,
                                                target_ulong pte_index)
 {
-    abort();
+    error_report_abort(" ");
 }
 
 static inline void kvmppc_hash64_free_pteg(uint64_t token)
 {
-    abort();
+    error_report_abort(" ");
 }
 
 static inline void kvmppc_hash64_write_pte(CPUPPCState *env,
                                            target_ulong pte_index,
                                            target_ulong pte0, target_ulong pte1)
 {
-    abort();
+    error_report_abort(" ");
 }
 
 static inline bool kvmppc_has_cap_fixup_hcalls(void)
 {
-    abort();
+    error_report_abort(" ");
 }
 
 static inline int kvmppc_enable_hwrng(void)
diff --git a/target-ppc/mmu-hash32.c b/target-ppc/mmu-hash32.c
index b076d80..75e593a 100644
--- a/target-ppc/mmu-hash32.c
+++ b/target-ppc/mmu-hash32.c
@@ -21,6 +21,7 @@ 
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "qemu/error-report.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "mmu-hash32.h"
@@ -56,7 +57,7 @@  static int ppc_hash32_pp_prot(int key, int pp, int nx)
             break;
 
         default:
-            abort();
+            error_report_abort("Unhandled pp: %d", pp);
         }
     } else {
         switch (pp) {
@@ -74,7 +75,7 @@  static int ppc_hash32_pp_prot(int key, int pp, int nx)
             break;
 
         default:
-            abort();
+            error_report_abort("Unhandled pp: %d", pp);
         }
     }
     if (nx == 0) {
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index de4e286..6e50e78 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -1324,8 +1324,7 @@  static inline int check_physical(CPUPPCState *env, mmu_ctx_t *ctx,
 
     default:
         /* Caller's checks mean we should never get here for other models */
-        abort();
-        return -1;
+        error_report_abort("Unhandled MMU model: %d", env->mmu_model);
     }
 
     return ret;