<div dir="ltr">Thanks, I changed the _Scheduler_Strong_APA_Get_lowest_scheduled to make it responsible for preempting and allocating the processors and doing the entire backtracking on its own.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 18, 2020 at 11:41 PM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Aug 18, 2020 at 11:20 AM Richi Dubey <<a href="mailto:richidubey@gmail.com" target="_blank">richidubey@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Thanks for the help. I looked at the call trace and figured out what is wrong.<br>
><br>
> As we had discussed earlier, We would be changing the passed variable filter_base pointer (done here) to the function _Scheduler_strong_Get_lowest_scheduled because after _Scheduler_SMP_Enqueue calls the former function, it either (see code here) preempts the lowest scheduled node and allocates the processor to node (filter_base) or for the case lowest_scheduled has a higher priority (lower priority number) it simply inserts the current node (or the filter_base) into the ready queue.<br>
><br>
> When implementing the Strong_APA, the filter_node actually displaces the higher priority node :<br>
><br>
> Ex :<br>
> A system with 2 CPUs, Tasks with lower task numbers have higher priority.<br>
><br>
> T1: Allocated CPU 1. Affinity to both CPUs<br>
> T3: Allocated CPU 2. Affinity to both CPUs<br>
><br>
> T2: Just Arrived. Affinity only to CPU1.<br>
><br>
> In this case, T2 would preempt T1 (A higher priority task) and T1 would preempt T3.<br>
><br>
> So, to make sure this works with our SMP framework, we had decided to change/make filter_base point to T1 and lowest_scheduled to T3 after preempting T2 preempts T1, after which SMP_Enqueue would preempt T3 and schedule T1.<br>
><br>
> But this is not working because when we change filter_base from _Scheduler_strong_Get_lowest_scheduled (done here), the value of the node in SMP_Enqueue does not get changed (Because it is a pass by value of pointers). Also, there is no way to change the insert_priority variable in SMP_Enqueue either.<br>
><br>
> What should we do now? Can we change the SMP_Enqueue function to account for the way Strong_APA behaves?<br>
><br>
<br>
No. Try to think through if you can solve this a different way. Maybe<br>
you can store something in the context?<br>
<br>
><br>
><br>
><br>
> On Tue, Aug 18, 2020 at 9:40 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br>
>><br>
>> On Tue, Aug 18, 2020 at 9:21 AM Richi Dubey <<a href="mailto:richidubey@gmail.com" target="_blank">richidubey@gmail.com</a>> wrote:<br>
>> ><br>
>> > Hi,<br>
>> ><br>
>> > This question is wrt the use of Scheduler_SMP_Preempt here. This function eventually calls Allocate_Processor and while tracing with gdb, everything is going as I planned, i.e. the correct node is getting preempted and the caller to it is getting allocated the CPU. But, the test fails here, because eventually the heir is not changed.<br>
>> ><br>
>> > Do I have to explicitly change the heir when I am trying to schedule a node/thread on a different processor? Is doing SMP_Preempt not enough? Please suggest.<br>
>> ><br>
>> The heir should get set (in SMP scheduling) by call to<br>
>> _Thread_Dispatch_update_heir() from Allocate_Processor. Probably you<br>
>> need to look at your allocate_processor hook.<br>
>><br>
>> > Thanks,<br>
>> > Richi.<br>
>> ><br>
>> > _______________________________________________<br>
>> > devel mailing list<br>
>> > <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
>> > <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>