CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2020/06/24 16:03:45

Modified files:
        sys/arch/i386/i386: apm.c 
        sys/arch/loongson/dev: apm.c 
        sys/arch/sparc64/sparc64: intr.c 
        sys/crypto     : idgen.c 
        sys/dev/pci/drm/include/linux: timekeeping.h 
        sys/dev/pv     : vmmci.c vmt.c 
        sys/dev/acpi   : acpi.c 
        sys/dev/gpio   : gpiodcf.c 
        sys/dev/ic     : wd33c93.c aac.c ncr53c9x.c 
        sys/dev/pci    : mfii.c 
        sys/dev/usb    : udcf.c 
        sys/kern       : vfs_sync.c sysv_msg.c vfs_syscalls.c sysv_shm.c 
                         sysv_sem.c 
        sys/net        : pf.c bridgectl.c if_pflow.c if_ppp.c pf_if.c 
                         rtsock.c pf_ioctl.c if_bridge.c pf_norm.c 
                         route.c pf_table.c if_pfsync.c if_bpe.c 
        sys/netinet    : ipsec_output.c if_ether.c ip_output.c 
                         ipsec_input.c ip_spd.c ip_ipsp.c 
        sys/netinet6   : ip6_id.c in6.c in6.h nd6.c ip6_forward.c 
                         ip6_mroute.c 
        sys/nfs        : nfs_subs.c nfs_vnops.c 
        sys/ufs/ext2fs : ext2fs_alloc.c ext2fs_vfsops.c 
        sys/ufs/ffs    : ffs_vfsops.c 
        sys/ufs/ufs    : ufs_quota.c inode.h 
        sys/uvm        : uvm_meter.c 

Log message:
kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)

time_second(9) and time_uptime(9) are widely used in the kernel to
quickly get the system UTC or system uptime as a time_t.  However,
time_t is 64-bit everywhere, so it is not generally safe to use them
on 32-bit platforms: you have a split-read problem if your hardware
cannot perform atomic 64-bit reads.

This patch replaces time_second(9) with gettime(9), a safer successor
interface, throughout the kernel.  Similarly, time_uptime(9) is replaced
with getuptime(9).

There is a performance cost on 32-bit platforms in exchange for
eliminating the split-read problem: instead of two register reads you
now have a lockless read loop to pull the values from the timehands.
This is really not *too* bad in the grand scheme of things, but
compared to what we were doing before it is several times slower.

There is no performance cost on 64-bit (__LP64__) platforms.

With input from visa@, dlg@, and tedu@.

Several bugs squashed by visa@.

ok kettenis@

Reply via email to