diff options
Diffstat (limited to 'litmus/nvidia_info.c')
-rw-r--r-- | litmus/nvidia_info.c | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/litmus/nvidia_info.c b/litmus/nvidia_info.c index dda863009fee..ab62ca1b5b11 100644 --- a/litmus/nvidia_info.c +++ b/litmus/nvidia_info.c | |||
@@ -553,7 +553,10 @@ static int gpu_klmirqd_increase_priority(struct task_struct *klmirqd, struct tas | |||
553 | { | 553 | { |
554 | int retval = 0; | 554 | int retval = 0; |
555 | 555 | ||
556 | TRACE_CUR("Increasing priority of nv klmirqd: %s/%d.\n", klmirqd->comm, klmirqd->pid); | 556 | TRACE_CUR("Increasing priority of %s/%d to %s/%d.\n", |
557 | klmirqd->comm, klmirqd->pid, | ||
558 | (hp) ? hp->comm : "nil", | ||
559 | (hp) ? hp->pid : -1); | ||
557 | 560 | ||
558 | /* the klmirqd thread should never attempt to hold a litmus-level real-time | 561 | /* the klmirqd thread should never attempt to hold a litmus-level real-time |
559 | * so nested support is not required */ | 562 | * so nested support is not required */ |
@@ -566,7 +569,10 @@ static int gpu_klmirqd_decrease_priority(struct task_struct *klmirqd, struct tas | |||
566 | { | 569 | { |
567 | int retval = 0; | 570 | int retval = 0; |
568 | 571 | ||
569 | TRACE_CUR("Decreasing priority of nv klmirqd: %s/%d.\n", klmirqd->comm, klmirqd->pid); | 572 | TRACE_CUR("Decreasing priority of %s/%d to %s/%d.\n", |
573 | klmirqd->comm, klmirqd->pid, | ||
574 | (hp) ? hp->comm : "nil", | ||
575 | (hp) ? hp->pid : -1); | ||
570 | 576 | ||
571 | /* the klmirqd thread should never attempt to hold a litmus-level real-time | 577 | /* the klmirqd thread should never attempt to hold a litmus-level real-time |
572 | * so nested support is not required */ | 578 | * so nested support is not required */ |
@@ -617,9 +623,12 @@ long enable_gpu_owner(struct task_struct *t) | |||
617 | 623 | ||
618 | if (hp == t) { | 624 | if (hp == t) { |
619 | /* we're the new hp */ | 625 | /* we're the new hp */ |
620 | TRACE_CUR("%s/%d is new hp on GPU %d.\n", t->comm, t->pid, gpu); | 626 | TRACE_CUR("%s/%d (eff_prio = %s/%d) is new hp on GPU %d.\n", |
627 | t->comm, t->pid, | ||
628 | effective_priority(t)->comm, effective_priority(t)->pid, | ||
629 | gpu); | ||
621 | 630 | ||
622 | retval = gpu_klmirqd_increase_priority(reg->thread, (tsk_rt(hp)->inh_task)? tsk_rt(hp)->inh_task : hp); | 631 | retval = gpu_klmirqd_increase_priority(reg->thread, effective_priority(t)); |
623 | } | 632 | } |
624 | #endif | 633 | #endif |
625 | 634 | ||
@@ -671,13 +680,15 @@ long disable_gpu_owner(struct task_struct *t) | |||
671 | } | 680 | } |
672 | 681 | ||
673 | if (hp == t && new_hp != t) { | 682 | if (hp == t && new_hp != t) { |
674 | struct task_struct *to_inh = NULL; | 683 | struct task_struct *to_inh = (new_hp) ? effective_priority(new_hp) : NULL; |
675 | 684 | ||
676 | TRACE_CUR("%s/%d is no longer hp on GPU %d.\n", t->comm, t->pid, gpu); | 685 | TRACE_CUR("%s/%d is no longer hp on GPU %d; new hp = %s/%d (eff_prio = %s/%d).\n", |
677 | 686 | t->comm, t->pid, | |
678 | if (new_hp) { | 687 | gpu, |
679 | to_inh = (tsk_rt(new_hp)->inh_task) ? tsk_rt(new_hp)->inh_task : new_hp; | 688 | (new_hp) ? new_hp->comm : "nil", |
680 | } | 689 | (new_hp) ? new_hp->pid : -1, |
690 | (to_inh) ? to_inh->comm : "nil", | ||
691 | (to_inh) ? to_inh->pid : -1); | ||
681 | 692 | ||
682 | retval = gpu_klmirqd_decrease_priority(reg->thread, to_inh); | 693 | retval = gpu_klmirqd_decrease_priority(reg->thread, to_inh); |
683 | } | 694 | } |
@@ -707,6 +718,10 @@ int gpu_owner_increase_priority(struct task_struct *t) | |||
707 | struct task_struct *hp = NULL; | 718 | struct task_struct *hp = NULL; |
708 | struct task_struct *hp_eff = NULL; | 719 | struct task_struct *hp_eff = NULL; |
709 | 720 | ||
721 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
722 | int increase_klmirqd = 0; | ||
723 | #endif | ||
724 | |||
710 | BUG_ON(!is_realtime(t)); | 725 | BUG_ON(!is_realtime(t)); |
711 | BUG_ON(!tsk_rt(t)->held_gpus); | 726 | BUG_ON(!tsk_rt(t)->held_gpus); |
712 | 727 | ||
@@ -728,14 +743,24 @@ int gpu_owner_increase_priority(struct task_struct *t) | |||
728 | if (hp != t) { /* our position in the heap may have changed. hp is already at the root. */ | 743 | if (hp != t) { /* our position in the heap may have changed. hp is already at the root. */ |
729 | binheap_decrease(&tsk_rt(t)->gpu_owner_node, ®->owners); | 744 | binheap_decrease(&tsk_rt(t)->gpu_owner_node, ®->owners); |
730 | } | 745 | } |
731 | |||
732 | #ifdef CONFIG_LITMUS_SOFTIRQD | 746 | #ifdef CONFIG_LITMUS_SOFTIRQD |
747 | else { | ||
748 | /* unconditionally propagate - t already has the updated eff and is at the root, | ||
749 | so we can't detect a change in inheritance, but we know that priority has | ||
750 | indeed increased/changed. */ | ||
751 | increase_klmirqd = 1; | ||
752 | } | ||
753 | |||
733 | hp = container_of(binheap_top_entry(®->owners, struct rt_param, gpu_owner_node), | 754 | hp = container_of(binheap_top_entry(®->owners, struct rt_param, gpu_owner_node), |
734 | struct task_struct, rt_param); | 755 | struct task_struct, rt_param); |
735 | 756 | ||
736 | if (effective_priority(hp) != hp_eff) { /* the eff. prio. of hp has changed */ | 757 | /* check if the eff. prio. of hp has changed */ |
758 | if (increase_klmirqd || (effective_priority(hp) != hp_eff)) { | ||
737 | hp_eff = effective_priority(hp); | 759 | hp_eff = effective_priority(hp); |
738 | TRACE_CUR("%s/%d is new hp on GPU %d.\n", t->comm, t->pid, gpu); | 760 | TRACE_CUR("%s/%d (eff_prio = %s/%d) is new hp on GPU %d.\n", |
761 | t->comm, t->pid, | ||
762 | hp_eff->comm, hp_eff->pid, | ||
763 | gpu); | ||
739 | 764 | ||
740 | retval = gpu_klmirqd_increase_priority(reg->thread, hp_eff); | 765 | retval = gpu_klmirqd_increase_priority(reg->thread, hp_eff); |
741 | } | 766 | } |
@@ -781,7 +806,8 @@ int gpu_owner_decrease_priority(struct task_struct *t) | |||
781 | struct task_struct *new_hp = | 806 | struct task_struct *new_hp = |
782 | container_of(binheap_top_entry(®->owners, struct rt_param, gpu_owner_node), | 807 | container_of(binheap_top_entry(®->owners, struct rt_param, gpu_owner_node), |
783 | struct task_struct, rt_param); | 808 | struct task_struct, rt_param); |
784 | if (effective_priority(new_hp) != hp_eff) { /* eff prio. of hp has changed */ | 809 | /* if the new_hp is still t, or if the effective priority has changed */ |
810 | if ((new_hp == t) || (effective_priority(new_hp) != hp_eff)) { | ||
785 | hp_eff = effective_priority(new_hp); | 811 | hp_eff = effective_priority(new_hp); |
786 | TRACE_CUR("%s/%d is no longer hp on GPU %d.\n", t->comm, t->pid, gpu); | 812 | TRACE_CUR("%s/%d is no longer hp on GPU %d.\n", t->comm, t->pid, gpu); |
787 | retval = gpu_klmirqd_decrease_priority(reg->thread, hp_eff); | 813 | retval = gpu_klmirqd_decrease_priority(reg->thread, hp_eff); |