timekeeping: Use proper clock specifier names in functions
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 21 Jun 2019 20:32:48 +0000 (22:32 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 22 Jun 2019 10:11:27 +0000 (12:11 +0200)
This makes boot uniformly boottime and tai uniformly clocktai, to
address the remaining oversights.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lkml.kernel.org/r/20190621203249.3909-2-Jason@zx2c4.com
22 files changed:
Documentation/core-api/timekeeping.rst
arch/x86/kvm/pmu.c
arch/x86/kvm/x86.c
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
drivers/iio/humidity/dht11.c
drivers/iio/industrialio-core.c
drivers/infiniband/hw/mlx4/alias_GUID.c
drivers/leds/trigger/ledtrig-activity.c
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c
drivers/net/wireless/intel/iwlwifi/mvm/rx.c
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/ti/wlcore/main.c
drivers/net/wireless/ti/wlcore/rx.c
drivers/net/wireless/ti/wlcore/tx.c
drivers/net/wireless/virt_wifi.c
include/linux/timekeeping.h
include/net/cfg80211.h
kernel/bpf/syscall.c
kernel/events/core.c
kernel/fork.c

index 93cbeb9daec075dde5dc4eb63ee1e7ee6e21a544..4d92b1ac8024a19dfdfb14240eab0dbd6b1c9d76 100644 (file)
@@ -65,7 +65,7 @@ different format depending on what is required by the user:
 .. c:function:: u64 ktime_get_ns( void )
                u64 ktime_get_boottime_ns( void )
                u64 ktime_get_real_ns( void )
-               u64 ktime_get_tai_ns( void )
+               u64 ktime_get_clocktai_ns( void )
                u64 ktime_get_raw_ns( void )
 
        Same as the plain ktime_get functions, but returning a u64 number
index dd745b58ffd8a2f22115073f7790b98cf2e40c94..1aea628ef6b8a1495cb05a0ff9cab3c013e6d075 100644 (file)
@@ -264,10 +264,10 @@ static int kvm_pmu_rdpmc_vmware(struct kvm_vcpu *vcpu, unsigned idx, u64 *data)
                ctr_val = rdtsc();
                break;
        case VMWARE_BACKDOOR_PMC_REAL_TIME:
-               ctr_val = ktime_get_boot_ns();
+               ctr_val = ktime_get_boottime_ns();
                break;
        case VMWARE_BACKDOOR_PMC_APPARENT_TIME:
-               ctr_val = ktime_get_boot_ns() +
+               ctr_val = ktime_get_boottime_ns() +
                        vcpu->kvm->arch.kvmclock_offset;
                break;
        default:
index 83aefd759846e1942066e53b016e420fd39d8a7d..81a0914a1ec1e05ae10881ec6f3656115522d6df 100644 (file)
@@ -1731,7 +1731,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
 
        raw_spin_lock_irqsave(&kvm->arch.tsc_write_lock, flags);
        offset = kvm_compute_tsc_offset(vcpu, data);
-       ns = ktime_get_boot_ns();
+       ns = ktime_get_boottime_ns();
        elapsed = ns - kvm->arch.last_tsc_nsec;
 
        if (vcpu->arch.virtual_tsc_khz) {
@@ -2073,7 +2073,7 @@ u64 get_kvmclock_ns(struct kvm *kvm)
        spin_lock(&ka->pvclock_gtod_sync_lock);
        if (!ka->use_master_clock) {
                spin_unlock(&ka->pvclock_gtod_sync_lock);
-               return ktime_get_boot_ns() + ka->kvmclock_offset;
+               return ktime_get_boottime_ns() + ka->kvmclock_offset;
        }
 
        hv_clock.tsc_timestamp = ka->master_cycle_now;
@@ -2089,7 +2089,7 @@ u64 get_kvmclock_ns(struct kvm *kvm)
                                   &hv_clock.tsc_to_system_mul);
                ret = __pvclock_read_cycles(&hv_clock, rdtsc());
        } else
