aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
Diffstat (limited to 'litmus')
-rw-r--r--litmus/Kconfig5
-rw-r--r--litmus/fifo_lock.c1
-rw-r--r--litmus/litmus.c2
-rw-r--r--litmus/sched_cedf.c42
-rw-r--r--litmus/sched_gsn_edf.c7
5 files changed, 49 insertions, 8 deletions
diff --git a/litmus/Kconfig b/litmus/Kconfig
index fad4220ae49f..8dd3955f671d 100644
--- a/litmus/Kconfig
+++ b/litmus/Kconfig
@@ -59,7 +59,8 @@ config REALTIME_AUX_TASKS
59 59
60choice 60choice
61 prompt "Scheduling prioritization of AUX tasks." 61 prompt "Scheduling prioritization of AUX tasks."
62 default REALTIME_AUX_TASK_PRIORITY_BOOSTED 62 depends on REALTIME_AUX_TASKS
63 default REALTIME_AUX_TASK_PRIORITY_INHERITANCE
63 help 64 help
64 Select the prioritization method for auxillary tasks. 65 Select the prioritization method for auxillary tasks.
65 66
@@ -69,6 +70,8 @@ config REALTIME_AUX_TASK_PRIORITY_BOOSTED
69 Run all auxillary task threads at a maximum priority. Useful for 70 Run all auxillary task threads at a maximum priority. Useful for
70 temporarily working around bugs during development. 71 temporarily working around bugs during development.
71 72
73 BEWARE: Run-away auxillary tasks will clobber CPUs.
74
72config REALTIME_AUX_TASK_PRIORITY_INHERITANCE 75config REALTIME_AUX_TASK_PRIORITY_INHERITANCE
73 bool "Inheritance" 76 bool "Inheritance"
74 help 77 help
diff --git a/litmus/fifo_lock.c b/litmus/fifo_lock.c
index eb42aeee20eb..be49cd3a58d2 100644
--- a/litmus/fifo_lock.c
+++ b/litmus/fifo_lock.c
@@ -398,7 +398,6 @@ int fifo_mutex_unlock(struct litmus_lock* l)
398 __waitqueue_dgl_remove_first(&mutex->wait, &dgl_wait, &next); 398 __waitqueue_dgl_remove_first(&mutex->wait, &dgl_wait, &next);
399 if(dgl_wait) { 399 if(dgl_wait) {
400 next = dgl_wait->task; 400 next = dgl_wait->task;
401 //select_next_lock_if_primary(l, dgl_wait);
402 } 401 }
403#else 402#else
404 next = __waitqueue_remove_first(&mutex->wait); 403 next = __waitqueue_remove_first(&mutex->wait);
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 740b5e57ecc1..a69a3d0e9128 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -556,12 +556,14 @@ out:
556 556
557void litmus_pre_exit_task(struct task_struct* tsk) 557void litmus_pre_exit_task(struct task_struct* tsk)
558{ 558{
559#ifdef CONFIG_LITMUS_AFFINITY_LOCKING
559 if (is_realtime(tsk)) { 560 if (is_realtime(tsk)) {
560 if (tsk_rt(tsk)->rsrc_exit_cb) { 561 if (tsk_rt(tsk)->rsrc_exit_cb) {
561 int ret = tsk_rt(tsk)->rsrc_exit_cb(tsk); 562 int ret = tsk_rt(tsk)->rsrc_exit_cb(tsk);
562 WARN_ON(ret != 0); 563 WARN_ON(ret != 0);
563 } 564 }
564 } 565 }
566#endif
565} 567}
566 568
567void litmus_exit_task(struct task_struct* tsk) 569void litmus_exit_task(struct task_struct* tsk)
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 2246e9b8754e..61d682d9f415 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -52,6 +52,7 @@
52 52
53#ifdef CONFIG_LITMUS_NESTED_LOCKING 53#ifdef CONFIG_LITMUS_NESTED_LOCKING
54#include <litmus/fifo_lock.h> 54#include <litmus/fifo_lock.h>
55#include <litmus/prioq_lock.h>
55#include <litmus/ikglp_lock.h> 56#include <litmus/ikglp_lock.h>
56#endif 57#endif
57 58
@@ -852,6 +853,7 @@ static struct task_struct* cedf_schedule(struct task_struct * prev)
852 TRACE_TASK(prev, "will be preempted by %s/%d\n", 853 TRACE_TASK(prev, "will be preempted by %s/%d\n",
853 entry->linked->comm, entry->linked->pid); 854 entry->linked->comm, entry->linked->pid);
854 855
856#ifdef CONFIG_REALTIME_AUX_TASKS
855 if (tsk_rt(prev)->is_aux_task && 857 if (tsk_rt(prev)->is_aux_task &&
856 (prev->state == TASK_INTERRUPTIBLE) && 858 (prev->state == TASK_INTERRUPTIBLE) &&
857 !blocks) { 859 !blocks) {
@@ -860,6 +862,7 @@ static struct task_struct* cedf_schedule(struct task_struct * prev)
860 next = prev; /* allow prev to continue. */ 862 next = prev; /* allow prev to continue. */
861 goto out_set_state; 863 goto out_set_state;
862 } 864 }
865#endif
863 866
864 /* Send the signal that the budget has been exhausted */ 867 /* Send the signal that the budget has been exhausted */
865 if (signal_budget) 868 if (signal_budget)
@@ -931,7 +934,9 @@ static struct task_struct* cedf_schedule(struct task_struct * prev)
931 } 934 }
932 } 935 }
933 936
937#ifdef CONFIG_REALTIME_AUX_TASKS
934out_set_state: 938out_set_state:
939#endif
935 940
936 sched_state_task_picked(); 941 sched_state_task_picked();
937 raw_spin_unlock(&cluster->cluster_lock); 942 raw_spin_unlock(&cluster->cluster_lock);
@@ -1546,6 +1551,32 @@ static struct litmus_lock* cedf_new_fifo_mutex(void)
1546 return fifo_mutex_new(&cedf_fifo_mutex_lock_ops); 1551 return fifo_mutex_new(&cedf_fifo_mutex_lock_ops);
1547} 1552}
1548 1553
1554/* ******************** PRIOQ MUTEX ********************** */
1555
1556static struct litmus_lock_ops cedf_prioq_mutex_lock_ops = {
1557 .lock = prioq_mutex_lock,
1558 .unlock = prioq_mutex_unlock,
1559 .close = prioq_mutex_close,
1560 .deallocate = prioq_mutex_free,
1561
1562 .propagate_increase_inheritance = prioq_mutex_propagate_increase_inheritance,
1563 .propagate_decrease_inheritance = prioq_mutex_propagate_decrease_inheritance,
1564
1565#ifdef CONFIG_LITMUS_DGL_SUPPORT
1566 .dgl_lock = prioq_mutex_dgl_lock,
1567 .is_owner = prioq_mutex_is_owner,
1568 .enable_priority = prioq_mutex_enable_priority,
1569
1570 .dgl_can_quick_lock = prioq_mutex_dgl_can_quick_lock,
1571 .dgl_quick_lock = prioq_mutex_dgl_quick_lock,
1572#endif
1573};
1574
1575static struct litmus_lock* cedf_new_prioq_mutex(void)
1576{
1577 return prioq_mutex_new(&cedf_prioq_mutex_lock_ops);
1578}
1579
1549/* ******************** IKGLP ********************** */ 1580/* ******************** IKGLP ********************** */
1550 1581
1551static struct litmus_lock_ops cedf_ikglp_lock_ops = { 1582static struct litmus_lock_ops cedf_ikglp_lock_ops = {
@@ -1603,6 +1634,10 @@ static long cedf_allocate_lock(struct litmus_lock **lock, int type,
1603 *lock = cedf_new_fifo_mutex(); 1634 *lock = cedf_new_fifo_mutex();
1604 break; 1635 break;
1605 1636
1637 case PRIOQ_MUTEX:
1638 *lock = cedf_new_prioq_mutex();
1639 break;
1640
1606 case IKGLP_SEM: 1641 case IKGLP_SEM:
1607 *lock = cedf_new_ikglp(args); 1642 *lock = cedf_new_ikglp(args);
1608 break; 1643 break;
@@ -1629,13 +1664,13 @@ UNSUPPORTED_LOCK:
1629 1664
1630 1665
1631#ifdef CONFIG_LITMUS_AFFINITY_LOCKING 1666#ifdef CONFIG_LITMUS_AFFINITY_LOCKING
1632static struct affinity_observer_ops cedf_kfmlp_affinity_ops = { 1667static struct affinity_observer_ops cedf_kfmlp_affinity_ops __attribute__ ((unused)) = {
1633 .close = kfmlp_aff_obs_close, 1668 .close = kfmlp_aff_obs_close,
1634 .deallocate = kfmlp_aff_obs_free, 1669 .deallocate = kfmlp_aff_obs_free,
1635}; 1670};
1636 1671
1637#ifdef CONFIG_LITMUS_NESTED_LOCKING 1672#ifdef CONFIG_LITMUS_NESTED_LOCKING
1638static struct affinity_observer_ops cedf_ikglp_affinity_ops = { 1673static struct affinity_observer_ops cedf_ikglp_affinity_ops __attribute__ ((unused)) = {
1639 .close = ikglp_aff_obs_close, 1674 .close = ikglp_aff_obs_close,
1640 .deallocate = ikglp_aff_obs_free, 1675 .deallocate = ikglp_aff_obs_free,
1641}; 1676};
@@ -1648,7 +1683,7 @@ static long cedf_allocate_affinity_observer(struct affinity_observer **aff_obs,
1648 int err; 1683 int err;
1649 1684
1650 switch (type) { 1685 switch (type) {
1651 1686#ifdef CONFIG_LITMUS_NVIDIA
1652 case KFMLP_SIMPLE_GPU_AFF_OBS: 1687 case KFMLP_SIMPLE_GPU_AFF_OBS:
1653 *aff_obs = kfmlp_simple_gpu_aff_obs_new(&cedf_kfmlp_affinity_ops, args); 1688 *aff_obs = kfmlp_simple_gpu_aff_obs_new(&cedf_kfmlp_affinity_ops, args);
1654 break; 1689 break;
@@ -1666,6 +1701,7 @@ static long cedf_allocate_affinity_observer(struct affinity_observer **aff_obs,
1666 *aff_obs = ikglp_gpu_aff_obs_new(&cedf_ikglp_affinity_ops, args); 1701 *aff_obs = ikglp_gpu_aff_obs_new(&cedf_ikglp_affinity_ops, args);
1667 break; 1702 break;
1668#endif 1703#endif
1704#endif
1669 default: 1705 default:
1670 err = -ENXIO; 1706 err = -ENXIO;
1671 goto UNSUPPORTED_AFF_OBS; 1707 goto UNSUPPORTED_AFF_OBS;
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 886bd14f677c..4589888fc652 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -1771,13 +1771,13 @@ UNSUPPORTED_LOCK:
1771 1771
1772 1772
1773#ifdef CONFIG_LITMUS_AFFINITY_LOCKING 1773#ifdef CONFIG_LITMUS_AFFINITY_LOCKING
1774static struct affinity_observer_ops gsnedf_kfmlp_affinity_ops = { 1774static struct affinity_observer_ops gsnedf_kfmlp_affinity_ops __attribute__ ((unused)) = {
1775 .close = kfmlp_aff_obs_close, 1775 .close = kfmlp_aff_obs_close,
1776 .deallocate = kfmlp_aff_obs_free, 1776 .deallocate = kfmlp_aff_obs_free,
1777}; 1777};
1778 1778
1779#ifdef CONFIG_LITMUS_NESTED_LOCKING 1779#ifdef CONFIG_LITMUS_NESTED_LOCKING
1780static struct affinity_observer_ops gsnedf_ikglp_affinity_ops = { 1780static struct affinity_observer_ops gsnedf_ikglp_affinity_ops __attribute__ ((unused)) = {
1781 .close = ikglp_aff_obs_close, 1781 .close = ikglp_aff_obs_close,
1782 .deallocate = ikglp_aff_obs_free, 1782 .deallocate = ikglp_aff_obs_free,
1783}; 1783};
@@ -1791,7 +1791,7 @@ static long gsnedf_allocate_affinity_observer(
1791 int err; 1791 int err;
1792 1792
1793 switch (type) { 1793 switch (type) {
1794 1794#ifdef CONFIG_LITMUS_NVIDIA
1795 case KFMLP_SIMPLE_GPU_AFF_OBS: 1795 case KFMLP_SIMPLE_GPU_AFF_OBS:
1796 *aff_obs = kfmlp_simple_gpu_aff_obs_new(&gsnedf_kfmlp_affinity_ops, args); 1796 *aff_obs = kfmlp_simple_gpu_aff_obs_new(&gsnedf_kfmlp_affinity_ops, args);
1797 break; 1797 break;
@@ -1809,6 +1809,7 @@ static long gsnedf_allocate_affinity_observer(
1809 *aff_obs = ikglp_gpu_aff_obs_new(&gsnedf_ikglp_affinity_ops, args); 1809 *aff_obs = ikglp_gpu_aff_obs_new(&gsnedf_ikglp_affinity_ops, args);
1810 break; 1810 break;
1811#endif 1811#endif
1812#endif
1812 default: 1813 default:
1813 err = -ENXIO; 1814 err = -ENXIO;
1814 goto UNSUPPORTED_AFF_OBS; 1815 goto UNSUPPORTED_AFF_OBS;