<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 3, 2020 at 9:35 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 Sun, Aug 2, 2020 at 5:46 AM Utkarsh Rai <<a href="mailto:utkarsh.rai60@gmail.com" target="_blank">utkarsh.rai60@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Sat, Aug 1, 2020 at 10:51 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> wrote:<br>
>><br>
>> On Sat, Aug 1, 2020 at 10:38 AM Utkarsh Rai <<a href="mailto:utkarsh.rai60@gmail.com" target="_blank">utkarsh.rai60@gmail.com</a>> wrote:<br>
>> ><br>
>> > This thread is an attempt to consolidate and resolve all the issues that have been raised related to my patches- 1. <a href="https://lists.rtems.org/pipermail/devel/2020-July/060675.html" rel="noreferrer" target="_blank">https://lists.rtems.org/pipermail/devel/2020-July/060675.html</a> and 2. <a href="https://lists.rtems.org/pipermail/devel/2020-July/061056.html" rel="noreferrer" target="_blank">https://lists.rtems.org/pipermail/devel/2020-July/061056.html</a>. I intend to first resolve all the issues through this thread( and probably convert this into a blog-post ), before making any further changes.<br>
>> ><br>
>> > 1. Stack address name that needs to be passed to shm_open() - This was briefly discussed here, and I believe the reason we still have issues with this is because of my incorrect interpretation of what was suggested. My idea was that we need to assign a name like "/taskfs/pid" to each stack address on the creation of the thread. On looking around further, I realize we can have the stack address name the same as the thread name.<br>
>> ><br>
>> ok. the /taskfs idea was more of a longer-term concept. I think it<br>
>> would require possibly an entire GSoC itself. It'd be nice though :)<br>
>><br>
>> > 2. Switching out shared stacks- In my current implementation, removing protected stacks is done through assembly code but the '_Stackprotection_Context_switch' which switches out the shared stack is difficult to implement in assembly. But we need to integrate the shared stack switching in the context switching code as we don't have access to executing thread attributes anywhere else.<br>
>> ><br>
>> I think the real problem here is that your code to switch stacks is<br>
>> too complicated. It would certainly be folly to try to implement<br>
>> linked list processing in assembly of the context switch, but you<br>
>> shouldn't need to be walking a linked list anyway. There are simpler<br>
>> solutions that would work just as well, including replacing the entire<br>
>> address space (e.g., switching the page table base register) or using<br>
>> an array to store the shared stack addresses and just iterating the<br>
>> array.<br>
><br>
><br>
> Ok, but this would mean that we can only share a set number of stacks with each thread?<br>
><br>
<br>
Perhaps. You might be able to use an extendable array if the number of<br>
shared stacks is configurable. This again goes into the problem that<br>
configuration hasn't been solved yet.<br></blockquote><div><br></div><div>Ok, I will do this with a fixed array for now. I have started to try out the new build system and most probably try to resolve the configuration issue this week</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
>><br>
>><br>
>> > 3. Integration of the 'Stackprotection_attr' structure with the thread and stack control structure - The integration is a pretty straightforward task, the difficulty lies in handling the attribute offset in the assembly code, whereas having the 'Stackprotection_attr' just after the context control attribute in the thread control structure makes handling the offset relatively easy.<br>
>> ><br>
>> The Stack_Control is embedded already, you just need to calculate the<br>
>> location of Thread_Control.Start.Initial_stack first, and then offset<br>
>> within that structure.<br>
><br>
><br>
> I agree it's just that it is extra work and maybe I was being lazy :).<br>
<br>
Maybe. Sometimes it is better to pay now than later though.<br>
</blockquote></div></div>