On Sun, 12 Feb 2023 at 21:29, Martin Decky <[email protected]> wrote:
>
> Dear Jiri Z.,
>
> > Author: Jiří Zárevúcky <[email protected]>
> > Date: 2023-02-10T16:18:53+01:00
> > SHA1: daadfa699247351099d4c91048e2f9e9a29c346a
> > URL: 
> > https://github.com/HelenOS/helenos/commit/daadfa699247351099d4c91048e2f9e9a29c346a
> > Message: Remove unnecessary context field from cpu_t structure
>
> I'm not confident that this change is a good idea. Both the main_ap()
> and the scheduler() functions run on a "borrowed stack", so to speak. In
> other words, they have very little control over the stack configuration.
> Therefore it makes sense to limit their own stack usage to bare minimum
> in order to avoid stack overflow.
>
> The size of context_t might not be trivial on some platforms and
> therefore it makes sense to have it in a fixed location that is
> guaranteed to be always available instead of placing it on the stack in
> this unusual situation.
>
> I have no doubt that you have actually tested your change on all
> architectures, but it is still that kind of code where I would happily
> trade the certain amount of "potentially wasted memory" for being sure
> that there cannot be any surprises.
>
> If I can suggest an alternative approach, how about implementing an
> elegant way to switch to the separated stack without the need for the
> entire context_t?
>

Hello Martin,
a reasonable concern, and thank you for taking the time to review my commits.

That said, I'm in the process of changing the context switching code
so that most of the structure becomes unnecessary.
All that's really needed in context_t is IP, SP and possibly an
argument field if we want to be fancy about new context
initialization.
With that in mind, I'm hoping the next few commits will resolve any
risks from this change. If you have any further concerns after that,
I'll be happy to accommodate!

-- J.Z.

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to