aboutsummaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-07-03 08:30:12 -0500
committerAnders Roxell <anders.roxell@linaro.org>2014-06-30 14:36:35 +0200
commit16789657359c9ee89842b3a634cb1f3f32034b9e (patch)
tree776bda2f433086c9e16dc9321e76dea4d65861dd /ipc
parent18e5a2dda262d277068e76ec742e3c57a1851f6d (diff)
ipc: Make the ipc code -rt aware
RT serializes the code with the (rt)spinlock but keeps preemption enabled. Some parts of the code need to be atomic nevertheless. Protect it with preempt_disable/enable_rt pairts. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c5
-rw-r--r--ipc/msg.c16
2 files changed, 20 insertions, 1 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index c3b31179122c..502f4b1bb96b 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -923,12 +923,17 @@ static inline void pipelined_send(struct mqueue_inode_info *info,
struct msg_msg *message,
struct ext_wait_queue *receiver)
{
+ /*
+ * Keep them in one critical section for PREEMPT_RT:
+ */
+ preempt_disable_rt();
receiver->msg = message;
list_del(&receiver->list);
receiver->state = STATE_PENDING;
wake_up_process(receiver->task);
smp_wmb();
receiver->state = STATE_READY;
+ preempt_enable_rt();
}
/* pipelined_receive() - if there is task waiting in sys_mq_timedsend()
diff --git a/ipc/msg.c b/ipc/msg.c
index 649853105a5d..0ab74838a4ed 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -253,6 +253,12 @@ static void expunge_all(struct msg_queue *msq, int res)
struct msg_receiver *msr, *t;
list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
+ /*
+ * Make sure that the wakeup doesnt preempt
+ * this CPU prematurely. (on PREEMPT_RT)
+ */
+ preempt_disable_rt();
+
msr->r_msg = NULL; /* initialize expunge ordering */
wake_up_process(msr->r_tsk);
/*
@@ -263,6 +269,8 @@ static void expunge_all(struct msg_queue *msq, int res)
*/
smp_mb();
msr->r_msg = ERR_PTR(res);
+
+ preempt_enable_rt();
}
}
@@ -641,6 +649,11 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
if (testmsg(msg, msr->r_msgtype, msr->r_mode) &&
!security_msg_queue_msgrcv(msq, msg, msr->r_tsk,
msr->r_msgtype, msr->r_mode)) {
+ /*
+ * Make sure that the wakeup doesnt preempt
+ * this CPU prematurely. (on PREEMPT_RT)
+ */
+ preempt_disable_rt();
list_del(&msr->r_list);
if (msr->r_maxsize < msg->m_ts) {
@@ -662,12 +675,13 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
*/
smp_mb();
msr->r_msg = msg;
+ preempt_enable_rt();
return 1;
}
+ preempt_enable_rt();
}
}
-
return 0;
}