Re: How to determine when kernel booting has completed ?

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

 



Hi Manish...

On Sat, Nov 15, 2008 at 5:22 PM, Manish Katiyar <mkatiyar@xxxxxxxxx> wrote:
> Hi,
>
> I got a simple (probably silly question) while we were trying to hook
> a system call few days back in one of the threads posted earlier.
> Let's say I want to log all the users/calls of someone calling
> kmem_cache_alloc() after the system has come up ie... any external
> module which might be calling this during load.
>
>  If I just add a printk to log it will record all the calls, not the
> one which were made after the kernel came up and we logged into the
> system (or userspace scripts loaded some module during booting). So
> the basic question is how do i conditionalize this printk. From kernel
> how can I know that my system is still booting or it has come up ?? Is
> there any global variable for example which says kernel_state=BOOTING
> or any other way which tells me in what phase of booting are we ? If
> it were I could have easily done something like :-
>
> if (kernel_state  >= BOOT_COMPLETE)
>       printk(...........);
>
> Makes sense ???

Probably not a smart answer, but I could share my thought. There are
many stage in booting,for example the transition between real mode to
protected mode. IIRC, this can be determined by checking CR3 register.

Or maybe, another sign we go into usable system (login shell is ready,
daemons are running) are by checking if certain kernel threads exist.
Kinda expensive operation of course, but doable IMO.

Kinda silly but perhaps easier: check jiffies. Let's say you predict
that system will go into certain state after N seconds. By converting
N into jiffies, then you can get a good guess in what state of booting
you currently are.

regards,

Mulyadi.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux