1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00
freebsd/sys/powerpc/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
..
_align.h
_bus.h
_inttypes.h
_limits.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
altivec.h
asm.h Restore proper dot symbol creation for assembly files in the kernel build case. 2012-03-04 11:55:28 +00:00
atomic.h Add a missing " to get closer to compiling. 2012-05-24 23:46:17 +00:00
bat.h Allow this file to be used in LOCORE sections of the kernel. 2012-11-12 06:15:54 +00:00
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 Move the prototype for savectx from cpu.h to pcb.h, as it is on other 2012-09-23 17:33:16 +00:00
cpufunc.h Correctly specify assembler constrains for synchronization instructions. 2012-04-22 21:55:19 +00:00
db_machdep.h
dbdma.h
elf.h Reserve AT_TIMEKEEP auxv entry for providing usermode the pointer to 2012-06-22 06:38:31 +00:00
endian.h Add casts to __uint16_t to the __bswap16() macros on all arches which 2012-03-09 20:34:31 +00:00
exec.h
fdt.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 Fix the PowerPC Book-E register definitions used by the remote GDB 2013-05-21 18:00:47 +00:00
hid.h Update HID defines for E500mc and E5500 CPU cores. 2012-05-25 21:12:24 +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_machdep.h
kdb.h
limits.h
machdep.h Extract vendor specific Book-E pieces into separate files and have a common 2012-05-30 17:34:40 +00:00
md_var.h
memdev.h
metadata.h
mmuvar.h
ofw_machdep.h
openpicreg.h
openpicvar.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 Move the prototype for savectx from cpu.h to pcb.h, as it is on other 2012-09-23 17:33:16 +00:00
pcpu.h Pad the PCPU MD struct, to satisfy an assert added with the projects/counters 2013-06-04 00:40:26 +00:00
pio.h Fix final bugs in memory barriers on PowerPC: 2012-05-04 16:00:22 +00:00
platform.h
platformvar.h Introduce PLATFORMMETHOD_END and use it. 2013-02-13 02:21:45 +00:00
pmap.h The page flag PGA_WRITEABLE is set and cleared exclusively by the pmap 2012-06-16 18:56:19 +00:00
pmc_mdep.h Add software PMC support. 2012-03-28 20:58:30 +00:00
proc.h Remove unused define. 2011-10-07 16:09:44 +00:00
profile.h Let us manage differences of Book-E PowerPC variations i.e. vendor / 2012-05-27 10:25:20 +00:00
psl.h Let us manage differences of Book-E PowerPC variations i.e. vendor / 2012-05-27 10:25:20 +00:00
pte.h Let us manage differences of Book-E PowerPC variations i.e. vendor / 2012-05-27 10:25:20 +00:00
ptrace.h
reg.h
reloc.h
resource.h
rtas.h MFpseries: 2011-06-02 14:12:37 +00:00
runq.h
sc_machdep.h
setjmp.h
sf_buf.h
sigframe.h
signal.h
slb.h The POWER7 has only 32 SLB slots instead of 64, like other supported 2011-06-02 14:25:52 +00:00
smp.h
spr.h On Nintendo Wii CPUs, the mdp value will be garbage. Set it to NULL 2012-08-21 06:34:21 +00:00
sr.h
stack.h
stdarg.h
sysarch.h
tlb.h Let us manage differences of Book-E PowerPC variations i.e. vendor / 2012-05-27 10:25:20 +00:00
trap_aim.h Allow multiple inclusion of trap.h. This has always been broken, but 2012-03-29 02:02:14 +00:00
trap_booke.h Allow multiple inclusion of trap.h. This has always been broken, but 2012-03-29 02:02:14 +00:00
trap.h Let us manage differences of Book-E PowerPC variations i.e. vendor / 2012-05-27 10:25:20 +00:00
ucontext.h Organize some members of ucontext_t in the same order they are in the 2012-04-21 14:39:47 +00:00
varargs.h
vdso.h Implement mechanism to export some kernel timekeeping data to 2012-06-22 07:06:40 +00:00
vm.h - Rename VM_MEMATTR_UNCACHED to VM_MEMATTR_WEAK_UNCACHEABLE on x86 to 2012-03-29 16:51:22 +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