NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-arm/58593: tegra_cpufreq lacks memory barriers in bespoke locking
>Number: 58593
>Category: port-arm
>Synopsis: tegra_cpufreq lacks memory barriers in bespoke locking
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: port-arm-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 14 02:00:00 +0000 2024
>Originator: Taylor R Campbell
>Release: current, 10
>Organization:
The NvidiaBSD Frequentegra
>Environment:
>Description:
153 if (atomic_cas_uint(&cpufreq_busy, 0, 1) != 0)
154 return EBUSY;
155
156 error = cpufreq_set_rate(fq);
157 if (error == 0) {
158 pmf_event_inject(NULL, PMFE_SPEED_CHANGED);
159 }
160
161 atomic_dec_uint(&cpufreq_busy);
https://nxr.netbsd.org/xref/src/sys/arch/arm/nvidia/tegra_cpufreq.c?r=1.5#153
This doesn't provide adequate memory ordering.
>How-To-Repeat:
code inspection
>Fix:
Two options:
1. After atomic_cas_uint, add membar_acquire; and add membar_release before atomic_dec_uint.
2. Just use mutex(9).
Home |
Main Index |
Thread Index |
Old Index