freebsd-nq/sys/ia64/include
Konstantin Belousov 70a7dd5d5b Fix issues with zeroing and fetching the counters, on x86 and ppc64.
Issues were noted by Bruce Evans and are present on all architectures.

On i386, a counter fetch should use atomic read of 64bit value,
otherwise carry from the increment on other CPU could be lost for the
given fetch, making error of 2^32.  If 64bit read (cmpxchg8b) is not
available on the machine, it cannot be SMP and it is enough to disable
preemption around read to avoid the split read.

On x86 the counter increment is not atomic on purpose, which makes it
possible for the store of the incremented result to override just
zeroed per-cpu slot.  The effect would be a counter going off by
arbitrary value after zeroing.  Perform the counter zeroing on the
same processor which does the increments, making the operations
mutually exclusive.  On i386, same as for the fetching, if the
cmpxchg8b is not available, machine is not SMP and we disable
preemption for zeroing.

PowerPC64 is treated the same as amd64.

For other architectures, the changes made to allow the compilation to
succeed, without fixing the issues with zeroing or fetching.  It
should be possible to handle them by using the 64bit loads and stores
atomic WRT preemption (assuming the architectures also converted from
using critical sections to proper asm).  If architecture does not
provide the facility, using global (spin) mutex would be non-optimal
but working solution.

Noted by:  bde
Sponsored by:	The FreeBSD Foundation
2013-07-01 02:48:27 +00:00
..
pc
_align.h
_bus.h
_inttypes.h
_limits.h
_regset.h
_stdint.h Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
_types.h Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
acpica_machdep.h Move definitions required by userland applications out of acpica_machdep.h. 2013-06-27 00:22:40 +00:00
asm.h
atomic.h
bootinfo.h
bus_dma.h
bus.h
clock.h
counter.h Fix issues with zeroing and fetching the counters, on x86 and ppc64. 2013-07-01 02:48:27 +00:00
cpu.h
cpufunc.h
db_machdep.h
dig64.h
efi.h
elf.h Reserve AT_TIMEKEEP auxv entry for providing usermode the pointer to 2012-06-22 06:38:31 +00:00
endian.h
exec.h
float.h Add C11 macros describing subnormal numbers to float.h. 2012-01-23 06:36:41 +00:00
floatingpoint.h
fpu.h
frame.h
gdb_machdep.h
ia64_cpu.h
ieee.h
ieeefp.h People porting FreeBSD to new architectures ought not have to 2011-10-21 06:41:46 +00:00
in_cksum.h MFp4 bz_ipv6_fast: 2012-05-24 22:00:48 +00:00
intr.h
intrcnt.h
iodev.h
kdb.h
limits.h
mca.h
md_var.h Move PCPU initialization to a new function called cpu_pcpu_setup(). 2012-07-08 18:00:22 +00:00
memdev.h
pal.h
param.h Rename VM_NDOMAIN into MAXMEMDOM and move it into machine/param.h in 2013-05-07 22:46:24 +00:00
pcb.h Add a convenience macro for the returns_twice attribute, and apply it to 2012-04-29 11:04:31 +00:00
pci_cfgreg.h
pcpu.h Merge from projects/counters: 2013-04-08 19:19:10 +00:00
pmap.h Fix compilation on ia64 when page size is configured for 16KB. 2012-10-28 11:53:54 +00:00
pmc_mdep.h
proc.h Eliminate padding by moving 'narg' next to 'code'. Both are 32-bit 2013-02-12 17:24:41 +00:00
profile.h
pte.h
ptrace.h
reg.h Eliminate ia32_reg.h by moving its contents to x86 and ia64 reg.h. 2012-03-18 19:12:11 +00:00
reloc.h
resource.h
runq.h
sal.h
setjmp.h
sf_buf.h
sigframe.h
signal.h
smp.h
stdarg.h
sysarch.h
ucontext.h
unwind.h
varargs.h
vdso.h Implement mechanism to export some kernel timekeeping data to 2012-06-22 07:06:40 +00:00
vm.h
vmparam.h Rename VM_NDOMAIN into MAXMEMDOM and move it into machine/param.h in 2013-05-07 22:46:24 +00:00