Page MenuHomeFreeBSD
Feed Advanced Search

Sep 7 2017

truckman accepted D12237: Decode AMD RAS Capabilities and enable MCA thresholding on 17h (two commits).

Builds fine and doesn't cause any obvious breakage on my Ryzen. This feature does appear to be detected properly.

Sep 7 2017, 5:56 PM
truckman added inline comments to D12130: Greatly reduce interrupt latency caused by steal_idle.
Sep 7 2017, 4:51 PM
truckman added inline comments to D12130: Greatly reduce interrupt latency caused by steal_idle.
Sep 7 2017, 4:20 PM
truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.

Any feedback? I'd like to get this committed before I RMA my Ryzen CPU.

Sep 7 2017, 7:19 AM

Sep 6 2017

truckman committed rP449354: Upgrade graphics/atril and graphics/atril-lite to version 1.18.1 to.
Upgrade graphics/atril and graphics/atril-lite to version 1.18.1 to
Sep 6 2017, 6:35 PM
truckman committed rP449351: Correct vulnerability range for atril and atril-lite..
Correct vulnerability range for atril and atril-lite.
Sep 6 2017, 6:25 PM
truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.
In D12130#252053, @kib wrote:

I don't think that there is a problem with ithread migration. As a matter of fact the lack of any obvious problems with ithreads makes me suspect a tlb issue. Ithreads live in kernel memory space which is going to be the same everywhere. I'm wondering if a thread that has migrated to a core on the other CCX isn't always getting its tlb fully initialized before returning to userspace.

We do not re-initialize (flush is the common term) thread's TLB before returning to userspace. We flush TLB when switching contexts. More precisely, there are two variants of it.

On older CPUs, without the PCID feature, reload of %cr3 (the page table base pointer) flushes all non-global entries from TLB of the CPU thread which reloaded %cr3. Kernel-mode TLB entries are typically global (PG_G). The reload most often occurs on context switch, see cpu_switch.S.

On newer Intel CPUs, where PCID feature is present, each TLB entry is additionally tagged with the address space ID, and on the switch we typically inform CPU about new address space ID, avoiding the flush.

One of the reason I asked you about the verbose dmesg some time ago was to see which TLB switching mechanism is used, and apparently Ryzens do not implement PCID. Although AMD CPUs do tag TLB entries with ASIDs for SVM for long time.

You could experiment by adding the the equivalent of invltlb_glob() right after %cr3 reload in cpu_switch. This should flush the whole TLB, including the kernel entries.

You already tried to disable superpage promotions, so other known workarounds like erratum383 should be not useful.

Sep 6 2017, 5:30 PM

Sep 4 2017

truckman updated the diff for D12130: Greatly reduce interrupt latency caused by steal_idle.

Mark more members of struct tdq as volatile to prevent accesses
to them from being optimized out by the compiler. They are
written in one context and read in another, sometimes multiple
times in one function, and we want the reader to notice changes
if they happen.

Sep 4 2017, 7:46 PM
truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.
In D12130#253585, @cem wrote:
In D12130#253523, @avg wrote:
In D12130#251884, @jeff wrote:

I have another patch that was a 2-3% perf improvement at isilon that I have been meaning to backport that is somewhat at odds with this, although not entirely. It performs a search in the last thread to switch out rather than switching to the idle thread. This saves you a context switch into the idle thread and then back out again when stealing will be immediately productive. The code is relatively straightforward. It helps a lot when there are tons of context switches and lots of short running threads coming and going.

I would love to see that change land in the tree. It makes a lot of sense to elide a switch to the idle thread if we have an opportunity to steal a thread and switch to it directly.

https://people.freebsd.org/~cem/0001-Improve-scheduler-performance-and-decision-making.-F.patch if you want to work on adopting it. I've committed the standalone subr_smp.c portion already.

Sep 4 2017, 6:47 PM
truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.
In D12130#253523, @avg wrote:
In D12130#251884, @jeff wrote:

I have another patch that was a 2-3% perf improvement at isilon that I have been meaning to backport that is somewhat at odds with this, although not entirely. It performs a search in the last thread to switch out rather than switching to the idle thread. This saves you a context switch into the idle thread and then back out again when stealing will be immediately productive. The code is relatively straightforward. It helps a lot when there are tons of context switches and lots of short running threads coming and going.

I would love to see that change land in the tree. It makes a lot of sense to elide a switch to the idle thread if we have an opportunity to steal a thread and switch to it directly.

Sep 4 2017, 5:59 PM
truckman added a comment to D12217: Add temperature sensor support for AMD Zen processors; two separate commits included this review..
Sep 4 2017, 5:45 PM
truckman added inline comments to D12130: Greatly reduce interrupt latency caused by steal_idle.
Sep 4 2017, 5:23 PM

Sep 3 2017

truckman accepted D12217: Add temperature sensor support for AMD Zen processors; two separate commits included this review..

Works on my Ryzen machine, so I'm no longer flying blind in terms of CPU temperature under load. Doing mental math or manually setting the temperature offset is fine for now.

Sep 3 2017, 3:34 AM

Sep 2 2017

truckman added a comment to D12217: Add temperature sensor support for AMD Zen processors; two separate commits included this review..

Should the 20C temperature offset for the 1700X and 1800X be set automatically? When I first got my 1700X, the motherboard had the original BIOS which did not account for the offset. It thought the CPU temperature was 50+C at idle and the fan ran at close to full speed even though I've got a massive heat sink on the CPU. A subsequent BIOS upgrade compensated for the offset and told me that the idle temperature was in the low 30C range and the fan speed was much more reasonable at idle.

Sep 2 2017, 11:01 PM

Aug 30 2017

truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.

I did some further investigation of the successful steals that happen when steal->tdq_load == 1 && steal->tdq_transferrable !=0. That happened 1557 times during a buildworld run. Of those, steal->tdq_cpu_idle was nonzero 1099 times, and steal->tdq_ipipending was nonzero 196 times. It doesn't look like the source CPU being busy handling an interrupt was the issue. On my hardware, cpu 0 handles the majority of interrupts by far, but the distribution these events is fairly evenly distributed across all of the CPUs.

Aug 30 2017, 10:15 PM
truckman added inline comments to D12130: Greatly reduce interrupt latency caused by steal_idle.
Aug 30 2017, 6:08 PM
truckman added inline comments to D12130: Greatly reduce interrupt latency caused by steal_idle.
Aug 30 2017, 5:35 PM

Aug 28 2017

truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.

As a test case, you might try building lang/ghc in parallel with some other load so that there is some thread migration activity. I'm not sure it is the same problem, but ghc seems to be super sensitive and I pretty much always see SIGBUS failures on my Ryzen machine.

Aug 28 2017, 7:08 AM
truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.

AMD has publicly been very vague about this problem. About the only thing they've said is that there is some sort of "performance marginality" and that Threadripper is not affected. Since Threadripper uses the same die stepping as Ryzen, it looks like they have figured out how to screen for parts with this problem. There is a long thread on the AMD forum here: https://community.amd.com/thread/215773?start=1095&tstart=0.

Aug 28 2017, 5:40 AM
truckman added a comment to D12130: Greatly reduce interrupt latency caused by steal_idle.

Basically this started as an investigation of system hangs, reboots, and oddball process failures on Ryzen as documented in this PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219399. It turns out that there are actually multiple issues and this PR ended up tracking the hang/reboot issue, which was eventually fixed. The remaining problem(s) were moved to this PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221029. After doing a number of experiments, I came to the conclusion that the majority of the problems were correlated to thread migration, and I discovered that disabling both kern.sched.balance and kern.sched.steal_idle got rid most or all of the problems. That led me to start hacking on the scheduler code to see if there was any pattern to the problematic thread migrations and I found that disabling the last loop iteration that looked at all cores alleviated the problems. Ryzen apparently has issues with its IRET instruction, so I wasn't sure if the problem was triggered by having interrupts disabled for such a long time or if the problem was due to migrating threads between the two CCXes. It also looked to me like there was an off-by-one bug in sched_highest(), so I asked about that in this email thread: https://docs.freebsd.org/cgi/getmsg.cgi?fetch=12902+0+/usr/local/www/mailindex/archive/2017/freebsd-arch/20170827.freebsd-arch (I don't know why my original message isn't in the archive).

Aug 28 2017, 2:32 AM

Aug 26 2017

truckman created D12130: Greatly reduce interrupt latency caused by steal_idle.
Aug 26 2017, 5:42 PM
truckman committed rP448748: Upgrade to pywdns version 0.9.0..
Upgrade to pywdns version 0.9.0.
Aug 26 2017, 1:42 AM

Aug 25 2017

truckman committed rP448738: Upgrade OpenBLAS to 0.2.20:.
Upgrade OpenBLAS to 0.2.20:
Aug 25 2017, 7:59 PM

Aug 17 2017

truckman committed rP448087: Upgrade protobuf-c to version 1.3.0:.
Upgrade protobuf-c to version 1.3.0:
Aug 17 2017, 11:19 AM

Aug 16 2017

truckman committed rS322569: MFC r321899.
MFC r321899
Aug 16 2017, 8:00 AM

Aug 4 2017

truckman committed rP447311: Upgrade py-pymtb to version 0.4.1:.
Upgrade py-pymtb to version 0.4.1:
Aug 4 2017, 12:38 AM
truckman committed rP447310: Update distinfo TIMESTAMP..
Update distinfo TIMESTAMP.
Aug 4 2017, 12:32 AM
truckman committed rP447306: Upgrade mtbl to version 1.1.1:.
Upgrade mtbl to version 1.1.1:
Aug 4 2017, 12:14 AM

Aug 2 2017

truckman accepted D11808: Keep top page on CloudABI to work around AMD Ryzen stability issues..
Aug 2 2017, 2:11 AM
truckman committed rS321899: Lower the amd64 shared page, which contains the signal trampoline,.
Lower the amd64 shared page, which contains the signal trampoline,
Aug 2 2017, 1:43 AM
truckman closed D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space by committing rS321899: Lower the amd64 shared page, which contains the signal trampoline,.
Aug 2 2017, 1:43 AM

Aug 1 2017

truckman updated the diff for D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

Lower sv_maxuser as well to prevent a user from mapping and loading
code into the page at 0x7ffffffff000. Executing code there can cause
the system to hang or silently reboot.

Aug 1 2017, 4:14 PM
truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

I just tried an experiment where I mapped the page at 0x7ffffffff000 and loaded it with some trivial code. I was able to execute that code once just fine, but if I loop on it so that the process spends most of its time executing code from that page, I get a nearly instant reboot.

Aug 1 2017, 3:27 PM

Jul 31 2017

truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.
In D11780#244444, @ed wrote:

Don, thanks for pointing me to this discussion!

In our case shared pages tend to reside at those addresses, but doesn't this problem apply to simply any mapping there? As in, even if you would lower the mapping of the shared page, people could still use mmap() to place a page at the very top and exploit this issue, right? In other words, shouldn't we lower VM_MAXUSER_ADDRESS instead?

Right now VM_MAXUSER_ADDRESS is assumed to be a constant, so lowering that is going to be annoying. That said, is it really worth the trouble distinguishing its value based on the CPU that's currently in use? I personally wouldn't mind to lose a single page of virtual memory.

Jul 31 2017, 4:55 AM

Jul 30 2017

truckman updated the diff for D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

Update patch for linux change r321728.

Jul 30 2017, 10:38 PM
truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

cloudabi doesn't appear to use the shared page.

Jul 30 2017, 10:25 PM
truckman updated the diff for D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

Add the amd64_lower_shared_page() prototype to md_var.h.

Jul 30 2017, 8:59 PM
truckman added inline comments to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.
Jul 30 2017, 8:37 PM
truckman added inline comments to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.
Jul 30 2017, 8:05 PM
truckman updated the diff for D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

Renamed elf64_freebsd_sysentvec_fixup() to amd64_lower_shared_page(),
changed it to use decrements, and reused it in the Linux code. Where
should its prototype be declared?

Jul 30 2017, 8:03 PM
truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

I can't say that I'm enthusiastic about putting the fixup function in initcpu.c and polluting it with <sys/syent.h> stuff. All of the other code in this file pretty much sticks to poking at the CPU itself.

Jul 30 2017, 7:33 PM
truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

One thing that I like about the way the tunable works is that the mode is auto if it is unset by the loader. Setting it in the loader forces the chosen mode. The sysctl value reflects the actual mode chosen by the combination of the tunable and the cpuid test.

