Changeset 18b6a88 in mainline for kernel


Ignore:
Timestamp:
2018-04-15T09:35:04Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1f44ca
Parents:
8ebe212
Message:

More ccheck fixes, sometimes with manual intervention.

Location:
kernel
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/abs32le/include/arch/mm/page.h

    r8ebe212 r18b6a88  
    152152        pte_t *p = &pt[i];
    153153
    154         return (
    155             ((unsigned int) (!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
     154        return (((unsigned int) (!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
    156155            ((unsigned int) (!p->present) << PAGE_PRESENT_SHIFT) |
    157156            ((unsigned int) p->uaccessible << PAGE_USER_SHIFT) |
     
    159158            ((unsigned int) p->writeable << PAGE_WRITE_SHIFT) |
    160159            (1 << PAGE_EXEC_SHIFT) |
    161             ((unsigned int) p->global << PAGE_GLOBAL_SHIFT)
    162         );
     160            ((unsigned int) p->global << PAGE_GLOBAL_SHIFT));
    163161}
    164162
  • kernel/arch/arm32/include/arch/cycle.h

    r8ebe212 r18b6a88  
    5252        if ((ID_PFR1_read() & ID_PFR1_GEN_TIMER_EXT_MASK) ==
    5353            ID_PFR1_GEN_TIMER_EXT) {
    54             uint32_t low = 0, high = 0;
    55             asm volatile( "MRRC p15, 0, %[low], %[high], c14": [low]"=r"(low), [high]"=r"(high));
    56            return ((uint64_t)high << 32) | low;
     54                uint32_t low = 0, high = 0;
     55                asm volatile (
     56                    "MRRC p15, 0, %[low], %[high], c14"
     57                    : [low] "=r" (low), [high] "=r" (high)
     58                );
     59                return ((uint64_t)high << 32) | low;
    5760        } else {
    5861                return (uint64_t)PMCCNTR_read() * 64;
  • kernel/arch/arm32/src/mach/integratorcp/integratorcp.c

    r8ebe212 r18b6a88  
    245245void icp_cpu_halt(void)
    246246{
    247         while (true);
     247        while (true)
     248                ;
    248249}
    249250
     
    345346
    346347#ifdef CONFIG_PL011_UART
    347         srln_instance_t *srln_instance = srln_init();
    348         if (srln_instance) {
    349                 indev_t *sink = stdin_wire();
    350                 indev_t *srln = srln_wire(srln_instance, sink);
    351                 pl011_uart_input_wire(&icp.uart, srln);
    352                 icp_irqc_unmask(ICP_UART0_IRQ);
    353         }
     348        srln_instance_t *srln_instance = srln_init();
     349        if (srln_instance) {
     350                indev_t *sink = stdin_wire();
     351                indev_t *srln = srln_wire(srln_instance, sink);
     352                pl011_uart_input_wire(&icp.uart, srln);
     353                icp_irqc_unmask(ICP_UART0_IRQ);
     354        }
    354355#endif
    355356}
  • kernel/arch/ia64/src/mm/page.c

    r8ebe212 r18b6a88  
    7575         * For paranoia reasons, we set it again.
    7676         */
    77         for(i = 0; i < REGION_REGISTERS; i++) {
     77        for (i = 0; i < REGION_REGISTERS; i++) {
    7878                rr.word = rr_read(i);
    7979                rr.map.ve = 0;          /* disable VHPT walker */
  • kernel/arch/sparc64/include/arch/sun4v/hypercall.h

    r8ebe212 r18b6a88  
    152152 */
    153153static inline uint64_t
    154     __hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
     154__hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
    155155    const uint64_t p4, const uint64_t p5, const uint64_t function_number)
    156156{
     
    187187 */
    188188static inline uint64_t
    189     __hypercall_fast_ret1(const uint64_t p1, const uint64_t p2, const uint64_t p3,
     189__hypercall_fast_ret1(const uint64_t p1, const uint64_t p2, const uint64_t p3,
    190190    const uint64_t p4, const uint64_t p5, const uint64_t function_number,
    191191    uint64_t *ret1)
     
    223223 */
    224224static inline uint64_t
    225     __hypercall_hyperfast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
     225__hypercall_hyperfast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
    226226    const uint64_t p4, const uint64_t p5, const uint64_t sw_trap_number)
    227227{
  • kernel/genarch/src/drivers/am335x/timer.c

    r8ebe212 r18b6a88  
    4747
    4848typedef struct timer_regs_mmap {
    49         uintptr_t base;
    50         size_t size;
     49        uintptr_t base;
     50        size_t size;
    5151} timer_regs_mmap_t;
    5252
    5353static const timer_regs_mmap_t regs_map[TIMERS_MAX] = {
    5454        { .base = AM335x_DMTIMER0_BASE_ADDRESS, .size = AM335x_DMTIMER0_SIZE },
    55         {0, 0}, /* DMTIMER1 is not supported by this driver */
     55        { 0, 0 }, /* DMTIMER1 is not supported by this driver */
    5656        { .base = AM335x_DMTIMER2_BASE_ADDRESS, .size = AM335x_DMTIMER2_SIZE },
    5757        { .base = AM335x_DMTIMER3_BASE_ADDRESS, .size = AM335x_DMTIMER3_SIZE },
     
    6767        am335x_timer_regs_t *regs = timer->regs;
    6868
    69         while (regs->twps & reg);
     69        while (regs->twps & reg)
     70                ;
    7071
    7172        switch (reg) {
     
    149150        timer->regs->tiocp_cfg |= AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG;
    150151        /* Wait until the reset is done */
    151         while (timer->regs->tiocp_cfg & AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG);
     152        while (timer->regs->tiocp_cfg & AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG)
     153                ;
    152154}
    153155
  • kernel/generic/src/adt/avl.c

    r8ebe212 r18b6a88  
    308308 */
    309309static int
    310     repair(avltree_t *t, avltree_node_t *u, avltree_node_t *v, avltree_node_t *w,
     310repair(avltree_t *t, avltree_node_t *u, avltree_node_t *v, avltree_node_t *w,
    311311    int *dir, int ro)
    312312{
  • kernel/generic/src/interrupt/interrupt.c

    r8ebe212 r18b6a88  
    165165}
    166166
    167 static NO_TRACE
    168 void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
     167static NO_TRACE void
     168fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
    169169{
    170170        printf("Task %s (%" PRIu64 ") killed due to an exception at "
  • kernel/generic/src/ipc/sysipc.c

    r8ebe212 r18b6a88  
    765765
    766766        if (!call) {
    767                 ipc_data_t data = {};
     767                ipc_data_t data = { };
    768768                data.cap_handle = CAP_NIL;
    769769                STRUCT_TO_USPACE(calldata, &data);
  • kernel/generic/src/mm/km.c

    r8ebe212 r18b6a88  
    263263                }
    264264        } else {
    265 lowmem:
     265        lowmem:
    266266                frame = frame_alloc(1, FRAME_LOWMEM | flags, 0);
    267267                if (!frame)
  • kernel/generic/src/proc/scheduler.c

    r8ebe212 r18b6a88  
    430430                case Exiting:
    431431                        rcu_thread_exiting();
    432 repeat:
     432                repeat:
    433433                        if (THREAD->detached) {
    434434                                thread_destroy(THREAD, false);
  • kernel/generic/src/synch/rcu.c

    r8ebe212 r18b6a88  
    253253static void synch_complete(rcu_item_t *rcu_item);
    254254static inline void rcu_call_impl(bool expedite, rcu_item_t *rcu_item,
    255         rcu_func_t func);
     255    rcu_func_t func);
    256256static void add_barrier_cb(void *arg);
    257257static void barrier_complete(rcu_item_t *barrier_item);
     
    440440{
    441441        for (unsigned int cpu_id = 0; cpu_id < config.cpu_count; ++cpu_id) {
    442                 char name[THREAD_NAME_BUFLEN] = {0};
     442                char name[THREAD_NAME_BUFLEN] = { 0 };
    443443
    444444                snprintf(name, THREAD_NAME_BUFLEN - 1, "rcu-rec/%u", cpu_id);
    445445
    446446                cpus[cpu_id].rcu.reclaimer_thr =
    447                         thread_create(reclaimer, NULL, TASK, THREAD_FLAG_NONE, name);
     447                    thread_create(reclaimer, NULL, TASK, THREAD_FLAG_NONE, name);
    448448
    449449                if (!cpus[cpu_id].rcu.reclaimer_thr)
     
    461461{
    462462        rcu.detector_thr =
    463                 thread_create(detector, NULL, TASK, THREAD_FLAG_NONE, "rcu-det");
     463            thread_create(detector, NULL, TASK, THREAD_FLAG_NONE, "rcu-det");
    464464
    465465        if (!rcu.detector_thr)
     
    656656/** rcu_call() inline-able implementation. See rcu_call() for comments. */
    657657static inline void rcu_call_impl(bool expedite, rcu_item_t *rcu_item,
    658         rcu_func_t func)
     658    rcu_func_t func)
    659659{
    660660        assert(rcu_item);
     
    667667        rcu_cpu_data_t *r = &CPU->rcu;
    668668
    669         rcu_item_t **prev_tail
    670                 = local_atomic_exchange(&r->parriving_cbs_tail, &rcu_item->next);
     669        rcu_item_t **prev_tail =
     670            local_atomic_exchange(&r->parriving_cbs_tail, &rcu_item->next);
    671671        *prev_tail = rcu_item;
    672672
     
    829829        if (0 < arriving_cnt) {
    830830                CPU->rcu.stat_avg_cbs =
    831                         (99 * CPU->rcu.stat_avg_cbs + 1 * arriving_cnt) / 100;
     831                    (99 * CPU->rcu.stat_avg_cbs + 1 * arriving_cnt) / 100;
    832832        }
    833833}
     
    853853         * or risk exhausting all system memory.
    854854         */
    855         bool expedite = (EXPEDITE_THRESHOLD < CPU->rcu.next_cbs_cnt)
    856                 || CPU->rcu.expedite_arriving;
     855        bool expedite = (EXPEDITE_THRESHOLD < CPU->rcu.next_cbs_cnt) ||
     856            CPU->rcu.expedite_arriving;
    857857        CPU->rcu.expedite_arriving = false;
    858858
     
    958958                        /* Wait for the GP to complete. */
    959959                        errno_t ret = _condvar_wait_timeout_spinlock(&rcu.gp_ended, &rcu.gp_lock,
    960                                 SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
     960                            SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
    961961
    962962                        if (ret == EINTR) {
     
    984984        while (!cpu_mask_is_none(reader_cpus)) {
    985985                /* Give cpus a chance to context switch (a QS) and batch callbacks. */
    986                 if(!gp_sleep(&expedite))
     986                if (!gp_sleep(&expedite))
    987987                        return false;
    988988
     
    10151015                errno_t ret = 0;
    10161016                ret = _condvar_wait_timeout_spinlock(&rcu.expedite_now, &rcu.gp_lock,
    1017                         DETECT_SLEEP_MS * 1000, SYNCH_FLAGS_INTERRUPTIBLE);
     1017                    DETECT_SLEEP_MS * 1000, SYNCH_FLAGS_INTERRUPTIBLE);
    10181018
    10191019                /* rcu.expedite_now was signaled. */
     
    11451145
    11461146                printf("Bug: thread (id %" PRIu64 " \"%s\") exited while in RCU read"
    1147                         " section.\n", THREAD->tid, THREAD->name);
     1147                    " section.\n", THREAD->tid, THREAD->name);
    11481148        }
    11491149}
     
    12071207         */
    12081208        rcu_gp_t compl_gp = ACCESS_ONCE(rcu.completed_gp);
    1209         if (CPU->rcu.cur_cbs_gp <= compl_gp
    1210                 && compl_gp <= CPU->rcu.cur_cbs_gp + UINT32_MAX_HALF) {
     1209        if (CPU->rcu.cur_cbs_gp <= compl_gp &&
     1210            compl_gp <= CPU->rcu.cur_cbs_gp + UINT32_MAX_HALF) {
    12111211                *completed_gp = compl_gp;
    12121212                return true;
     
    12371237         */
    12381238        if (expedite) {
    1239                 if(0 == rcu.req_expedited_cnt)
     1239                if (0 == rcu.req_expedited_cnt)
    12401240                        condvar_signal(&rcu.expedite_now);
    12411241
     
    12701270        while (rcu.completed_gp < wait_on_gp && !interrupted) {
    12711271                int ret = _condvar_wait_timeout_spinlock(&rcu.gp_ended, &rcu.gp_lock,
    1272                         SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
     1272                    SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
    12731273                interrupted = (ret == EINTR);
    12741274        }
     
    13301330        while (0 == rcu.req_gp_end_cnt && !interrupted) {
    13311331                int ret = _condvar_wait_timeout_spinlock(&rcu.req_gp_changed,
    1332                         &rcu.gp_lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
     1332                    &rcu.gp_lock, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_INTERRUPTIBLE);
    13331333
    13341334                interrupted = (ret == EINTR);
     
    13951395                /* minor bug: sleeps for the same duration if woken up spuriously. */
    13961396                ret = _condvar_wait_timeout_spinlock(&rcu.expedite_now, &rcu.gp_lock,
    1397                         DETECT_SLEEP_MS * 1000, SYNCH_FLAGS_INTERRUPTIBLE);
     1397                    DETECT_SLEEP_MS * 1000, SYNCH_FLAGS_INTERRUPTIBLE);
    13981398        }
    13991399
     
    14791479        int delaying_cpu_cnt = atomic_get(&rcu.delaying_cpu_cnt);
    14801480
    1481         for (int i = 0; i < delaying_cpu_cnt; ++i){
     1481        for (int i = 0; i < delaying_cpu_cnt; ++i) {
    14821482                if (!semaphore_down_interruptable(&rcu.remaining_readers))
    14831483                        return false;
     
    15491549        if (THREAD == rcu.detector_thr) {
    15501550                THREAD->priority = -1;
    1551         }
    1552         else if (THREAD == CPU->rcu.reclaimer_thr) {
     1551        } else if (THREAD == CPU->rcu.reclaimer_thr) {
    15531552                THREAD->priority = -1;
    15541553        }
     
    16061605
    16071606                printf("Bug: thread (id %" PRIu64 " \"%s\") exited while in RCU read"
    1608                         " section.\n", THREAD->tid, THREAD->name);
     1607                    " section.\n", THREAD->tid, THREAD->name);
    16091608        }
    16101609}
     
    18341833
    18351834        printf("Config: expedite_threshold=%d, critical_threshold=%d,"
    1836                 " detect_sleep=%dms, %s\n",
    1837                 EXPEDITE_THRESHOLD, CRITICAL_THRESHOLD, DETECT_SLEEP_MS, algo);
     1835            " detect_sleep=%dms, %s\n",
     1836            EXPEDITE_THRESHOLD, CRITICAL_THRESHOLD, DETECT_SLEEP_MS, algo);
    18381837        printf("Completed GPs: %" PRIu64 "\n", rcu.completed_gp);
    18391838        printf("Expedited GPs: %zu\n", rcu.stat_expedited_cnt);
    18401839        printf("Delayed GPs:   %zu (cpus w/ still running readers after gp sleep)\n",
    1841                 rcu.stat_delayed_cnt);
     1840            rcu.stat_delayed_cnt);
    18421841        printf("Preempt blocked GPs: %zu (waited for preempted readers; "
    1843                 "running or not)\n", rcu.stat_preempt_blocking_cnt);
     1842            "running or not)\n", rcu.stat_preempt_blocking_cnt);
    18441843        printf("Smp calls:     %zu\n", rcu.stat_smp_call_cnt);
    18451844
Note: See TracChangeset for help on using the changeset viewer.