Changeset 1b20da0 in mainline for kernel/generic/src/smp/smp_call.c


Ignore:
Timestamp:
2018-02-28T17:52:03Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3061bc1
Parents:
df6ded8
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
Message:

style: Remove trailing whitespace on non-empty lines, in certain file types.

Command used: tools/srepl '\([^[:space:]]\)\s\+$' '\1' -- *.c *.h *.py *.sh *.s *.S *.ag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/smp/smp_call.c

    rdf6ded8 r1b20da0  
    6161
    6262/** Invokes a function on a specific cpu and waits for it to complete.
    63  * 
    64  * Calls @a func on the CPU denoted by its logical id @cpu_id . 
    65  * The function will execute with interrupts disabled. It should 
    66  * be a quick and simple function and must never block. 
    67  * 
     63 *
     64 * Calls @a func on the CPU denoted by its logical id @cpu_id .
     65 * The function will execute with interrupts disabled. It should
     66 * be a quick and simple function and must never block.
     67 *
    6868 * If @a cpu_id is the local CPU, the function will be invoked
    6969 * directly.
    70  * 
     70 *
    7171 * All memory accesses of prior to smp_call() will be visible
    7272 * to @a func on cpu @a cpu_id. Similarly, any changes @a func
    7373 * makes on cpu @a cpu_id will be visible on this cpu once
    7474 * smp_call() returns.
    75  * 
     75 *
    7676 * Invoking @a func on the destination cpu acts as a memory barrier
    7777 * on that cpu.
    78  * 
     78 *
    7979 * @param cpu_id Destination CPU's logical id (eg CPU->id)
    8080 * @param func Function to call.
     
    8989
    9090/** Invokes a function on a specific cpu asynchronously.
    91  * 
    92  * Calls @a func on the CPU denoted by its logical id @cpu_id . 
    93  * The function will execute with interrupts disabled. It should 
    94  * be a quick and simple function and must never block. 
    95  * 
    96  * Pass @a call_info to smp_call_wait() in order to wait for 
     91 *
     92 * Calls @a func on the CPU denoted by its logical id @cpu_id .
     93 * The function will execute with interrupts disabled. It should
     94 * be a quick and simple function and must never block.
     95 *
     96 * Pass @a call_info to smp_call_wait() in order to wait for
    9797 * @a func to complete.
    98  * 
     98 *
    9999 * @a call_info must be valid until/after @a func returns. Use
    100100 * smp_call_wait() to wait until it is safe to free @a call_info.
    101  * 
     101 *
    102102 * If @a cpu_id is the local CPU, the function will be invoked
    103103 * directly. If the destination cpu id @a cpu_id is invalid
    104104 * or denotes an inactive cpu, the call is discarded immediately.
    105  * 
     105 *
    106106 * All memory accesses of the caller prior to smp_call_async()
    107  * will be made visible to @a func on the other cpu. Similarly, 
     107 * will be made visible to @a func on the other cpu. Similarly,
    108108 * any changes @a func makes on cpu @a cpu_id will be visible
    109109 * to this cpu when smp_call_wait() returns.
    110  * 
     110 *
    111111 * Invoking @a func on the destination cpu acts as a memory barrier
    112112 * on that cpu.
    113  * 
     113 *
    114114 * Interrupts must be enabled. Otherwise you run the risk
    115115 * of a deadlock.
    116  * 
     116 *
    117117 * @param cpu_id Destination CPU's logical id (eg CPU->id).
    118118 * @param func Function to call.
     
    121121 *          be valid until the function completes.
    122122 */
    123 void smp_call_async(unsigned int cpu_id, smp_call_func_t func, void *arg, 
     123void smp_call_async(unsigned int cpu_id, smp_call_func_t func, void *arg,
    124124        smp_call_t *call_info)
    125125{
    126         /* 
    127          * Interrupts must not be disabled or you run the risk of a deadlock 
     126        /*
     127         * Interrupts must not be disabled or you run the risk of a deadlock
    128128         * if both the destination and source cpus try to send an IPI to each
    129          * other with interrupts disabled. Because the interrupts are disabled 
    130          * the IPIs cannot be delivered and both cpus will forever busy wait 
     129         * other with interrupts disabled. Because the interrupts are disabled
     130         * the IPIs cannot be delivered and both cpus will forever busy wait
    131131         * for an acknowledgment of the IPI from the other cpu.
    132132         */
     
    155155                 * If a platform supports SMP it must implement arch_smp_call_ipi().
    156156                 * It should issue an IPI on cpu_id and invoke smp_call_ipi_recv()
    157                  * on cpu_id in turn. 
    158                  * 
     157                 * on cpu_id in turn.
     158                 *
    159159                 * Do not implement as just an empty dummy function. Instead
    160                  * consider providing a full implementation or at least a version 
     160                 * consider providing a full implementation or at least a version
    161161                 * that panics if invoked. Note that smp_call_async() never
    162162                 * calls arch_smp_call_ipi() on uniprocessors even if CONFIG_SMP.
     
    177177
    178178/** Waits for a function invoked on another CPU asynchronously to complete.
    179  * 
     179 *
    180180 * Does not sleep but rather spins.
    181  * 
     181 *
    182182 * Example usage:
    183183 * @code
     
    185185 *     puts((char*)p);
    186186 * }
    187  * 
     187 *
    188188 * smp_call_t call_info;
    189189 * smp_call_async(cpus[2].id, hello, "hi!\n", &call_info);
     
    191191 * smp_call_wait(&call_info);
    192192 * @endcode
    193  * 
     193 *
    194194 * @param call_info Initialized by smp_call_async().
    195195 */
     
    202202
    203203/** Architecture independent smp call IPI handler.
    204  * 
     204 *
    205205 * Interrupts must be disabled. Tolerates spurious calls.
    206206 */
     
    213213        list_initialize(&calls_list);
    214214       
    215         /* 
     215        /*
    216216         * Acts as a load memory barrier. Any changes made by the cpu that
    217217         * added the smp_call to calls_list will be made visible to this cpu.
     
    222222
    223223        /* Walk the list manually, so that we can safely remove list items. */
    224         for (link_t *cur = calls_list.head.next, *next = cur->next; 
     224        for (link_t *cur = calls_list.head.next, *next = cur->next;
    225225                !list_empty(&calls_list); cur = next, next = cur->next) {
    226226               
     
    254254static void call_done(smp_call_t *call_info)
    255255{
    256         /* 
    257          * Separate memory accesses of the called function from the 
     256        /*
     257         * Separate memory accesses of the called function from the
    258258         * announcement of its completion.
    259259         */
     
    265265{
    266266        do {
    267                 /* 
     267                /*
    268268                 * Ensure memory accesses following call_wait() are ordered
    269                  * after completion of the called function on another cpu. 
     269                 * after completion of the called function on another cpu.
    270270                 * Also, speed up loading of call_info->pending.
    271271                 */
Note: See TracChangeset for help on using the changeset viewer.