Jul 30 2017, 6:48 PM
truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

About my inline comment,the patch was working, but I was really puzzled by why the trampoline address was changing by more than PAGE_SIZE. Even when I used the tunable to disable lowering of the shared page (and even commented out the code that did the adjustment), the lower bits of the trampoline address were going from 0x190 to 0x000. The behavior depended on whether or not the new SYSINIT was present in the code. It took me quite a while, but I eventually figured out that adding the new SYSINIT was perturbing the ordering of the other SYSINITs. In the original code, the 32-bit sysvec was getting initialized first, so the 32-bit stuff would get loaded into the start of the shared page. When a new SYSINIT is added, the 64-bit sysvec is initialized first and the 64-bit trampoline is the first item in the shared page.

Jul 30 2017, 6:42 PM
truckman added a comment to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.

The IS_BSP() check isn't sufficient because that code fragment also gets executed on resume and everything would get decremented again.

Jul 30 2017, 4:21 PM
truckman added inline comments to D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.
Jul 30 2017, 3:59 AM
truckman created D11780: Lower shared page for amd64 on Ryzen to work around bug with code near top of user space.
Jul 30 2017, 3:50 AM

Jul 22 2017

truckman committed rP446366: Include <complex> instead of the obsolete <boost/tr1/complex.hpp>. The.
Include <complex> instead of the obsolete <boost/tr1/complex.hpp>. The
Jul 22 2017, 3:50 AM

Jun 30 2017

truckman committed rP444702: Upgrade net/axa to version 1.6.0:.
Upgrade net/axa to version 1.6.0:
Jun 30 2017, 7:50 AM

Jun 14 2017

truckman committed rP443597: Upgrade devel/mtbl to version 1.1.0:.
Upgrade devel/mtbl to version 1.1.0:
Jun 14 2017, 7:01 PM

May 25 2017

truckman committed rS318905: MFC r318527.
MFC r318527
May 25 2017, 10:41 PM
truckman committed rS318904: MFC r318527.
MFC r318527
May 25 2017, 10:40 PM
truckman committed rS318886: MFC r318511.
MFC r318511
May 25 2017, 5:23 PM
truckman committed rS318885: MFC r318511.
MFC r318511
May 25 2017, 5:22 PM

May 24 2017

truckman added a comment to D10799: lang/rust: Update for ino64.

I just got a failure with this patch on 12.0-CURRENT r318776 amd64.

May 24 2017, 8:34 PM

May 19 2017

truckman committed rS318527: Fix the queue delay estimation in PIE/FQ-PIE when the timestamp.
Fix the queue delay estimation in PIE/FQ-PIE when the timestamp
May 19 2017, 8:38 AM
truckman committed rS318511: The result of right shifting a negative signed value is implementation.
The result of right shifting a negative signed value is implementation
May 19 2017, 1:23 AM

May 3 2017

truckman committed rP440025: Upgrade net/axa to version 1.5.1.
Upgrade net/axa to version 1.5.1
May 3 2017, 5:22 PM

Apr 28 2017

truckman committed rP439675: Upgrade fstrm to version 0.3.2:.
Upgrade fstrm to version 0.3.2:
Apr 28 2017, 9:01 PM

Apr 27 2017

truckman committed rS317489: MFC r316777 (by cem).
MFC r316777 (by cem)
Apr 27 2017, 7:32 AM
truckman committed rS317488: MFC r316777 (by cem).
MFC r316777 (by cem)
Apr 27 2017, 7:30 AM

Apr 4 2017

truckman added a comment to D9759: amdtemp driver update.

On

CPU: AMD Ryzen 7 1700X Eight-Core Processor          (3393.69-MHz K8-class CPU)

I get the following results:

sysctl dev.amdtemp

dev.amdtemp.0.rtc.sensor_offset: 0
dev.amdtemp.0.rtc.PerStepTimeUp: 0
dev.amdtemp.0.rtc.PerStepTimeDn: 0
dev.amdtemp.0.rtc.TmpMaxDiffUp: 0
dev.amdtemp.0.rtc.TmpSlewDnEn: 0
dev.amdtemp.0.rtc.CurTmpTjSel: -49.0C
dev.amdtemp.0.rtc.CurTmp: 0.1C
dev.amdtemp.0.%parent: hostb10
dev.amdtemp.0.%pnpinfo:
dev.amdtemp.0.%location:
dev.amdtemp.0.%driver: amdtemp
dev.amdtemp.0.%desc: AMD CPU On-Die Thermal Sensors
dev.amdtemp.%parent:

