On Mon, Mar 22, 2021 at 10:59:31AM +0000, Nikos Nikoleris wrote: > Hi Alex, > > On 22/03/2021 10:34, Alexandru Elisei wrote: > > Hi Nikos, > > > > On 3/19/21 12:24 PM, Nikos Nikoleris wrote: > > > Introduce a new flag in the thread_info to track whether a thread_info > > > struct is initialized yet or not. > > > > There's no explanation why this is needed. The flag checked only by is_user(), and > > before thread_info is initialized, flags is zero, so is_user() would return false, > > right? Or am I missing something? > > > > I am still not sure what's the right approach here. I didn't like and I > still don't like the fact that we rely on implicit 0 initialization to get > the right behavior. This will break once we add support for EFI. I think we > should explicitly initialize thread_info to 0. I just sent a patch doing this. Let me know what you think. > I was thinking of adding a > thread_info_alloc() function to do this. I'm not sure how this would look. We want the thread-info to live on the bottom of the stack and the bootcpu's stack is allocated in the linker script. > > By having this flag I think we can guard accesses to the thread_info in > general. I didn't want to turn the define smp_processor_id to a function > here but I think we should and assert that the thread_info is valid and > avoid reading current_thread_info()->cpu. Hmm, yeah, hopefully we can avoid this flag and adding an assert to smp_processor_id(). Let's take another look at this after we ensure that the thread-info is explicitly zeroed at startup. Thanks, drew