Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/subr_localcount.c
RevisionDateAuthorComments
 1.8  16-Aug-2024  riastradh localcount: Update per-CPU total at splhigh.

Otherwise localcount_acquire/release in interrupt context may lose
counts.

Duration spent at splhigh is very short.

PR kern/58610: localcount(9) races with interrupts
 1.7  17-Nov-2017  ozaki-r branches: 1.7.2; 1.7.10; 1.7.36;
Implement a debugging facility (overflow/underflow detection) for localcount

We cannot get an accurate count from a localcount instance because it consists
of per-cpu counters and we have no way to sum them up atomically. So we cannot
detect counter overflow/underflow as we can do on a normal refcount.

The facility adds an atomic counter to each localcount instance to enable the
validations. The counter ups and downs in synchronization with the per-CPU
counters. The counter is used iff both DEBUG and LOCKDEBUG are enabled in the
kernel.

Discussed on tech-kern@
 1.6  12-Jun-2017  riastradh branches: 1.6.4;
Add heading comment for private localcount_adjust subroutine.
 1.5  12-Jun-2017  riastradh Move forward declaration to top of file.

Keep header comment above localcount_init adjoined to it.

No functional change.
 1.4  02-Jun-2017  chs branches: 1.4.2;
localcount_init() can't fail because percpu_alloc() can't fail.
remove the check and change the return type to void.
 1.3  19-May-2017  pgoyette Fix a comment - in localcount_fini(), we don't care whether it was the
caller or some other code that drained the localcount; all we care is
that it has been drained.
 1.2  19-May-2017  pgoyette Introduce new localcount(9) reference-count primitives.
 1.1  15-Jul-2016  pgoyette branches: 1.1.2; 1.1.6;
file subr_localcount.c was initially added on branch pgoyette-localcount.
 1.1.6.5  12-May-2017  pgoyette When we're draining the localcount's references, transfer the local
CPU's reference count to the global total, and then zero it. Any
further calls to localcount_release() will adjust only the global
counter.

Avoids a race condition which depends on having localcount_release()
being aware of whether the local CPU's contribution has already been
accounted for. Thanks to Kengo NAKAHARA for bringing up the question,
and to riastradh@ for the solution.
 1.1.6.4  11-May-2017  pgoyette Use kpreempt_{dis,en}able() rather than splsoftserial() for blocking
the local execution of the low-priority xcall.

Thanks to Kengo NAKAHARA for pointing this out.
 1.1.6.3  02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.1.6.2  30-Apr-2017  pgoyette Introduce mutex_ownable(9) and use it in localcount_release(9).

Commit of same code to head is awaiting discussion on tech-kern.
 1.1.6.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.1.2.1  15-Jul-2016  pgoyette Initial import of localcount(9) as proposed by riastradh@

This version compiles, but nothing uses it, yet.
 1.4.2.1  30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #404):
sys/sys/localcount.h: revision 1.5
sys/kern/subr_localcount.c: revision 1.7
Implement a debugging facility (overflow/underflow detection) for localcount
We cannot get an accurate count from a localcount instance because it consists
of per-cpu counters and we have no way to sum them up atomically. So we cannot
detect counter overflow/underflow as we can do on a normal refcount.
The facility adds an atomic counter to each localcount instance to enable the
validations. The counter ups and downs in synchronization with the per-CPU
counters. The counter is used iff both DEBUG and LOCKDEBUG are enabled in the
kernel.
Discussed on tech-kern@
 1.6.4.2  28-Aug-2017  skrll Sync with HEAD
 1.6.4.1  12-Jun-2017  skrll file subr_localcount.c was added on branch nick-nhusb on 2017-08-28 17:53:07 +0000
 1.7.36.1  11-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #829):

sys/kern/subr_localcount.c: revision 1.8

localcount: Update per-CPU total at splhigh.

Otherwise localcount_acquire/release in interrupt context may lose
counts.

Duration spent at splhigh is very short.
PR kern/58610: localcount(9) races with interrupts
 1.7.10.1  13-Sep-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1888):

sys/kern/subr_localcount.c: revision 1.8

localcount: Update per-CPU total at splhigh.
Otherwise localcount_acquire/release in interrupt context may lose
counts.

Duration spent at splhigh is very short.

PR kern/58610: localcount(9) races with interrupts
 1.7.2.2  03-Dec-2017  jdolecek update from HEAD
 1.7.2.1  17-Nov-2017  jdolecek file subr_localcount.c was added on branch tls-maxphys on 2017-12-03 11:38:45 +0000

RSS XML Feed