Apr 4 2017, 6:23 AM · x86

Mar 31 2017

truckman committed rS316325: MFC r315516.
MFC r315516
Mar 31 2017, 6:34 AM
truckman committed rS316324: MFC r315516.
MFC r315516
Mar 31 2017, 6:20 AM

Mar 18 2017

truckman committed rS315516: Change several constants used by the PIE algorithm from unsigned to signed..
Change several constants used by the PIE algorithm from unsigned to signed.
Mar 18 2017, 11:00 PM

Mar 2 2017

truckman committed rP435213: Upgrade net/p5-Net-Nmsg to version 0.17:.
Upgrade net/p5-Net-Nmsg to version 0.17:
Mar 2 2017, 8:38 AM

Feb 27 2017

truckman committed rP434988: Upgrade net/nmsg to version 0.13.0:.
Upgrade net/nmsg to version 0.13.0:
Feb 27 2017, 8:50 PM

Feb 24 2017

truckman committed rP434757: Upgrade devel/fstrm to version 0.3.1:.
Upgrade devel/fstrm to version 0.3.1:
Feb 24 2017, 11:24 PM

Feb 23 2017

truckman committed rP434656: Add a note to UPDATING to about the shared library version bump of.
Add a note to UPDATING to about the shared library version bump of
Feb 23 2017, 5:11 AM
truckman committed rP434654: Upgrade devel/mtbl to version 1.0.0:.
Upgrade devel/mtbl to version 1.0.0:
Feb 23 2017, 1:54 AM

Feb 4 2017

truckman committed rP433277: Neuter liblz4 version check in configure to unbreak build after.
Neuter liblz4 version check in configure to unbreak build after
Feb 4 2017, 3:32 AM

Jan 31 2017

truckman committed rP432898: On amd64, clang++ 4.0 uses the MOVAPS SSE instruction to initialize.
On amd64, clang++ 4.0 uses the MOVAPS SSE instruction to initialize
Jan 31 2017, 3:42 AM
truckman committed rP432895: Upgrade to upstream svn revision r1780246. This incorporates the.
Upgrade to upstream svn revision r1780246. This incorporates the
Jan 31 2017, 3:25 AM

Jan 24 2017

truckman committed rP432313: Clean up the logic for setting FREEBSD_ENV_SET..
Clean up the logic for setting FREEBSD_ENV_SET.
Jan 24 2017, 6:30 AM
truckman committed rP432309: Add PowerPC64 support. [1].
Add PowerPC64 support. [1]
Jan 24 2017, 2:09 AM

Jan 4 2017

truckman committed rP430537: Upgrade dns/wdns to version 0.9.1:.
Upgrade dns/wdns to version 0.9.1:
Jan 4 2017, 4:43 AM

Dec 5 2016

truckman committed rP427833: Upgrade net/axa to version 1.4.0:.
Upgrade net/axa to version 1.4.0:
Dec 5 2016, 6:02 AM
truckman committed rP427832: Upgrade net/nmsg to version 0.12.1:.
Upgrade net/nmsg to version 0.12.1:
Dec 5 2016, 5:58 AM

Nov 15 2016

truckman committed rP426191: Upgrade axa to version 1.3.4:.
Upgrade axa to version 1.3.4:
Nov 15 2016, 11:40 PM

Oct 14 2016

truckman committed rP423951: Upgrade axa to version 1.3.3:.
Upgrade axa to version 1.3.3:
Oct 14 2016, 6:58 AM

Oct 12 2016

truckman committed rP423894: Upgrade ApacheOpenOffice to version 4.1.3..
Upgrade ApacheOpenOffice to version 4.1.3.
Oct 12 2016, 9:20 PM

Jul 26 2016

truckman committed rP419130: MFH: r418886.
MFH: r418886
Jul 26 2016, 4:49 PM

Jul 21 2016

