[bug report] lib: dhry: fix unstable smp_processor_id(_) usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Geert Uytterhoeven,

The patch 13684e966d46: "lib: dhry: fix unstable smp_processor_id(_)
usage" from Mar 15, 2023, leads to the following Smatch static
checker warning:

lib/dhry_run.c:38 dhry_benchmark() warn: sleeping in atomic context
lib/dhry_run.c:43 dhry_benchmark() warn: sleeping in atomic context

lib/dhry_run.c
    32 static void dhry_benchmark(void)
    33 {
    34         unsigned int cpu = get_cpu();
                                  ^^^^^^^^^^
get_cpu disables preemption

    35         int i, n;
    36 
    37         if (iterations > 0) {
--> 38                 n = dhry(iterations);
                           ^^^^^^^^^^^^^^^^
dhry() does sleeping allocations

    39                 goto report;
    40         }
    41 
    42         for (i = DHRY_VAX; i > 0; i <<= 1) {
    43                 n = dhry(i);
    44                 if (n != -EAGAIN)
    45                         break;
    46         }
    47 
    48 report:
    49         put_cpu();
    50         if (n >= 0)
    51                 pr_info("CPU%u: Dhrystones per Second: %d (%d DMIPS)\n", cpu,
    52                         n, n / DHRY_VAX);
    53         else if (n == -EAGAIN)
    54                 pr_err("Please increase the number of iterations\n");
    55         else
    56                 pr_err("Dhrystone benchmark failed error %pe\n", ERR_PTR(n));
    57 }

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux