Merge branch 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 20 May 2010 00:11:10 +0000 (17:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 20 May 2010 00:11:10 +0000 (17:11 -0700)
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  clocksource: Add clocksource_register_hz/khz interface
  posix-cpu-timers: Optimize run_posix_cpu_timers()
  time: Remove xtime_cache
  mqueue: Convert message queue timeout to use hrtimers
  hrtimers: Provide schedule_hrtimeout for CLOCK_REALTIME
  timers: Introduce the concept of timer slack for legacy timers
  ntp: Remove tickadj
  ntp: Make time_adjust static
  time: Add xtime, wall_to_monotonic to feature-removal-schedule
  timer: Try to survive timer callback preempt_count leak
  timer: Split out timer function call
  timer: Print function name for timer callbacks modifying preemption count
  time: Clean up warp_clock()
  cpu-timers: Avoid iterating over all threads in fastpath_timer_check()
  cpu-timers: Change SIGEV_NONE timer implementation
  cpu-timers: Return correct previous timer reload value
  cpu-timers: Cleanup arm_timer()
  cpu-timers: Simplify RLIMIT_CPU handling

1  2 
Documentation/feature-removal-schedule.txt
ipc/mqueue.c

index d9d3fbcb705deb79c4fe6fcfe1866e16f058341b,b93b7810c8bdc6a13d52e6a4f2fdc95094b6e1b3..e7965f4a385a72d386bf809b7ff61ecf142df2c8
@@@ -520,6 -520,29 +520,6 @@@ Who:      Hans de Goede <hdegoede@redhat.com
  
  ----------------------------
  
 -What: corgikbd, spitzkbd, tosakbd driver
 -When: 2.6.35
 -Files:        drivers/input/keyboard/{corgi,spitz,tosa}kbd.c
 -Why:  We now have a generic GPIO based matrix keyboard driver that
 -      are fully capable of handling all the keys on these devices.
 -      The original drivers manipulate the GPIO registers directly
 -      and so are difficult to maintain.
 -Who:  Eric Miao <eric.y.miao@gmail.com>
 -
 -----------------------------
 -
 -What: corgi_ssp and corgi_ts driver
 -When: 2.6.35
 -Files:        arch/arm/mach-pxa/corgi_ssp.c, drivers/input/touchscreen/corgi_ts.c
 -Why:  The corgi touchscreen is now deprecated in favour of the generic
 -      ads7846.c driver. The noise reduction technique used in corgi_ts.c,
 -      that's to wait till vsync before ADC sampling, is also integrated into
 -      ads7846 driver now. Provided that the original driver is not generic
 -      and is difficult to maintain, it will be removed later.
 -Who:  Eric Miao <eric.y.miao@gmail.com>
 -
 -----------------------------
 -
  What: capifs
  When: February 2011
  Files:        drivers/isdn/capi/capifs.*
@@@ -541,6 -564,16 +541,16 @@@ Who:     Avi Kivity <avi@redhat.com
  
  ----------------------------
  
+ What: xtime, wall_to_monotonic
+ When: 2.6.36+
+ Files:        kernel/time/timekeeping.c include/linux/time.h
+ Why:  Cleaning up timekeeping internal values. Please use
+       existing timekeeping accessor functions to access
+       the equivalent functionality.
+ Who:  John Stultz <johnstul@us.ibm.com>
+ ----------------------------
  What: KVM kernel-allocated memory slots
  When: July 2010
  Why:  Since 2.6.25, kvm supports user-allocated memory slots, which are
@@@ -589,13 -622,3 +599,13 @@@ Why:     The vtx device nodes have been sup
        provided by the vtx API, then that functionality should be build
        around the sliced VBI API instead.
  Who:  Hans Verkuil <hverkuil@xs4all.nl>
 +
 +----------------------------
 +
 +What: IRQF_DISABLED
 +When: 2.6.36
 +Why:  The flag is a NOOP as we run interrupt handlers with interrupts disabled
 +Who:  Thomas Gleixner <tglx@linutronix.de>
 +
 +----------------------------
 +
diff --combined ipc/mqueue.c
index 59a009dc54a8ba0ddf0d258d5b077260148abecc,d6c09c46ad062e9d198004bdf07b6f17f221e56b..5108232f93d48ec008f0418737238c50e810ba15
@@@ -158,7 -158,7 +158,7 @@@ static struct inode *mqueue_get_inode(s
                            u->mq_bytes + mq_bytes >
                            task_rlimit(p, RLIMIT_MSGQUEUE)) {
                                spin_unlock(&mq_lock);
 -                              kfree(info->messages);
 +                              /* mqueue_delete_inode() releases info->messages */
                                goto out_inode;
                        }
                        u->mq_bytes += mq_bytes;
@@@ -429,7 -429,7 +429,7 @@@ static void wq_add(struct mqueue_inode_
   * sr: SEND or RECV
   */
  static int wq_sleep(struct mqueue_inode_info *info, int sr,
-                       long timeout, struct ext_wait_queue *ewp)
+                   ktime_t *timeout, struct ext_wait_queue *ewp)
  {
        int retval;
        signed long time;
                set_current_state(TASK_INTERRUPTIBLE);
  
                spin_unlock(&info->lock);
-               time = schedule_timeout(timeout);
+               time = schedule_hrtimeout_range_clock(timeout,
+                   HRTIMER_MODE_ABS, 0, CLOCK_REALTIME);
  
                while (ewp->state == STATE_PENDING)
                        cpu_relax();
@@@ -552,31 -553,16 +553,16 @@@ static void __do_notify(struct mqueue_i
        wake_up(&info->wait_q);
  }
  
- static long prepare_timeout(struct timespec *p)
+ static int prepare_timeout(const struct timespec __user *u_abs_timeout,
+                          ktime_t *expires, struct timespec *ts)
  {
-       struct timespec nowts;
-       long timeout;
-       if (p) {
-               if (unlikely(p->tv_nsec < 0 || p->tv_sec < 0
-                       || p->tv_nsec >= NSEC_PER_SEC))
-                       return -EINVAL;
-               nowts = CURRENT_TIME;
-               /* first subtract as jiffies can't be too big */
-               p->tv_sec -= nowts.tv_sec;
-               if (p->tv_nsec < nowts.tv_nsec) {
-                       p->tv_nsec += NSEC_PER_SEC;
-                       p->tv_sec--;
-               }
-               p->tv_nsec -= nowts.tv_nsec;
-               if (p->tv_sec < 0)
-                       return 0;
-               timeout = timespec_to_jiffies(p) + 1;
-       } else
-               return MAX_SCHEDULE_TIMEOUT;
+       if (copy_from_user(ts, u_abs_timeout, sizeof(struct timespec)))
+               return -EFAULT;
+       if (!timespec_valid(ts))
+               return -EINVAL;
  
-       return timeout;
+       *expires = timespec_to_ktime(*ts);
+       return 0;
  }
  
  static void remove_notification(struct mqueue_inode_info *info)
@@@ -862,22 -848,21 +848,21 @@@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mq
        struct ext_wait_queue *receiver;
        struct msg_msg *msg_ptr;
        struct mqueue_inode_info *info;
-       struct timespec ts, *p = NULL;
-       long timeout;
+       ktime_t expires, *timeout = NULL;
+       struct timespec ts;
        int ret;
  
        if (u_abs_timeout) {
-               if (copy_from_user(&ts, u_abs_timeout, 
-                                       sizeof(struct timespec)))
-                       return -EFAULT;
-               p = &ts;
+               int res = prepare_timeout(u_abs_timeout, &expires, &ts);
+               if (res)
+                       return res;
+               timeout = &expires;
        }
  
        if (unlikely(msg_prio >= (unsigned long) MQ_PRIO_MAX))
                return -EINVAL;
  
-       audit_mq_sendrecv(mqdes, msg_len, msg_prio, p);
-       timeout = prepare_timeout(p);
+       audit_mq_sendrecv(mqdes, msg_len, msg_prio, timeout ? &ts : NULL);
  
        filp = fget(mqdes);
        if (unlikely(!filp)) {
                if (filp->f_flags & O_NONBLOCK) {
                        spin_unlock(&info->lock);
                        ret = -EAGAIN;
-               } else if (unlikely(timeout < 0)) {
-                       spin_unlock(&info->lock);
-                       ret = timeout;
                } else {
                        wait.task = current;
                        wait.msg = (void *) msg_ptr;
@@@ -954,24 -936,23 +936,23 @@@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t
                size_t, msg_len, unsigned int __user *, u_msg_prio,
                const struct timespec __user *, u_abs_timeout)
  {
-       long timeout;
        ssize_t ret;
        struct msg_msg *msg_ptr;
        struct file *filp;
        struct inode *inode;
        struct mqueue_inode_info *info;
        struct ext_wait_queue wait;
-       struct timespec ts, *p = NULL;
+       ktime_t expires, *timeout = NULL;
+       struct timespec ts;
  
        if (u_abs_timeout) {
-               if (copy_from_user(&ts, u_abs_timeout, 
-                                       sizeof(struct timespec)))
-                       return -EFAULT;
-               p = &ts;
+               int res = prepare_timeout(u_abs_timeout, &expires, &ts);
+               if (res)
+                       return res;
+               timeout = &expires;
        }
  
-       audit_mq_sendrecv(mqdes, msg_len, 0, p);
-       timeout = prepare_timeout(p);
+       audit_mq_sendrecv(mqdes, msg_len, 0, timeout ? &ts : NULL);
  
        filp = fget(mqdes);
        if (unlikely(!filp)) {
                if (filp->f_flags & O_NONBLOCK) {
                        spin_unlock(&info->lock);
                        ret = -EAGAIN;
-                       msg_ptr = NULL;
-               } else if (unlikely(timeout < 0)) {
-                       spin_unlock(&info->lock);
-                       ret = timeout;
-                       msg_ptr = NULL;
                } else {
                        wait.task = current;
                        wait.state = STATE_NONE;