Re: [systemd-devel] Udevd and dev file creation

2022-02-06 Thread Greg KH
On Sun, Feb 06, 2022 at 01:43:08PM +0530, Nishant Nayan wrote:
> While reading the code I came across :-
> struct Manager
> struct Worker
> Can you please provide an overview on these, I did not get a clear cut
> explanation on these structs, the code only has its member variables.

Those are the "workers" that handle the uevents that are sent by the
kernel.  Put the program in a debugger to see how they work if you have
questions.

> Also what is the variable 'arg_children_max'
> Why is it specifically set to 8 + no_of_cpus*2 ?

Because based on tuning, that's the "best" number that was come up with.
If in your testing you think it should be different, please submit a
patch.

But note that the current number has been tested to work well on both
single CPU machines, as well as machines with thousands of cpus that
bring hundreds of thousands of devices online all at once when booting.

thanks,

greg k-h


Re: [systemd-devel] Udevd and dev file creation

2022-02-06 Thread Nishant Nayan
While reading the code I came across :-
struct Manager
struct Worker
Can you please provide an overview on these, I did not get a clear cut
explanation on these structs, the code only has its member variables.
Also what is the variable 'arg_children_max'
Why is it specifically set to 8 + no_of_cpus*2 ?


Regards
Nishant Nayan

On Tue, 1 Feb 2022, 14:13 Greg KH,  wrote:

> On Tue, Feb 01, 2022 at 10:08:04AM +0530, Nishant Nayan wrote:
> > Thanks, I will check that out.
> > Is there any site where I can gain in depth code level knowledge of
> > systemd-udevd?
>
> The code is all there for you to read and understand directly.  What
> specific questions did you have that you did not understand after
> reading it?
>
> thanks,
>
> greg k-h
>


Re: [systemd-devel] Udevd and dev file creation

2022-02-01 Thread Lennart Poettering
On Di, 01.02.22 16:04, Nishant Nayan (nayan.nishant2...@gmail.com) wrote:

> One thought
> Is it advisable to turn off systemd-udevd if I am sure that I won't be
> adding /removing any devices to my server.

Note that there are various synthetic/virtual devices that are created
on app request, i.e. lvm, loopback, network devices and such. We live
in a dynamic and virtual world, where devices come and go all the
time.

Moreover there are various devices that send out uevents for
change notification of various forms. If you turn off udev apps won't
get those either. i.e. udev is about more than just plug + unplug.

If you stop udev apps waiting for their devices to show up won't be
able to ever get the ready notifications for that and thus will stop
working.

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] Udevd and dev file creation

2022-02-01 Thread Nishant Nayan
Just wanted to know what will happen.


Nishant

On Tue, 1 Feb 2022, 16:14 Greg KH,  wrote:

> On Tue, Feb 01, 2022 at 04:04:01PM +0530, Nishant Nayan wrote:
> > One thought
> > Is it advisable to turn off systemd-udevd if I am sure that I won't be
> > adding /removing any devices to my server.
>
> Why would you want to do that?
>
> > Or udev also does some work while rebooting?
>
> When booting, yes.
>


Re: [systemd-devel] Udevd and dev file creation

2022-02-01 Thread Greg KH
On Tue, Feb 01, 2022 at 04:04:01PM +0530, Nishant Nayan wrote:
> One thought
> Is it advisable to turn off systemd-udevd if I am sure that I won't be
> adding /removing any devices to my server.

Why would you want to do that?

> Or udev also does some work while rebooting?

When booting, yes.


Re: [systemd-devel] Udevd and dev file creation

2022-02-01 Thread Nishant Nayan
One thought
Is it advisable to turn off systemd-udevd if I am sure that I won't be
adding /removing any devices to my server.
Or udev also does some work while rebooting?

Regards
Nishant Nayan

On Tue, 1 Feb 2022, 14:13 Greg KH,  wrote:

> On Tue, Feb 01, 2022 at 10:08:04AM +0530, Nishant Nayan wrote:
> > Thanks, I will check that out.
> > Is there any site where I can gain in depth code level knowledge of
> > systemd-udevd?
>
> The code is all there for you to read and understand directly.  What
> specific questions did you have that you did not understand after
> reading it?
>
> thanks,
>
> greg k-h
>


Re: [systemd-devel] Udevd and dev file creation

