All of lore.kernel.org
 help / color / mirror / Atom feed
* Autoload kernel module works only once
@ 2017-03-13 14:36 Andrea Laini
  2017-03-13 15:37 ` Leonardo Sandoval
  2017-03-13 20:28 ` Khem Raj
  0 siblings, 2 replies; 4+ messages in thread
From: Andrea Laini @ 2017-03-13 14:36 UTC (permalink / raw)
  To: yocto@yoctoproject.org

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

Hi everybody,

I'm getting some errors after building my Linux distro with the use of KERNEL_MODULE_AUTOLOAD to allow autoloading 2 of my custom out-of-tree device at boot time. We've a Poky 1.7 version.

So, before building the new image with the Yocto keyword KERNEL_MODULE_AUTOLOAD, I was able to load and open (and, obviously, use) my devices simply by calling 'modprobe mydevice' after logging in. Restarting the board, everything was still working well.
Since I've rebuild a new image enabling module autoload at boot time, modules are always loaded, but I'm able to open (and use) them only really first time I switched on the board after downloading new image. After the first reboot, LKMs are still loaded (calling 'lsmod' show them) but I can't open them, neither from my C program nor reading/writing them from '/dev/mydevice'.

To me it sound a very strange behavior.

Hope anyone can help,
Many thanks

Andrea


Andrea Laini

Email: andrea.laini@claypaky.it<mailto:andrea.laini@claypaky.it>
_________________________________
Clay Paky S.p.A.
AN OSRAM BUSINESS
Via Pastrengo, 3/b - 24068 Seriate (BG) - ITALY
Phone: +39 - 035.654.311 - Fax: +39 - 035.30.18.76
Web: www.claypaky.it<http://www.claypaky.it/>
_________________________________
Read our Disclaimer @  www.claypaky.it/disclaimer<http://www.claypaky.it/disclaimer/index.html>



