HV: treewide: drop debug-only helpers in release build

There are multiple helpers for collecting info to be printed on the ACRN uart
console. They are unreachable code in release builds in which the uart console
is removed.

To define a precise boundary for safety-related activities, this patch wraps the
declarations and definitions to these helpers with "#ifdef HV_DEBUG" so that
these unreachable APIs will be dropped in release builds.

v1 -> v2:

    * Fix coding style: no empty lines between #ifdef and the wrapped code.
    * Also drop get_rte_info() in ioapic.c, which is solely used by
      get_ioapic_info().

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2018-07-02 19:01:08 +08:00
committed by lijinxia
parent 8b1c5a7cba
commit cfc3811a0a
12 changed files with 38 additions and 6 deletions

View File

@@ -141,6 +141,7 @@ int32_t hv_main(uint16_t cpu_id)
return 0;
}
#ifdef HV_DEBUG
void get_vmexit_profile(char *str, int str_max)
{
uint16_t cpu, i;
@@ -175,3 +176,4 @@ void get_vmexit_profile(char *str, int str_max)
}
snprintf(str, size, "\r\n");
}
#endif /* HV_DEBUG */

View File

@@ -96,6 +96,7 @@ int32_t acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req)
return 0;
}
#ifdef HV_DEBUG
static void _get_req_info_(struct vhm_request *req, int *id, char *type,
char *state, char *dir, long *addr, long *val)
{
@@ -191,3 +192,4 @@ void get_req_info(char *str, int str_max)
spinlock_release(&vm_list_lock);
snprintf(str, size, "\r\n");
}
#endif /* HV_DEBUG */