2022-07-09 16:51:21

by Paul Menzel

[permalink] [raw]
Subject: Lots of XEN init functions called in non-XEN environment

Dear Linux folks,


Booting Debian’s Linux kernel with `initcall_debug` on a laptop with no
XEN being used, I see a lot of Xen related init functions to be called.

```
$ sudo dmesg | grep -e balloon -e xen
[ 0.066207] calling xen_cons_init+0x0/0x50 @ 0
[ 0.066210] initcall xen_cons_init+0x0/0x50 returned 0 after 0 usecs
[ 0.096491] calling xen_pvh_gnttab_setup+0x0/0x34 @ 1
[ 0.096491] initcall xen_pvh_gnttab_setup+0x0/0x34 returned -19 after
0 usecs
[ 0.100353] calling xenbus_init+0x0/0x322 @ 1
[ 0.100353] initcall xenbus_init+0x0/0x322 returned -19 after 0 usecs
[ 0.100353] calling register_xen_pci_notifier+0x0/0x2d @ 1
[ 0.100353] initcall register_xen_pci_notifier+0x0/0x2d returned 0
after 0 usecs
[ 0.100353] calling xen_pcpu_init+0x0/0xb5 @ 1
[ 0.100353] initcall xen_pcpu_init+0x0/0xb5 returned -19 after 0 usecs
[ 0.169465] calling balloon_init+0x0/0x1e0 @ 1
[ 0.169467] initcall balloon_init+0x0/0x1e0 returned -19 after 0 usecs
[ 0.169470] calling xen_setup_shutdown_event+0x0/0x30 @ 1
[ 0.169473] initcall xen_setup_shutdown_event+0x0/0x30 returned -19
after 0 usecs
[ 0.169476] calling xenbus_probe_backend_init+0x0/0x6b @ 1
[ 0.169482] initcall xenbus_probe_backend_init+0x0/0x6b returned 0
after 0 usecs
[ 0.169485] calling xenbus_probe_frontend_init+0x0/0x4f @ 1
[ 0.169489] initcall xenbus_probe_frontend_init+0x0/0x4f returned 0
after 0 usecs
[ 0.169491] calling xen_acpi_pad_init+0x0/0x3c @ 1
[ 0.169493] initcall xen_acpi_pad_init+0x0/0x3c returned -19 after 0
usecs
[ 0.257640] calling xenfb_init+0x0/0x3b @ 1
[ 0.257642] initcall xenfb_init+0x0/0x3b returned -19 after 0 usecs
[ 0.259498] calling xenbus_probe_initcall+0x0/0x6f @ 1
[ 0.259599] initcall xenbus_probe_initcall+0x0/0x6f returned 0 after
98 usecs
[ 0.259615] calling xenbus_init+0x0/0x3b @ 1
[ 0.259617] initcall xenbus_init+0x0/0x3b returned -19 after 0 usecs
[ 0.259620] calling xenbus_backend_init+0x0/0x44 @ 1
[ 0.259622] initcall xenbus_backend_init+0x0/0x44 returned -19 after
0 usecs
[ 0.259666] calling xen_late_init_mcelog+0x0/0x5e @ 1
[ 0.259668] initcall xen_late_init_mcelog+0x0/0x5e returned -19 after
0 usecs
[ 0.259811] calling xen_hvc_init+0x0/0x1de @ 1
[ 0.259813] initcall xen_hvc_init+0x0/0x1de returned -19 after 0 usecs
[ 0.263794] calling xenkbd_init+0x0/0x3b @ 1
[ 0.263796] initcall xenkbd_init+0x0/0x3b returned -19 after 0 usecs
[ 0.285181] calling balloon_wait_finish+0x0/0xda @ 1
[ 0.285183] initcall balloon_wait_finish+0x0/0xda returned -19 after
0 usecs
```

All these drivers(?) are enabled in Debian’s Linux configuration to also
support XEN setups, but I wonder, if the system can’t detect once if
it’s running in a XEN environment, and if it’s not then to skip all the
XEN related init functions.


Kind regards,

Paul


2022-07-10 06:12:12

by Jürgen Groß

[permalink] [raw]
Subject: Re: Lots of XEN init functions called in non-XEN environment