[-- Attachment #2: Type: text/html, Size: 6695 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Autoload kernel module works only once
  2017-03-13 14:36 Autoload kernel module works only once Andrea Laini
@ 2017-03-13 15:37 ` Leonardo Sandoval
  2017-03-13 20:28 ` Khem Raj
  1 sibling, 0 replies; 4+ messages in thread
From: Leonardo Sandoval @ 2017-03-13 15:37 UTC (permalink / raw)
  To: Andrea Laini; +Cc: yocto@yoctoproject.org

On Mon, 2017-03-13 at 14:36 +0000, Andrea Laini wrote:
> Hi everybody,
> 
>  
> 
> I’m getting some errors after building my Linux distro with the use of
> KERNEL_MODULE_AUTOLOAD to allow autoloading 2 of my custom out-of-tree
> device at boot time. We’ve a Poky 1.7 version.
> 
>  
> 
> So, before building the new image with the Yocto keyword
> KERNEL_MODULE_AUTOLOAD, I was able to load and open (and, obviously,
> use) my devices simply by calling ‘modprobe mydevice’ after logging
> in. Restarting the board, everything was still working well.
> 
> Since I’ve rebuild a new image enabling module autoload at boot time,
> modules are always loaded, but I’m able to open (and use) them only
> really first time I switched on the board after downloading new image.
> After the first reboot, LKMs are still loaded (calling ‘lsmod’ show
> them) but I can’t open them, neither from my C program nor
> reading/writing them from ‘/dev/mydevice’.


I am not a kernel expert, but do you know if file permissions change
after first boot? you may enable debugging at your device and view it
with dmesg, that would give you more clues. 

> 
>  
> 
> To me it sound a very strange behavior.
> 
>  
> 
> Hope anyone can help,
> 
> Many thanks
> 
>  
> 
> Andrea
> 
>  
> 
> 
> Andrea Laini
> 
> Email:andrea.laini@claypaky.it
> _________________________________
> Clay Paky S.p.A.
> AN OSRAM BUSINESS 
> Via Pastrengo, 3/b - 24068 Seriate (BG) - ITALY
> Phone: +39 - 035.654.311 - Fax: +39 - 035.30.18.76
> Web: www.claypaky.it
> _________________________________
> Read our Disclaimer @  www.claypaky.it/disclaimer
> 
> 
> 
>  
> 
> 
> -- 
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Autoload kernel module works only once
  2017-03-13 14:36 Autoload kernel module works only once Andrea Laini
  2017-03-13 15:37 ` Leonardo Sandoval
@ 2017-03-13 20:28 ` Khem Raj
  2017-03-14  7:35   ` Andrea Laini
  1 sibling, 1 reply; 4+ messages in thread
From: Khem Raj @ 2017-03-13 20:28 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 1879 bytes --]



On 3/13/17 7:36 AM, Andrea Laini wrote:
> Hi everybody,
> 
>  
> 
> I’m getting some errors after building my Linux distro with the use of
> KERNEL_MODULE_AUTOLOAD to allow autoloading 2 of my custom out-of-tree
> device at boot time. We’ve a Poky 1.7 version.
> 
>  
> 
> So, before building the new image with the Yocto keyword
> KERNEL_MODULE_AUTOLOAD, I was able to load and open (and, obviously,
> use) my devices simply by calling ‘modprobe mydevice’ after logging in.
> Restarting the board, everything was still working well.
> 
> Since I’ve rebuild a new image enabling module autoload at boot time,
> modules are always loaded, but I’m able to open (and use) them only
> really first time I switched on the board after downloading new image.
> After the first reboot, LKMs are still loaded (calling ‘lsmod’ show
> them) but I can’t open them, neither from my C program nor
> reading/writing them from ‘/dev/mydevice’.

look out for any race conditions for dependencies. Since it will now
autoload the modules and its possible that you were depending on some
system behavior that was enabled late in boot process, but it worked
since you did it after logging in and manually doing modprobe.

> 
>  
> 
> To me it sound a very strange behavior.
> 
>  
> 
> Hope anyone can help,
> 
> Many thanks
> 
>  
> 
> Andrea
> 
>  
> 
> 
> *Andrea Laini
> 
> *Email: andrea.laini@claypaky.it <mailto:andrea.laini@claypaky.it>
> *_________________________________*
> *Clay Paky S.p.A.
> *AN OSRAM BUSINESS
> Via Pastrengo, 3/b - 24068 Seriate (BG) - ITALY
> Phone: +39 - 035.654.311 - Fax: +39 - 035.30.18.76
> Web: www.claypaky.it <http://www.claypaky.it/>
> *_________________________________*
> Read our Disclaimer @  www.claypaky.it/disclaimer
> <http://www.claypaky.it/disclaimer/index.html>
> 
>  
> 
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Autoload kernel module works only once
  2017-03-13 20:28 ` Khem Raj
@ 2017-03-14  7:35   ` Andrea Laini
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Laini @ 2017-03-14  7:35 UTC (permalink / raw)
  To: Khem Raj, yocto@yoctoproject.org

Thanks Khem for your anwer,

The device in question are 2 simple character devices, that just read/write IO registers of the SoC. I don't think they depend on something else, but surely what I've noticed is that first time I power-on the system they're loaded later than successive bootings.

What I've also seen is that very first time the system started, the device number of my module in /dev/mydevice and /sys/class/myclass/mydevice/dev are exactly the same 

	/dev/mydevice					Major = 247, Minor = 0
	/sys/class/myclass/mydevice/dev		Major = 247, Minor = 0

while from the time I reboot the system the one in /sys/class/myclass/mydevice/dev is increment by 1 respect to the other 

	/dev/mydevice					Major = 247, Minor = 0
	/sys/class/myclass/mydevice/dev		Major = 248, Minor = 0


Andrea Laini


-----Messaggio originale-----
Da: yocto-bounces@yoctoproject.org [mailto:yocto-bounces@yoctoproject.org] Per conto di Khem Raj
Inviato: lunedì 13 marzo 2017 21:29
A: yocto@yoctoproject.org
Oggetto: Re: [yocto] Autoload kernel module works only once



On 3/13/17 7:36 AM, Andrea Laini wrote:
> Hi everybody,
> 
>  
> 
> I'm getting some errors after building my Linux distro with the use of 
> KERNEL_MODULE_AUTOLOAD to allow autoloading 2 of my custom out-of-tree 
> device at boot time. We've a Poky 1.7 version.
> 
>  
> 
> So, before building the new image with the Yocto keyword 
> KERNEL_MODULE_AUTOLOAD, I was able to load and open (and, obviously,
> use) my devices simply by calling 'modprobe mydevice' after logging in.
> Restarting the board, everything was still working well.
> 
> Since I've rebuild a new image enabling module autoload at boot time, 
> modules are always loaded, but I'm able to open (and use) them only 
> really first time I switched on the board after downloading new image.
> After the first reboot, LKMs are still loaded (calling 'lsmod' show
> them) but I can't open them, neither from my C program nor 
> reading/writing them from '/dev/mydevice'.

look out for any race conditions for dependencies. Since it will now autoload the modules and its possible that you were depending on some system behavior that was enabled late in boot process, but it worked since you did it after logging in and manually doing modprobe.

> 
>  
> 
> To me it sound a very strange behavior.
> 
>  
> 
> Hope anyone can help,
> 
> Many thanks
> 
>  
> 
> Andrea
> 
>  
> 
> 
>  
> 
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-14  7:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-13 14:36 Autoload kernel module works only once Andrea Laini
2017-03-13 15:37 ` Leonardo Sandoval
2017-03-13 20:28 ` Khem Raj
2017-03-14  7:35   ` Andrea Laini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.