On Wed, 2023-06-28 at 15:35 +0200, Peter Zijlstra wrote: > On Wed, Jun 28, 2023 at 12:28:12AM +0000, Huang, Kai wrote: > > On Tue, 2023-06-27 at 22:37 +0000, Huang, Kai wrote: > > > > > > > > > > +/* > > > > > + * Do the module global initialization if not done yet. > > > > > + * It's always called with interrupts and preemption disabled. > > > > > + */ > > > > > > > > If interrupts are always disabled why do you need _irqsave()? > > > > > > > > > > I'll remove the _irqsave(). > > > > > > AFAICT Isaku preferred this for additional security, but this is not > > > necessary. > > > > > > > > > > Damn. I think we can change the comment to say this function is called with > > preemption being disabled, but _can_ be called with interrupt disabled. And we > > keep using the _irqsave() version. > > > > /* > > * Do the module global initialization if not done yet. It's always > > * called with preemption disabled and can be called with interrupts > > * disabled. > > */ > > That's still not explaining *why*, what you want to say is: > > Can be called locally or through an IPI function call. > Thanks. As in another reply, if using spinlock is OK, then I think we can say it will be called either locally or through an IPI function call. Otherwise, we do via a new separate function tdx_global_init() and no lock is needed in that function. The caller should call it properly.