-               ret = ktime_get_boot_ns() + ka->kvmclock_offset;
+               ret = ktime_get_boottime_ns() + ka->kvmclock_offset;
 
        put_cpu();
 
@@ -2188,7 +2188,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
        }
        if (!use_master_clock) {
                host_tsc = rdtsc();
-               kernel_ns = ktime_get_boot_ns();
+               kernel_ns = ktime_get_boottime_ns();
        }
 
        tsc_timestamp = kvm_read_l1_tsc(v, host_tsc);
@@ -9018,7 +9018,7 @@ int kvm_arch_hardware_enable(void)
         * before any KVM threads can be running.  Unfortunately, we can't
         * bring the TSCs fully up to date with real time, as we aren't yet far
         * enough into CPU bringup that we know how much real time has actually
-        * elapsed; our helper function, ktime_get_boot_ns() will be using boot
+        * elapsed; our helper function, ktime_get_boottime_ns() will be using boot
         * variables that haven't been updated yet.
         *
         * So we simply find the maximum observed TSC above, then record the
@@ -9246,7 +9246,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
        mutex_init(&kvm->arch.apic_map_lock);
        spin_lock_init(&kvm->arch.pvclock_gtod_sync_lock);
 
-       kvm->arch.kvmclock_offset = -ktime_get_boot_ns();
+       kvm->arch.kvmclock_offset = -ktime_get_boottime_ns();
        pvclock_update_vm_gtod_copy(kvm);
 
        kvm->arch.guest_can_read_msr_platform_info = true;
index 083bd8114db1bb8d4950b3856fa224e44e21a76f..dd6b4b0b5f304ba5f09172246b3d9cdcd3696d30 100644 (file)
@@ -837,7 +837,7 @@ static int kfd_ioctl_get_clock_counters(struct file *filep,
 
        /* No access to rdtsc. Using raw monotonic time */
        args->cpu_clock_counter = ktime_get_raw_ns();
-       args->system_clock_counter = ktime_get_boot_ns();
+       args->system_clock_counter = ktime_get_boottime_ns();
 
        /* Since the counter is in nano-seconds we use 1GHz frequency */
        args->system_clock_freq = 1000000000;
index c8159205c77de5e2963856a86ec7544e89cfd995..4e22b3c3e488e65a3f3d34188d48019e77c5045d 100644 (file)
@@ -149,7 +149,7 @@ static int dht11_decode(struct dht11 *dht11, int offset)
                return -EIO;
        }
 
-       dht11->timestamp = ktime_get_boot_ns();
+       dht11->timestamp = ktime_get_boottime_ns();
        if (hum_int < 4) {  /* DHT22: 100000 = (3*256+232)*100 */
                dht11->temperature = (((temp_int & 0x7f) << 8) + temp_dec) *
                                        ((temp_int & 0x80) ? -100 : 100);
@@ -177,7 +177,7 @@ static irqreturn_t dht11_handle_irq(int irq, void *data)
 
        /* TODO: Consider making the handler safe for IRQ sharing */
        if (dht11->num_edges < DHT11_EDGES_PER_READ && dht11->num_edges >= 0) {
-               dht11->edges[dht11->num_edges].ts = ktime_get_boot_ns();
+               dht11->edges[dht11->num_edges].ts = ktime_get_boottime_ns();
                dht11->edges[dht11->num_edges++].value =
                                                gpio_get_value(dht11->gpio);
 
@@ -196,7 +196,7 @@ static int dht11_read_raw(struct iio_dev *iio_dev,
        int ret, timeres, offset;
 
        mutex_lock(&dht11->lock);
-       if (dht11->timestamp + DHT11_DATA_VALID_TIME < ktime_get_boot_ns()) {
+       if (dht11->timestamp + DHT11_DATA_VALID_TIME < ktime_get_boottime_ns()) {
                timeres = ktime_get_resolution_ns();
                dev_dbg(dht11->dev, "current timeresolution: %dns\n", timeres);
                if (timeres > DHT11_MIN_TIMERES) {
@@ -322,7 +322,7 @@ static int dht11_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       dht11->timestamp = ktime_get_boot_ns() - DHT11_DATA_VALID_TIME - 1;
+       dht11->timestamp = ktime_get_boottime_ns() - DHT11_DATA_VALID_TIME - 1;
        dht11->num_edges = -1;
 
        platform_set_drvdata(pdev, iio);
index f5a4581302f48413738c11805d7adb41cd44df60..16008f862d196821cf38d994841251bb3d0b9aa9 100644 (file)
@@ -231,9 +231,9 @@ s64 iio_get_time_ns(const struct iio_dev *indio_dev)
                ktime_get_coarse_ts64(&tp);
                return timespec64_to_ns(&tp);
        case CLOCK_BOOTTIME:
-               return ktime_get_boot_ns();
+               return ktime_get_boottime_ns();
        case CLOCK_TAI:
-               return ktime_get_tai_ns();
+               return ktime_get_clocktai_ns();
        default:
                BUG();
        }
index 2a0b59a4b6ebc3c34ff9ff3308af7e337d2001f3..cca414ecfcd5a0d31f179343f99da0da2aeeb6d9 100644 (file)
@@ -310,7 +310,7 @@ static void aliasguid_query_handler(int status,
        if (status) {
                pr_debug("(port: %d) failed: status = %d\n",
                         cb_ctx->port, status);
-               rec->time_to_run = ktime_get_boot_ns() + 1 * NSEC_PER_SEC;
+               rec->time_to_run = ktime_get_boottime_ns() + 1 * NSEC_PER_SEC;
                goto out;
        }
 
@@ -416,7 +416,7 @@ next_entry:
                         be64_to_cpu((__force __be64)rec->guid_indexes),
                         be64_to_cpu((__force __be64)applied_guid_indexes),
                         be64_to_cpu((__force __be64)declined_guid_indexes));
-               rec->time_to_run = ktime_get_boot_ns() +
+               rec->time_to_run = ktime_get_boottime_ns() +
                        resched_delay_sec * NSEC_PER_SEC;
        } else {
                rec->status = MLX4_GUID_INFO_STATUS_SET;
@@ -709,7 +709,7 @@ static int get_low_record_time_index(struct mlx4_ib_dev *dev, u8 port,
                }
        }
        if (resched_delay_sec) {
-               u64 curr_time = ktime_get_boot_ns();
+               u64 curr_time = ktime_get_boottime_ns();
 
                *resched_delay_sec = (low_record_time < curr_time) ? 0 :
                        div_u64((low_record_time - curr_time), NSEC_PER_SEC);
index bcbf41c90c30dbe17e31d57d3035c95871ab7c50..0f130dd998b36872218a2465487b6dad2e4e691c 100644 (file)
@@ -73,7 +73,7 @@ static void led_activity_function(struct timer_list *t)
         * down to 16us, ensuring we won't overflow 32-bit computations below
         * even up to 3k CPUs, while keeping divides cheap on smaller systems.
         */
-       curr_boot = ktime_get_boot_ns() * cpus;
+       curr_boot = ktime_get_boottime_ns() * cpus;
        diff_boot = (curr_boot - activity_data->last_boot) >> 16;
        diff_used = (curr_used - activity_data->last_used) >> 16;
        activity_data->last_boot = curr_boot;
index fec38a47696e05d739b373748f92e813371b6f88..9f4b117db9d7f3c2fb3bbd1f25f220617eefa727 100644 (file)
@@ -93,7 +93,7 @@ void iwl_mvm_ftm_restart(struct iwl_mvm *mvm)
        struct cfg80211_pmsr_result result = {
                .status = NL80211_PMSR_STATUS_FAILURE,
                .final = 1,
-               .host_time = ktime_get_boot_ns(),
+               .host_time = ktime_get_boottime_ns(),
                .type = NL80211_PMSR_TYPE_FTM,
        };
        int i;
index fbd3014e8b82b25edda2300f302a3ae3d6c24673..160b0db27103140fe2550778a36d331300f4e55d 100644 (file)
@@ -555,7 +555,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
 
        if (unlikely(ieee80211_is_beacon(hdr->frame_control) ||
                     ieee80211_is_probe_resp(hdr->frame_control)))
-               rx_status->boottime_ns = ktime_get_boot_ns();
+               rx_status->boottime_ns = ktime_get_boottime_ns();
 
        /* Take a reference briefly to kick off a d0i3 entry delay so
         * we can handle bursts of RX packets without toggling the
index 1824566d08fc79eb61a11f35b65380a78294b140..64f95050128770cae30a2871f1a3c717b95d7cf8 100644 (file)
@@ -1684,7 +1684,7 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
 
                if (unlikely(ieee80211_is_beacon(hdr->frame_control) ||
                             ieee80211_is_probe_resp(hdr->frame_control)))
-                       rx_status->boottime_ns = ktime_get_boot_ns();
+                       rx_status->boottime_ns = ktime_get_boottime_ns();
        }
 
        if (iwl_mvm_create_skb(mvm, skb, hdr, len, crypt_len, rxb)) {
index b9914efc55c4b2f027db3954877645c4b7c27fb0..724a25ab32f24f6cdf499695d37e2597fb819d00 100644 (file)
@@ -1443,7 +1443,7 @@ void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime)
        }
 
        *gp2 = iwl_mvm_get_systime(mvm);
-       *boottime = ktime_get_boot_ns();
+       *boottime = ktime_get_boottime_ns();
 
        if (!ps_disabled) {
                mvm->ps_disabled = ps_disabled;
index 60ca13e0f15b7b02aca1e425f8a971555ac172e3..52ee165d6f1d6764c2b9df03f4e2e807c02a04af 100644 (file)
@@ -1274,7 +1274,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
         */
        if (ieee80211_is_beacon(hdr->frame_control) ||
            ieee80211_is_probe_resp(hdr->frame_control)) {
-               rx_status.boottime_ns = ktime_get_boot_ns();
+               rx_status.boottime_ns = ktime_get_boottime_ns();
                now = data->abs_bcn_ts;
        } else {
                now = mac80211_hwsim_get_tsf_raw();
index c9a485ecee7bb52b59b9a3675e069c5382b026cb..b74dc8bc97553dc70d48d427ff55b5258284c729 100644 (file)
@@ -483,7 +483,7 @@ static int wlcore_fw_status(struct wl1271 *wl, struct wl_fw_status *status)
        }
 
        /* update the host-chipset time offset */
-       wl->time_offset = (ktime_get_boot_ns() >> 10) -
+       wl->time_offset = (ktime_get_boottime_ns() >> 10) -
                (s64)(status->fw_localtime);
 
        wl->fw_fast_lnk_map = status->link_fast_bitmap;
index d96bb602fae66b660b4523c517e4e16c9cac8fd2..307fab21050b74e9081d96dbdca641fe2cb28abe 100644 (file)
@@ -93,7 +93,7 @@ static void wl1271_rx_status(struct wl1271 *wl,
        }
 
        if (beacon || probe_rsp)
-               status->boottime_ns = ktime_get_boot_ns();
+               status->boottime_ns = ktime_get_boottime_ns();
 
        if (beacon)
                wlcore_set_pending_regdomain_ch(wl, (u16)desc->channel,
index 057c6be330e77497e9944d3efd283cb29d48e2f8..90e56d4c3df3bfa37ff811b3149c6a10ea11bd76 100644 (file)
@@ -273,7 +273,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif,
        }
 
        /* configure packet life time */
-       hosttime = (ktime_get_boot_ns() >> 10);
+       hosttime = (ktime_get_boottime_ns() >> 10);
        desc->start_time = cpu_to_le32(hosttime - wl->time_offset);
 
        is_dummy = wl12xx_is_dummy_packet(wl, skb);
index 606999f102ebf9d1a3b02645fceefa7a353339c0..be92e1220284c7d07d2b8143f5b8084e1d9375da 100644 (file)
@@ -172,7 +172,7 @@ static void virt_wifi_scan_result(struct work_struct *work)
        informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz,
                                           CFG80211_BSS_FTYPE_PRESP,
                                           fake_router_bssid,
-                                          ktime_get_boot_ns(),
+                                          ktime_get_boottime_ns(),
                                           WLAN_CAPABILITY_ESS, 0,
                                           (void *)&ssid, sizeof(ssid),
                                           DBM_TO_MBM(-50), GFP_KERNEL);
index a8ab0f143ac45df8009693e476d62d2be38d247e..fd6123722ea80ea1d8cce517335cb826ea07d353 100644 (file)
@@ -131,12 +131,12 @@ static inline u64 ktime_get_real_ns(void)
        return ktime_to_ns(ktime_get_real());
 }
 
-static inline u64 ktime_get_boot_ns(void)
+static inline u64 ktime_get_boottime_ns(void)
 {
        return ktime_to_ns(ktime_get_boottime());
 }
 
-static inline u64 ktime_get_tai_ns(void)
+static inline u64 ktime_get_clocktai_ns(void)
 {
        return ktime_to_ns(ktime_get_clocktai());
 }
index 87dae868707e2a7fb92e483651c4e6cb2a524011..f8058e92f59d730e2dacc5405badd7efc1f70e7d 100644 (file)
@@ -2010,7 +2010,7 @@ enum cfg80211_signal_type {
  *     received by the device (not just by the host, in case it was
  *     buffered on the device) and be accurate to about 10ms.
  *     If the frame isn't buffered, just passing the return value of
- *     ktime_get_boot_ns() is likely appropriate.
+ *     ktime_get_boottime_ns() is likely appropriate.
  * @parent_tsf: the time at the start of reception of the first octet of the
  *     timestamp field of the frame. The time is the TSF of the BSS specified
  *     by %parent_bssid.
index ef63d26622f2f58561c09c0760310da40ce11671..96c8928b468b17908a840eaf51076565689bed22 100644 (file)
@@ -1666,7 +1666,7 @@ static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr)
        if (err < 0)
                goto free_prog;
 
-       prog->aux->load_time = ktime_get_boot_ns();
+       prog->aux->load_time = ktime_get_boottime_ns();
        err = bpf_obj_name_cpy(prog->aux->name, attr->prog_name);
        if (err)
                goto free_prog;
index abbd4b3b96c2a2a1a75dde8b1640b0b286e7c344..e2d014395fc6d3d5dc40cf8d78c6903bc8ba1813 100644 (file)
@@ -10680,11 +10680,11 @@ static int perf_event_set_clock(struct perf_event *event, clockid_t clk_id)
                break;
 
        case CLOCK_BOOTTIME:
-               event->clock = &ktime_get_boot_ns;
+               event->clock = &ktime_get_boottime_ns;
                break;
 
        case CLOCK_TAI:
-               event->clock = &ktime_get_tai_ns;
+               event->clock = &ktime_get_clocktai_ns;
                break;
 
        default:
index 75675b9bf6dfd36066336c384e007de312f54004..4722f1a320bf3d5a1b8e9b384476222ddce56230 100644 (file)
@@ -2139,7 +2139,7 @@ static __latent_entropy struct task_struct *copy_process(
         */
 
        p->start_time = ktime_get_ns();
-       p->real_start_time = ktime_get_boot_ns();
+       p->real_start_time = ktime_get_boottime_ns();
 
        /*
         * Make it visible to the rest of the system, but dont wake it up yet.