BACKPORT: timekeeping: Use proper clock specifier names in functions
This makes boot uniformly boottime and tai uniformly clocktai, to address the remaining oversights. Change-Id: I3463b9045bddeba00d6f9fcf78d63008459c1b9a 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 Signed-off-by: Naveen <133593113+elohim-etz@users.noreply.github.com>
This commit is contained in:
@@ -1610,7 +1610,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) {
|
||||
@@ -1927,7 +1927,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;
|
||||
@@ -1943,7 +1943,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();
|
||||
|
||||
@@ -2042,7 +2042,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);
|
||||
@@ -8172,7 +8172,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
|
||||
@@ -8411,7 +8411,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
|
||||
mutex_init(&kvm->arch.hyperv.hv_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);
|
||||
|
||||
INIT_DELAYED_WORK(&kvm->arch.kvmclock_update_work, kvmclock_update_fn);
|
||||
|
||||
@@ -725,7 +725,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;
|
||||
|
||||
@@ -158,7 +158,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);
|
||||
@@ -186,7 +186,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);
|
||||
|
||||
@@ -205,7 +205,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) {
|
||||
@@ -332,7 +332,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);
|
||||
|
||||
@@ -222,9 +222,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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -129,7 +129,7 @@ static ssize_t show_stat_show(struct kobject *kobj,
|
||||
}
|
||||
}
|
||||
}
|
||||
pr_debug("Current Time: %llu\n", ktime_get_boot_ns());
|
||||
pr_debug("Current Time: %llu\n", ktime_get_boottime_ns());
|
||||
return len;
|
||||
}
|
||||
KERNEL_ATTR_RO(show_stat);
|
||||
@@ -212,7 +212,7 @@ static void memory_state_freq_update(struct memory_state_update_block *ub,
|
||||
return;
|
||||
INIT_WORK(&freq_container->update_state,
|
||||
freq_update_do_work);
|
||||
freq_container->time_now = ktime_get_boot_ns();
|
||||
freq_container->time_now = ktime_get_boottime_ns();
|
||||
freq_container->value = value;
|
||||
pr_debug("Scheduling freq update in work queue\n");
|
||||
queue_work(memory_wq, &freq_container->update_state);
|
||||
@@ -234,7 +234,7 @@ static void memory_state_bw_update(struct memory_state_update_block *ub,
|
||||
return;
|
||||
INIT_WORK(&bw_container->update_state,
|
||||
bw_update_do_work);
|
||||
bw_container->time_now = ktime_get_boot_ns();
|
||||
bw_container->time_now = ktime_get_boottime_ns();
|
||||
bw_container->value = value;
|
||||
bw_container->id = ub->id;
|
||||
pr_debug("Scheduling bandwidth update in work queue\n");
|
||||
@@ -400,7 +400,7 @@ static int memory_state_time_probe(struct platform_device *pdev)
|
||||
error = freq_buckets_init(&pdev->dev);
|
||||
if (error)
|
||||
return error;
|
||||
last_update = ktime_get_boot_ns();
|
||||
last_update = ktime_get_boottime_ns();
|
||||
init_success = true;
|
||||
|
||||
pr_debug("memory_state_time initialized with num_freqs %d\n",
|
||||
|
||||
@@ -489,7 +489,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
|
||||
|
||||
@@ -1046,7 +1046,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)) {
|
||||
|
||||
@@ -1409,7 +1409,7 @@ void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime)
|
||||
}
|
||||
|
||||
*gp2 = iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG);
|
||||
*boottime = ktime_get_boot_ns();
|
||||
*boottime = ktime_get_boottime_ns();
|
||||
|
||||
if (!ps_disabled) {
|
||||
mvm->ps_disabled = ps_disabled;
|
||||
|
||||
@@ -1344,7 +1344,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();
|
||||
|
||||
@@ -484,7 +484,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;
|
||||
|
||||
@@ -107,7 +107,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,
|
||||
|
||||
@@ -286,7 +286,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);
|
||||
|
||||
@@ -174,7 +174,7 @@ static void virt_wifi_scan_result(struct work_struct *work)
|
||||
scan_result.work);
|
||||
struct wiphy *wiphy = priv_to_wiphy(priv);
|
||||
struct cfg80211_scan_info scan_info = { .aborted = false };
|
||||
u64 tsf = div_u64(ktime_get_boot_ns(), 1000);
|
||||
u64 tsf = div_u64(ktime_get_boottime_ns(), 1000);
|
||||
|
||||
informed_bss = cfg80211_inform_bss(wiphy, &channel_5ghz,
|
||||
CFG80211_BSS_FTYPE_PRESP,
|
||||
|
||||
@@ -115,12 +115,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());
|
||||
}
|
||||
|
||||
@@ -1769,7 +1769,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.
|
||||
|
||||
@@ -1682,7 +1682,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;
|
||||
|
||||
@@ -10277,11 +10277,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:
|
||||
|
||||
@@ -2109,7 +2109,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.
|
||||
|
||||
Reference in New Issue
Block a user