diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-05 20:46:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-05 20:46:42 -0400 |
commit | e7fda6c4c3c1a7d6996dd75fd84670fa0b5d448f (patch) | |
tree | daa51c16462c318b890acf7f01fba5827275dd74 /drivers/gpu/drm/i915/i915_gem.c | |
parent | 08d69a25714429850cf9ef71f22d8cdc9189d93f (diff) | |
parent | 953dec21aed4038464fec02f96a2f1b8701a5bce (diff) |
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer and time updates from Thomas Gleixner:
"A rather large update of timers, timekeeping & co
- Core timekeeping code is year-2038 safe now for 32bit machines.
Now we just need to fix all in kernel users and the gazillion of
user space interfaces which rely on timespec/timeval :)
- Better cache layout for the timekeeping internal data structures.
- Proper nanosecond based interfaces for in kernel users.
- Tree wide cleanup of code which wants nanoseconds but does hoops
and loops to convert back and forth from timespecs. Some of it
definitely belongs into the ugly code museum.
- Consolidation of the timekeeping interface zoo.
- A fast NMI safe accessor to clock monotonic for tracing. This is a
long standing request to support correlated user/kernel space
traces. With proper NTP frequency correction it's also suitable
for correlation of traces accross separate machines.
- Checkpoint/restart support for timerfd.
- A few NOHZ[_FULL] improvements in the [hr]timer code.
- Code move from kernel to kernel/time of all time* related code.
- New clocksource/event drivers from the ARM universe. I'm really
impressed that despite an architected timer in the newer chips SoC
manufacturers insist on inventing new and differently broken SoC
specific timers.
[ Ed. "Impressed"? I don't think that word means what you think it means ]
- Another round of code move from arch to drivers. Looks like most
of the legacy mess in ARM regarding timers is sorted out except for
a few obnoxious strongholds.
- The usual updates and fixlets all over the place"
* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (114 commits)
timekeeping: Fixup typo in update_vsyscall_old definition
clocksource: document some basic timekeeping concepts
timekeeping: Use cached ntp_tick_length when accumulating error
timekeeping: Rework frequency adjustments to work better w/ nohz
timekeeping: Minor fixup for timespec64->timespec assignment
ftrace: Provide trace clocks monotonic
timekeeping: Provide fast and NMI safe access to CLOCK_MONOTONIC
seqcount: Add raw_write_seqcount_latch()
seqcount: Provide raw_read_seqcount()
timekeeping: Use tk_read_base as argument for timekeeping_get_ns()
timekeeping: Create struct tk_read_base and use it in struct timekeeper
timekeeping: Restructure the timekeeper some more
clocksource: Get rid of cycle_last
clocksource: Move cycle_last validation to core code
clocksource: Make delta calculation a function
wireless: ath9k: Get rid of timespec conversions
drm: vmwgfx: Use nsec based interfaces
drm: i915: Use nsec based interfaces
timekeeping: Provide ktime_get_raw()
hangcheck-timer: Use ktime_get_ns()
...
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index d893e4da5dce..f247d922e44a 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1149,16 +1149,16 @@ static bool can_wait_boost(struct drm_i915_file_private *file_priv) | |||
1149 | static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, | 1149 | static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, |
1150 | unsigned reset_counter, | 1150 | unsigned reset_counter, |
1151 | bool interruptible, | 1151 | bool interruptible, |
1152 | struct timespec *timeout, | 1152 | s64 *timeout, |
1153 | struct drm_i915_file_private *file_priv) | 1153 | struct drm_i915_file_private *file_priv) |
1154 | { | 1154 | { |
1155 | struct drm_device *dev = ring->dev; | 1155 | struct drm_device *dev = ring->dev; |
1156 | struct drm_i915_private *dev_priv = dev->dev_private; | 1156 | struct drm_i915_private *dev_priv = dev->dev_private; |
1157 | const bool irq_test_in_progress = | 1157 | const bool irq_test_in_progress = |
1158 | ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring); | 1158 | ACCESS_ONCE(dev_priv->gpu_error.test_irq_rings) & intel_ring_flag(ring); |
1159 | struct timespec before, now; | ||
1160 | DEFINE_WAIT(wait); | 1159 | DEFINE_WAIT(wait); |
1161 | unsigned long timeout_expire; | 1160 | unsigned long timeout_expire; |
1161 | s64 before, now; | ||
1162 | int ret; | 1162 | int ret; |
1163 | 1163 | ||
1164 | WARN(dev_priv->pm.irqs_disabled, "IRQs disabled\n"); | 1164 | WARN(dev_priv->pm.irqs_disabled, "IRQs disabled\n"); |
@@ -1166,7 +1166,7 @@ static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, | |||
1166 | if (i915_seqno_passed(ring->get_seqno(ring, true), seqno)) | 1166 | if (i915_seqno_passed(ring->get_seqno(ring, true), seqno)) |
1167 | return 0; | 1167 | return 0; |
1168 | 1168 | ||
1169 | timeout_expire = timeout ? jiffies + timespec_to_jiffies_timeout(timeout) : 0; | 1169 | timeout_expire = timeout ? jiffies + nsecs_to_jiffies((u64)*timeout) : 0; |
1170 | 1170 | ||
1171 | if (INTEL_INFO(dev)->gen >= 6 && can_wait_boost(file_priv)) { | 1171 | if (INTEL_INFO(dev)->gen >= 6 && can_wait_boost(file_priv)) { |
1172 | gen6_rps_boost(dev_priv); | 1172 | gen6_rps_boost(dev_priv); |
@@ -1181,7 +1181,7 @@ static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, | |||
1181 | 1181 | ||
1182 | /* Record current time in case interrupted by signal, or wedged */ | 1182 | /* Record current time in case interrupted by signal, or wedged */ |
1183 | trace_i915_gem_request_wait_begin(ring, seqno); | 1183 | trace_i915_gem_request_wait_begin(ring, seqno); |
1184 | getrawmonotonic(&before); | 1184 | before = ktime_get_raw_ns(); |
1185 | for (;;) { | 1185 | for (;;) { |
1186 | struct timer_list timer; | 1186 | struct timer_list timer; |
1187 | 1187 | ||
@@ -1230,7 +1230,7 @@ static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, | |||
1230 | destroy_timer_on_stack(&timer); | 1230 | destroy_timer_on_stack(&timer); |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | getrawmonotonic(&now); | 1233 | now = ktime_get_raw_ns(); |
1234 | trace_i915_gem_request_wait_end(ring, seqno); | 1234 | trace_i915_gem_request_wait_end(ring, seqno); |
1235 | 1235 | ||
1236 | if (!irq_test_in_progress) | 1236 | if (!irq_test_in_progress) |
@@ -1239,10 +1239,9 @@ static int __wait_seqno(struct intel_engine_cs *ring, u32 seqno, | |||
1239 | finish_wait(&ring->irq_queue, &wait); | 1239 | finish_wait(&ring->irq_queue, &wait); |
1240 | 1240 | ||
1241 | if (timeout) { | 1241 | if (timeout) { |
1242 | struct timespec sleep_time = timespec_sub(now, before); | 1242 | s64 tres = *timeout - (now - before); |
1243 | *timeout = timespec_sub(*timeout, sleep_time); | 1243 | |
1244 | if (!timespec_valid(timeout)) /* i.e. negative time remains */ | 1244 | *timeout = tres < 0 ? 0 : tres; |
1245 | set_normalized_timespec(timeout, 0, 0); | ||
1246 | } | 1245 | } |
1247 | 1246 | ||
1248 | return ret; | 1247 | return ret; |
@@ -2746,16 +2745,10 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2746 | struct drm_i915_gem_wait *args = data; | 2745 | struct drm_i915_gem_wait *args = data; |
2747 | struct drm_i915_gem_object *obj; | 2746 | struct drm_i915_gem_object *obj; |
2748 | struct intel_engine_cs *ring = NULL; | 2747 | struct intel_engine_cs *ring = NULL; |
2749 | struct timespec timeout_stack, *timeout = NULL; | ||
2750 | unsigned reset_counter; | 2748 | unsigned reset_counter; |
2751 | u32 seqno = 0; | 2749 | u32 seqno = 0; |
2752 | int ret = 0; | 2750 | int ret = 0; |
2753 | 2751 | ||
2754 | if (args->timeout_ns >= 0) { | ||
2755 | timeout_stack = ns_to_timespec(args->timeout_ns); | ||
2756 | timeout = &timeout_stack; | ||
2757 | } | ||
2758 | |||
2759 | ret = i915_mutex_lock_interruptible(dev); | 2752 | ret = i915_mutex_lock_interruptible(dev); |
2760 | if (ret) | 2753 | if (ret) |
2761 | return ret; | 2754 | return ret; |
@@ -2780,9 +2773,9 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2780 | goto out; | 2773 | goto out; |
2781 | 2774 | ||
2782 | /* Do this after OLR check to make sure we make forward progress polling | 2775 | /* Do this after OLR check to make sure we make forward progress polling |
2783 | * on this IOCTL with a 0 timeout (like busy ioctl) | 2776 | * on this IOCTL with a timeout <=0 (like busy ioctl) |
2784 | */ | 2777 | */ |
2785 | if (!args->timeout_ns) { | 2778 | if (args->timeout_ns <= 0) { |
2786 | ret = -ETIME; | 2779 | ret = -ETIME; |
2787 | goto out; | 2780 | goto out; |
2788 | } | 2781 | } |
@@ -2791,10 +2784,8 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |||
2791 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); | 2784 | reset_counter = atomic_read(&dev_priv->gpu_error.reset_counter); |
2792 | mutex_unlock(&dev->struct_mutex); | 2785 | mutex_unlock(&dev->struct_mutex); |
2793 | 2786 | ||
2794 | ret = __wait_seqno(ring, seqno, reset_counter, true, timeout, file->driver_priv); | 2787 | return __wait_seqno(ring, seqno, reset_counter, true, &args->timeout_ns, |
2795 | if (timeout) | 2788 | file->driver_priv); |
2796 | args->timeout_ns = timespec_to_ns(timeout); | ||
2797 | return ret; | ||
2798 | 2789 | ||
2799 | out: | 2790 | out: |
2800 | drm_gem_object_unreference(&obj->base); | 2791 | drm_gem_object_unreference(&obj->base); |