Fix a few more warnings

Some are important, e.g. the seemingly harmless braces around if with dprintf,
since that dprintf is defined as empty, will screw things up and grab the next
line

Change-Id: Ie5e1cf813178ad708ff42ae5e477fbc96034471c
This commit is contained in:
Dominique Martinet
2018-06-12 15:21:15 +09:00
committed by Dominique Martinet
parent 0994c3300e
commit 6df4bd8f8c
7 changed files with 29 additions and 18 deletions

View File

@ -255,6 +255,11 @@ static unsigned long attr_to_l1attr(enum ihk_mc_pt_attribute attr)
}
}
#define PTLX_SHIFT(index) PTL ## index ## _SHIFT
#define GET_VIRT_INDEX(virt, index, dest) \
dest = ((virt) >> PTLX_SHIFT(index)) & (PT_ENTRIES - 1)
#define GET_VIRT_INDICES(virt, l4i, l3i, l2i, l1i) \
l4i = ((virt) >> PTL4_SHIFT) & (PT_ENTRIES - 1); \
l3i = ((virt) >> PTL3_SHIFT) & (PT_ENTRIES - 1); \
@ -1515,12 +1520,12 @@ static int clear_range_l1(void *args0, pte_t *ptep, uint64_t base,
if (page) {
dkprintf("%s: page=%p,is_in_memobj=%d,(old & PFL1_DIRTY)=%lx,memobj=%p,args->memobj->flags=%x\n", __FUNCTION__, page, page_is_in_memobj(page), (old & PFL1_DIRTY), args->memobj, args->memobj ? args->memobj->flags : -1);
}
if (page && page_is_in_memobj(page) && (old & PFL1_DIRTY) && (args->memobj) &&
!(args->memobj->flags & MF_ZEROFILL)) {
if (page && page_is_in_memobj(page) && pte_is_dirty(&old, PTL1_SIZE) &&
args->memobj && !(args->memobj->flags & MF_ZEROFILL)) {
memobj_flush_page(args->memobj, phys, PTL1_SIZE);
}
if (!(old & PFL1_FILEOFF)) {
if (!pte_is_fileoff(&old, PTL1_SIZE)) {
if(args->free_physical) {
if (!page) {
/* Anonymous || !XPMEM attach */
@ -1582,11 +1587,11 @@ static int clear_range_l2(void *args0, pte_t *ptep, uint64_t base,
page = phys_to_page(phys);
}
if (page && page_is_in_memobj(page) && (old & PFL2_DIRTY)) {
if (page && page_is_in_memobj(page) && pte_is_dirty(&old, PTL2_SIZE)) {
memobj_flush_page(args->memobj, phys, PTL2_SIZE);
}
if (!(old & PFL2_FILEOFF)) {
if (!pte_is_fileoff(&old, PTL2_SIZE)) {
if(args->free_physical) {
if (!page) {
/* Anonymous || !XPMEM attach */
@ -1663,13 +1668,13 @@ static int clear_range_l3(void *args0, pte_t *ptep, uint64_t base,
page = phys_to_page(phys);
}
if (page && page_is_in_memobj(page) && (old & PFL3_DIRTY)) {
if (page && page_is_in_memobj(page) && pte_is_dirty(&old, PTL3_SIZE)) {
memobj_flush_page(args->memobj, phys, PTL3_SIZE);
}
dkprintf("%s: phys=%ld, pte_get_phys(&old),PTL3_SIZE\n", __FUNCTION__, pte_get_phys(&old));
if (!(old & PFL3_FILEOFF)) {
if (!pte_is_fileoff(&old, PTL3_SIZE)) {
if(args->free_physical) {
if (!page) {
/* Anonymous || !XPMEM attach */

View File

@ -48,7 +48,7 @@ archdep_syscall(struct syscall_wait_desc *w, long *ret)
if (*ret >= PATH_MAX) {
*ret = -ENAMETOOLONG;
}
if (ret < 0) {
if (*ret < 0) {
return 0;
}
__dprintf("open: %s\n", pathbuf);

View File

@ -11,7 +11,9 @@
typedef int (*int_void_fn)(void);
#if 0
static int_void_fn orig_sched_yield = 0;
#endif
int sched_yield(void)
{

View File

@ -3333,9 +3333,9 @@ int main_loop(struct thread_data_s *my_thread)
}
/* Don't print when got a msg to stdout */
if (!(w.sr.number == __NR_write && w.sr.args[0] == 1))
if (!(w.sr.number == __NR_write && w.sr.args[0] == 1)) {
__dprintf("[%d] got syscall: %ld\n", cpu, w.sr.number);
}
//pthread_mutex_lock(lock);
my_thread->remote_tid = w.sr.rtid;
@ -3441,11 +3441,13 @@ int main_loop(struct thread_data_s *my_thread)
term = (w.sr.args[0] & 0xff00) >> 8;
if(isatty(2)){
if(sig){
if(!ischild)
if(!ischild) {
fprintf(stderr, "Terminate by signal %d\n", sig);
}
}
else if(term)
else if(term) {
__dprintf("Exit status: %d\n", term);
}
}
}

View File

@ -209,8 +209,10 @@ store_fake_cpu_info(struct sysfs_ops *ops0, void *instance, void *buf,
static struct fake_cpu_info_ops show_fci_online = {
.member = ONLINE,
.ops.show = &show_fake_cpu_info,
.ops.store = &store_fake_cpu_info,
.ops = {
.show = &show_fake_cpu_info,
.store = &store_fake_cpu_info,
},
};
void

View File

@ -547,7 +547,7 @@ static void *mckernel_allocate_aligned_pages_node(int npages, int p2align,
ihk_mc_ap_flag flag, int pref_node, int is_user, uintptr_t virt_addr)
{
unsigned long pa = 0;
int i, node;
int i = 0, node;
#ifndef IHK_RBTREE_ALLOCATOR
struct ihk_page_allocator_desc *pa_allocator;
#endif

View File

@ -72,7 +72,7 @@ char *profile_event_names[] =
""
};
mcs_lock_node_t job_profile_lock = {0, NULL};
mcs_lock_node_t job_profile_lock = { 0 };
struct profile_event *job_profile_events = NULL;
int job_nr_processes = -1;
int job_nr_processes_left = -1;
@ -445,7 +445,7 @@ void profile_dealloc_proc_events(struct process *proc)
kfree(proc->profile_events);
}
void static profile_clear_process(struct process *proc)
static void profile_clear_process(struct process *proc)
{
proc->profile_elapsed_ts = 0;
if (!proc->profile_events) return;
@ -454,7 +454,7 @@ void static profile_clear_process(struct process *proc)
sizeof(*proc->profile_events) * PROFILE_EVENT_MAX);
}
void static profile_clear_thread(struct thread *thread)
static void profile_clear_thread(struct thread *thread)
{
thread->profile_start_ts = 0;
thread->profile_elapsed_ts = 0;