truckman committed rP418893: MFH 2016Q3.
MFH 2016Q3
Jul 21 2016, 7:21 PM
truckman committed rP418886: Upgrade to upstream svn revision r1753426, which includes the fix for.
Upgrade to upstream svn revision r1753426, which includes the fix for
Jul 21 2016, 6:14 PM
truckman committed rP418885: Fix CVE-2016-1513 - Memory Corruption Vulnerability (Impress Presentations)..
Fix CVE-2016-1513 - Memory Corruption Vulnerability (Impress Presentations).
Jul 21 2016, 6:10 PM
truckman committed rP418884: Apache OpenOffice CVE-2016-1513 Memory Corruption Vulnerability.
Apache OpenOffice CVE-2016-1513 Memory Corruption Vulnerability
Jul 21 2016, 6:04 PM

Jul 18 2016

truckman committed rS302987: MFC r302667.
MFC r302667
Jul 18 2016, 6:10 AM

Jul 16 2016

truckman committed rS302927: MFC r302667.
MFC r302667
Jul 16 2016, 6:41 AM

Jul 12 2016

truckman committed rP418450: MFH: r418412.
MFH: r418412
Jul 12 2016, 10:08 PM
truckman committed rS302667: Fix problems in the FQ-PIE AQM cleanup code that could leak memory or.
Fix problems in the FQ-PIE AQM cleanup code that could leak memory or
Jul 12 2016, 5:32 PM
truckman closed D7174: Dummynet FQ-PIE AQM: Fix potential race conditions in stopping callout and freeing the allocated memory by committing rS302667: Fix problems in the FQ-PIE AQM cleanup code that could leak memory or.
Jul 12 2016, 5:32 PM
truckman accepted D7174: Dummynet FQ-PIE AQM: Fix potential race conditions in stopping callout and freeing the allocated memory.

Looks fine to me.

Jul 12 2016, 5:11 PM
truckman committed rP418412: Add missing dependencies reported by stage-qa:.
Add missing dependencies reported by stage-qa:
Jul 12 2016, 3:24 AM

Jul 8 2016

truckman committed rS302422: MFC r302338.
MFC r302338
Jul 8 2016, 2:53 AM

Jul 6 2016

truckman committed rS302377: MFC r300547.
MFC r300547
Jul 6 2016, 5:45 PM
truckman committed rS302376: MFC r299371 (by trasz).
MFC r299371 (by trasz)
Jul 6 2016, 5:42 PM

Jul 5 2016

truckman added a comment to D6928: Dummynet PIE AQM: Fix kernel panic due to a race condition in callout.

Should I remove DN_BH_WLOCK()/DN_BH_WUNLOCK() and use atomic_add_int() instead?
Is the patch reasonable now?

Jul 5 2016, 1:44 AM
truckman committed rS302338: Fix a race condition between the main thread in aqm_pie_cleanup() and the.
Fix a race condition between the main thread in aqm_pie_cleanup() and the
Jul 5 2016, 1:28 AM
truckman closed D6928: Dummynet PIE AQM: Fix kernel panic due to a race condition in callout by committing rS302338: Fix a race condition between the main thread in aqm_pie_cleanup() and the.
Jul 5 2016, 1:28 AM

Jul 4 2016

truckman accepted D6928: Dummynet PIE AQM: Fix kernel panic due to a race condition in callout.

Sorry if my thought is incorrect but just to explain my idea of using DN_BH_WLOCK():
1- ref_count (namely pie_desc.ref_count) is updated only by PIE module and checked (read access) by unload_dn_sched() in ip_dummynet.c.
2- ref_count in unload_dn_sched() is accessed with DN_BH_WLOCK()
3- ref_count in PIE module is updated when DN_BH_WLOCK() is held (either explicitly by calling DN_BH_WLOCK() in PIE module or implicitly by Dummynet somewhere before call PIE functions.
So, is the lock I added still isn't sufficient?
Anyway, using atomic_add_int() is much easier than dealing with deadlocks ;-)

Regarding the "a small race that remains", I agree with you, this race could happen. However, changing Dummynet lock type is out of my knowledge.

Jul 4 2016, 5:32 AM
truckman added a comment to D6928: Dummynet PIE AQM: Fix kernel panic due to a race condition in callout.

If PIE ref_count is decremented by the user thread after callout_reset_sbt(), how we guarantee that pie_callout_cleanup() finished its execution?

Jul 4 2016, 1:50 AM