aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-11-29 12:51:17 -0500
committerDavid S. Miller <davem@davemloft.net>2012-11-29 12:51:17 -0500
commit8a2cf062b27ef5511a7d8a7ce6662fbc04f671b8 (patch)
tree31f32c0d9a548f0dbbe9f3a32aca5767093d98b4 /kernel
parent3177bf6f922f62743133abbcbbbb5545f4133b2d (diff)
parente9296e89b85604862bd9ec2d54dc43edad775c0d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/futex.c18
-rw-r--r--kernel/watchdog.c4
2 files changed, 19 insertions, 3 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 20ef219bbe9b..19eb089ca003 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -843,6 +843,9 @@ static void wake_futex(struct futex_q *q)
843{ 843{
844 struct task_struct *p = q->task; 844 struct task_struct *p = q->task;
845 845
846 if (WARN(q->pi_state || q->rt_waiter, "refusing to wake PI futex\n"))
847 return;
848
846 /* 849 /*
847 * We set q->lock_ptr = NULL _before_ we wake up the task. If 850 * We set q->lock_ptr = NULL _before_ we wake up the task. If
848 * a non-futex wake up happens on another CPU then the task 851 * a non-futex wake up happens on another CPU then the task
@@ -1078,6 +1081,10 @@ retry_private:
1078 1081
1079 plist_for_each_entry_safe(this, next, head, list) { 1082 plist_for_each_entry_safe(this, next, head, list) {
1080 if (match_futex (&this->key, &key1)) { 1083 if (match_futex (&this->key, &key1)) {
1084 if (this->pi_state || this->rt_waiter) {
1085 ret = -EINVAL;
1086 goto out_unlock;
1087 }
1081 wake_futex(this); 1088 wake_futex(this);
1082 if (++ret >= nr_wake) 1089 if (++ret >= nr_wake)
1083 break; 1090 break;
@@ -1090,6 +1097,10 @@ retry_private:
1090 op_ret = 0; 1097 op_ret = 0;
1091 plist_for_each_entry_safe(this, next, head, list) { 1098 plist_for_each_entry_safe(this, next, head, list) {
1092 if (match_futex (&this->key, &key2)) { 1099 if (match_futex (&this->key, &key2)) {
1100 if (this->pi_state || this->rt_waiter) {
1101 ret = -EINVAL;
1102 goto out_unlock;
1103 }
1093 wake_futex(this); 1104 wake_futex(this);
1094 if (++op_ret >= nr_wake2) 1105 if (++op_ret >= nr_wake2)
1095 break; 1106 break;
@@ -1098,6 +1109,7 @@ retry_private:
1098 ret += op_ret; 1109 ret += op_ret;
1099 } 1110 }
1100 1111
1112out_unlock:
1101 double_unlock_hb(hb1, hb2); 1113 double_unlock_hb(hb1, hb2);
1102out_put_keys: 1114out_put_keys:
1103 put_futex_key(&key2); 1115 put_futex_key(&key2);
@@ -1387,9 +1399,13 @@ retry_private:
1387 /* 1399 /*
1388 * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always 1400 * FUTEX_WAIT_REQEUE_PI and FUTEX_CMP_REQUEUE_PI should always
1389 * be paired with each other and no other futex ops. 1401 * be paired with each other and no other futex ops.
1402 *
1403 * We should never be requeueing a futex_q with a pi_state,
1404 * which is awaiting a futex_unlock_pi().
1390 */ 1405 */
1391 if ((requeue_pi && !this->rt_waiter) || 1406 if ((requeue_pi && !this->rt_waiter) ||
1392 (!requeue_pi && this->rt_waiter)) { 1407 (!requeue_pi && this->rt_waiter) ||
1408 this->pi_state) {
1393 ret = -EINVAL; 1409 ret = -EINVAL;
1394 break; 1410 break;
1395 } 1411 }
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 9d4c8d5a1f53..dd4b80a9f1a9 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -116,7 +116,7 @@ static unsigned long get_timestamp(int this_cpu)
116 return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */ 116 return cpu_clock(this_cpu) >> 30LL; /* 2^30 ~= 10^9 */
117} 117}
118 118
119static unsigned long get_sample_period(void) 119static u64 get_sample_period(void)
120{ 120{
121 /* 121 /*
122 * convert watchdog_thresh from seconds to ns 122 * convert watchdog_thresh from seconds to ns
@@ -125,7 +125,7 @@ static unsigned long get_sample_period(void)
125 * and hard thresholds) to increment before the 125 * and hard thresholds) to increment before the
126 * hardlockup detector generates a warning 126 * hardlockup detector generates a warning
127 */ 127 */
128 return get_softlockup_thresh() * (NSEC_PER_SEC / 5); 128 return get_softlockup_thresh() * ((u64)NSEC_PER_SEC / 5);
129} 129}
130 130
131/* Commands for resetting the watchdog */ 131/* Commands for resetting the watchdog */