Re: [RFC v8 12/20] um: lkl: initialization and cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Mar 2021 05:40:39 +0900,
Johannes Berg wrote:
> 
> On Wed, 2021-01-20 at 11:27 +0900, Hajime Tazaki wrote:
> > 
> > +	panic_blink = lkl_panic_blink;
> 
> Using a panic notifier would seem more appropriate?

I understand;  will investigate if we can change.

> > +	init_sem = lkl_sem_alloc(0);
> 
> what's the deal with this?
> 
> > +	if (!init_sem)
> > +		return -ENOMEM;
> > +
> > +	ret = lkl_cpu_init();
> > +	if (ret)
> > +		goto out_free_init_sem;
> > +
> > +	ret = lkl_thread_create(lkl_run_kernel, NULL);
> > +	if (!ret) {
> > +		ret = -ENOMEM;
> > +		goto out_free_init_sem;
> > +	}
> > +
> > +	lkl_sem_down(init_sem);
> > +	lkl_sem_free(init_sem);
> 
> You free it before the kernel really even started?

The semaphore (init_sem) is unlocked at lkl_run_init(), so this waits
for finishing the init call. After the initialization ends, it's safe
to free as it's no longer used.

I may add some description here to make it clear.

-- Hajime



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux