freebsd-dev/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 Get rid of the _NO_NAMESPACE_POLLUTION kludge by creating an 2009-09-08 20:45:40 +00:00
_bus.h
_inttypes.h The NetBSD Foundation has granted permission to remove clause 3 and 4 from 2010-03-03 17:55:51 +00:00
_limits.h Fix types of some values in machine/_limits.h. 2011-01-08 11:13:34 +00:00
_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 When compiling with profiling, we define PROF for userspace and GPROF 2010-07-01 00:30:35 +00:00
atomic.h
bootinfo.h Use the new arch_loadaddr I/F to align ELF objects to PBVM page 2011-04-03 23:49:20 +00:00
bus_dma.h Switch ia64 to the unified busdma implementation. 2010-07-07 02:16:47 +00:00
bus.h Revert r216134. This checkin broke platforms where bus_space are macros: 2010-12-03 07:09:23 +00:00
clock.h Revamp the interrupt code based on the previous commit: 2010-03-17 00:37:15 +00:00
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 Rename disable_intr() to ia64_disable_intr() and rename enable_intr() 2010-03-26 21:22:02 +00:00
db_machdep.h
dig64.h
efi.h Add a few more helper functions for working with memory descriptors: 2011-07-16 19:56:07 +00:00
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 Don't include <machine/_regset.h> when _MACHINE_REGSET_H_ in defined. 2010-03-21 22:33:09 +00:00
gdb_machdep.h
ia64_cpu.h Properly serialize the global shootdown with the instruction 2011-06-17 04:26:03 +00:00
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 Implement interrupt to CPU binding. Assign interrupts to CPUs in a 2010-03-27 05:40:50 +00:00
intrcnt.h Revamp the interrupt code based on the previous commit: 2010-03-17 00:37:15 +00:00
iodev.h - Extract the IODEV_PIO interface from ia64 and make it MI. 2010-04-28 15:38:01 +00:00
kdb.h Define struct pcpu_md as the only MD field of struct pcpu (pc_acpi_id 2009-12-07 06:41:27 +00:00
limits.h
mca.h Allocate and setup an interrupt vector for corrected machine checks. 2010-07-03 20:19:20 +00:00
md_var.h Move PCPU initialization to a new function called cpu_pcpu_setup(). 2012-07-08 18:00:22 +00:00
memdev.h Add reader/writer lock around mem_range_attr_get() and mem_range_attr_set(). 2011-01-17 22:58:28 +00:00
pal.h Fix switching to physical mode as part of calling into EFI runtime 2011-03-21 18:20:53 +00:00
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 Some code cleanups: 2010-02-14 17:03:20 +00:00
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 While functions are ideally aligned to a 32-byte boundary, don't 2010-06-30 22:29:02 +00:00
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 Switch to C99 exact-width types. 2010-05-19 00:23:10 +00:00
sal.h Use an unbuffered transmit function for low-level console output. 2010-07-07 04:06:38 +00:00
setjmp.h
sf_buf.h Implement basic support for memory attributes. At this time we only 2011-07-08 16:30:54 +00:00
sigframe.h
signal.h
smp.h Switch to the event timers infrastructure. This includes: 2011-06-25 02:15:14 +00:00
stdarg.h
sysarch.h Use io(4) for I/O port access on ia64, rather than through sysarch(2). 2010-01-11 18:10:13 +00:00
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 Add support to the virtual memory system for configuring machine- 2009-07-12 23:31:20 +00:00
vmparam.h Rename VM_NDOMAIN into MAXMEMDOM and move it into machine/param.h in 2013-05-07 22:46:24 +00:00