summaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-07-03 13:30:12 (GMT)
committerScott Wood <scottwood@freescale.com>2015-02-13 22:20:27 (GMT)
commitb0c9323c7fbd3447ea90d26a1e2e269138730cfe (patch)
tree88021b1c42488f0ac27a8009a3adfb26033e181a /ipc
parent8c269ba0633cb099a203754283afe0f7940d8d86 (diff)
downloadlinux-fsl-qoriq-b0c9323c7fbd3447ea90d26a1e2e269138730cfe.tar.xz
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>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c5
-rw-r--r--ipc/msg.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index bb0248f..af0c6bb 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 52770bf..1cf8b2c 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -253,10 +253,18 @@ 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;
wake_up_process(msr->r_tsk);
smp_mb();
msr->r_msg = ERR_PTR(res);
+
+ preempt_enable_rt();
}
}
@@ -636,6 +644,12 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
!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) {
msr->r_msg = NULL;
@@ -649,9 +663,11 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
wake_up_process(msr->r_tsk);
smp_mb();
msr->r_msg = msg;
+ preempt_enable_rt();
return 1;
}
+ preempt_enable_rt();
}
}
return 0;