On 09.07.22 18:29, Paul Menzel wrote:
> Dear Linux folks,
>
>
> Booting Debian’s Linux kernel with `initcall_debug` on a laptop with no XEN
> being used, I see a lot of Xen related init functions to be called.
>
> ```
> $ sudo dmesg | grep -e balloon -e xen
> [    0.066207] calling  xen_cons_init+0x0/0x50 @ 0
> [    0.066210] initcall xen_cons_init+0x0/0x50 returned 0 after 0 usecs
> [    0.096491] calling  xen_pvh_gnttab_setup+0x0/0x34 @ 1
> [    0.096491] initcall xen_pvh_gnttab_setup+0x0/0x34 returned -19 after 0 usecs
> [    0.100353] calling  xenbus_init+0x0/0x322 @ 1
> [    0.100353] initcall xenbus_init+0x0/0x322 returned -19 after 0 usecs
> [    0.100353] calling  register_xen_pci_notifier+0x0/0x2d @ 1
> [    0.100353] initcall register_xen_pci_notifier+0x0/0x2d returned 0 after 0 usecs
> [    0.100353] calling  xen_pcpu_init+0x0/0xb5 @ 1
> [    0.100353] initcall xen_pcpu_init+0x0/0xb5 returned -19 after 0 usecs
> [    0.169465] calling  balloon_init+0x0/0x1e0 @ 1
> [    0.169467] initcall balloon_init+0x0/0x1e0 returned -19 after 0 usecs
> [    0.169470] calling  xen_setup_shutdown_event+0x0/0x30 @ 1
> [    0.169473] initcall xen_setup_shutdown_event+0x0/0x30 returned -19 after 0
> usecs
> [    0.169476] calling  xenbus_probe_backend_init+0x0/0x6b @ 1
> [    0.169482] initcall xenbus_probe_backend_init+0x0/0x6b returned 0 after 0 usecs
> [    0.169485] calling  xenbus_probe_frontend_init+0x0/0x4f @ 1
> [    0.169489] initcall xenbus_probe_frontend_init+0x0/0x4f returned 0 after 0
> usecs
> [    0.169491] calling  xen_acpi_pad_init+0x0/0x3c @ 1
> [    0.169493] initcall xen_acpi_pad_init+0x0/0x3c returned -19 after 0 usecs
> [    0.257640] calling  xenfb_init+0x0/0x3b @ 1
> [    0.257642] initcall xenfb_init+0x0/0x3b returned -19 after 0 usecs
> [    0.259498] calling  xenbus_probe_initcall+0x0/0x6f @ 1
> [    0.259599] initcall xenbus_probe_initcall+0x0/0x6f returned 0 after 98 usecs
> [    0.259615] calling  xenbus_init+0x0/0x3b @ 1
> [    0.259617] initcall xenbus_init+0x0/0x3b returned -19 after 0 usecs
> [    0.259620] calling  xenbus_backend_init+0x0/0x44 @ 1
> [    0.259622] initcall xenbus_backend_init+0x0/0x44 returned -19 after 0 usecs
> [    0.259666] calling  xen_late_init_mcelog+0x0/0x5e @ 1
> [    0.259668] initcall xen_late_init_mcelog+0x0/0x5e returned -19 after 0 usecs
> [    0.259811] calling  xen_hvc_init+0x0/0x1de @ 1
> [    0.259813] initcall xen_hvc_init+0x0/0x1de returned -19 after 0 usecs
> [    0.263794] calling  xenkbd_init+0x0/0x3b @ 1
> [    0.263796] initcall xenkbd_init+0x0/0x3b returned -19 after 0 usecs
> [    0.285181] calling  balloon_wait_finish+0x0/0xda @ 1
> [    0.285183] initcall balloon_wait_finish+0x0/0xda returned -19 after 0 usecs
> ```
>
> All these drivers(?) are enabled in Debian’s Linux configuration to also support
> XEN setups, but I wonder, if the system can’t detect once if it’s running in a
> XEN environment, and if it’s not then to skip all the XEN related init functions.

You are aware how initcall is working? If not, I'd recommend to read the
code.

So how would you skip initcalls for Xen other than bailing out early in
each Xen related initcall if the system is not running as a Xen guest,
which is how it works today?


Juergen


Attachments:
OpenPGP_0xB0DE9DD628BF132F.asc (3.08 kB)
OpenPGP public key
OpenPGP_signature (505.00 B)
OpenPGP digital signature
Download all attachments