2022-02-01 Thread Greg KH
On Tue, Feb 01, 2022 at 10:08:04AM +0530, Nishant Nayan wrote:
> Thanks, I will check that out.
> Is there any site where I can gain in depth code level knowledge of
> systemd-udevd?

The code is all there for you to read and understand directly.  What
specific questions did you have that you did not understand after
reading it?

thanks,

greg k-h


Re: [systemd-devel] Udevd and dev file creation

2022-01-31 Thread Nishant Nayan
Thanks, I will check that out.
Is there any site where I can gain in depth code level knowledge of
systemd-udevd?


Regards
Nishant Nayan

On Mon, 31 Jan 2022, 17:13 Lennart Poettering,  wrote:

> On So, 30.01.22 17:14, Nishant Nayan (nayan.nishant2...@gmail.com) wrote:
>
> > I have started reading about udevd.
> > I was trying to find out if there is a way to play with udev without
> > plugging in/out any devices.
> > Is there a way to trigger a uevent without plugging in devices?
>
> use "udevadm trigger" to fire uevents for existing devices.
>
> Or create new, synthetic virtual devices during runtime, for example
> via "losetup".
>
> Lennart
>
> --
> Lennart Poettering, Berlin
>


Re: [systemd-devel] Udevd and dev file creation

2022-01-31 Thread Lennart Poettering
On So, 30.01.22 17:14, Nishant Nayan (nayan.nishant2...@gmail.com) wrote:

> I have started reading about udevd.
> I was trying to find out if there is a way to play with udev without
> plugging in/out any devices.
> Is there a way to trigger a uevent without plugging in devices?

use "udevadm trigger" to fire uevents for existing devices.

Or create new, synthetic virtual devices during runtime, for example
via "losetup".

Lennart

--
Lennart Poettering, Berlin


Re: [systemd-devel] Udevd and dev file creation

2022-01-30 Thread Greg KH
On Sun, Jan 30, 2022 at 05:14:49PM +0530, Nishant Nayan wrote:
> I have started reading about udevd.
> I was trying to find out if there is a way to play with udev without
> plugging in/out any devices.
> Is there a way to trigger a uevent without plugging in devices?

Yes, look at the man page for udevadm.  It lets you trigger any uevent
for the devices in your system that you want.

But again, remember for almost everything, udev does not create /dev/
nodes, that is done by the kernel itself.

good luck!

greg k-h


Re: [systemd-devel] Udevd and dev file creation

2022-01-30 Thread Nishant Nayan
I have started reading about udevd.
I was trying to find out if there is a way to play with udev without
plugging in/out any devices.
Is there a way to trigger a uevent without plugging in devices?


Regards
Nishant Nayan

On Sun, 30 Jan 2022, 17:13 Nishant Nayan, 
wrote:

> Oops.
> Thanks for pointing that out, I just pressed the reply button, didn't
> notice it.
> Resending now.
>
>
> Regards
> Nishant Nayan
>
> On Sun, 30 Jan 2022, 17:12 Greg KH,  wrote:
>
>> On Sun, Jan 30, 2022 at 05:07:52PM +0530, Nishant Nayan wrote:
>>
>> 
>>
>> For some reason you sent this only to me, which is a bit rude to
>> everyone else on the mailing list.  I'll be glad to respond if you
>> resend it to everyone.
>>
>> thanks,
>>
>> greg k-h
>>
>


Re: [systemd-devel] Udevd and dev file creation

2022-01-29 Thread Greg KH
On Sun, Jan 30, 2022 at 09:15:14AM +0530, Nishant Nayan wrote:
> Hi,
>  Does creating a dev file in /dev creates a uevent?

The kernel creates /dev files directly in devtmpfs.  When that happens,
yes the kernel sends a uevent.

If a user creates a /dev file on their own, no, no ueven happens.

> Does a dev file creation considered as a "device attached" to the
> machine?

Not at all, it is totally independent and does not mean that.

What problem are you having with the current kernel and /dev files?

thanks,

greg k-h


[systemd-devel] Udevd and dev file creation

2022-01-29 Thread Nishant Nayan
Hi,
 Does creating a dev file in /dev creates a uevent? Does a dev file
creation considered as a "device attached" to the machine?


Regards
Nishant Nayan