Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1695763

Summary: Installing the kernel-core rpm takes a long time if other kernels are already installed
Product: Red Hat Enterprise Linux 8 Reporter: Prarit Bhargava <prarit>
Component: kmodAssignee: Yauheni Kaliuta <ykaliuta>
Status: CLOSED ERRATA QA Contact: Ziqian SUN (Zamir) <zsun>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: fhrbata, skozina, ykaliuta
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 25-13.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:06:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1696304    
Attachments:
Description Flags
Handle independent modules in one run none

Description Prarit Bhargava 2019-04-03 17:57:42 UTC
Description of problem: As more and more kernels are installed the install time for the kernel-core package increases from a minute to more than ten minutes.


Version-Release number of selected component (if applicable):kernel-4.18.0-80.7.el8 


How reproducible:


Steps to Reproduce:
1. Install other kernels.

Actual results: As more and more kernels are added the time to install the kernel-core rpm increases tremendously.  Ten minutes to install a kernel is unacceptably long.  It "feels" like the system is stalled and this will result in customer calls and poor experience.


Expected results:  Install shouldn't take that long.


Additional info:  Let's first figure out what is taking so long compared to RHEL7.

Comment 1 Yauheni Kaliuta 2019-04-04 10:15:16 UTC
It applies to RHEL7 as well, just you do not have there kernel-modules-extra.
The reason is in "grouping algorithm".

Comment 2 Yauheni Kaliuta 2019-04-16 11:34:39 UTC
Created attachment 1555492 [details]
Handle independent modules in one run

Comment 3 Yauheni Kaliuta 2019-04-16 12:02:36 UTC
Having kernel-core-4.18.0-80.el8.x86_64 and kernel-modules-extra-4.18.0-80.el8.x86_64 installed.

Installation times:
Without the patch:

5:05.37 kernel-debug-core-4.18.0-80.el8.x86_64.rpm
5:16.58 kernel-debug-core-4.18.0-80.2.el8.x86_64.rpm
2:28.61 kernel-core-4.18.0-80.1.el8.x86_64.rpm
2:27.07 kernel-core-4.18.0-80.2.el8.x86_64.rpm

With the patch:

52.621 kernel-debug-core-4.18.0-80.el8.x86_64.rpm
52.880 kernel-debug-core-4.18.0-80.2.el8.x86_64.rpm
35.863 kernel-core-4.18.0-80.1.el8.x86_64.rpm
36.577 kernel-core-4.18.0-80.2.el8.x86_64.rpm

6x times faster for the content of kernel-modules-extra-4.18.0-80.el8.x86_64 (it depends of amount of modules and their group configuration).

non-debug versions are compatible so do not perform rollback. Looks like a place for optimization as well.

Comment 4 Yauheni Kaliuta 2019-04-16 14:30:28 UTC
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=21181358 scratch build with the patch

Comment 5 Yauheni Kaliuta 2019-04-16 15:16:38 UTC
> Looks like a place for optimization as well.

Actually, not a lot. That is because of second run of depmod after removing the incompatible link.

So the only possible optimization would be get rid of depmod and implement its logic in the script (may be rewriting it in C).

If I remember correctly, rewriting on python is not an option because some of dependencies. But I'm wondering would tiny lua work here.

Comment 7 Frantisek Hrbata 2019-05-04 18:40:24 UTC
Hi,

IMHO the real bottleneck is calling depmod so many times here

http://pkgs.devel.redhat.com/cgit/rpms/kmod/tree/weak-modules?h=rhel-8.1.0#n733

Why is the validation needed for each group and not only once after all the symlinks are created?

This also rises a question: Why are the groups needed? There is an associative array "groups", which is a slightly modified depmod output in format
[module]="module depmod1 depmod2 ..."
for example:
[/lib/modules/4.18.0-80.el8.x86_64/extra/net/sctp/sctp_diag.ko.xz]="/lib/modules/4.18.0-80.el8.x86_64/extra/net/sctp/sctp_diag.ko.xz /lib/modules/4.18.0-80.el8.x86_64/extra/net/sctp/sctp.ko.xz"

But before calling read_modules_list the entry from "groups" is stored in a tmp file using this printf
http://pkgs.devel.redhat.com/cgit/rpms/kmod/tree/weak-modules?h=rhel-8.1.0#n1008

Since the entry from "groups" is not quoted, each line in the tmp file contains just one module.

printf '%s\n' $g > $tmp
vs
printf '%s\n' "$g" > $tmp

From this point on the script works with just a simple index array "modules", where each entry contains just one module, so the whole group info is lost. Based on the fix for this bug and how the add_weak_links works now, I think that if all modules are processed with a single update_modules_for_krel call, the result will be the same.

Am I missing something here?

Thanks

Comment 9 Yauheni Kaliuta 2019-05-06 11:17:44 UTC
(In reply to Frantisek Hrbata from comment #7)
> Hi,
> 
> IMHO the real bottleneck is calling depmod so many times here
> 
> http://pkgs.devel.redhat.com/cgit/rpms/kmod/tree/weak-modules?h=rhel-8.1.
> 0#n733
> 
> Why is the validation needed for each group and not only once after all the
> symlinks are created?
> 
> This also rises a question: Why are the groups needed? There is an
> associative array "groups", which is a slightly modified depmod output in
> format
> [module]="module depmod1 depmod2 ..."
> for example:
> [/lib/modules/4.18.0-80.el8.x86_64/extra/net/sctp/sctp_diag.ko.xz]="/lib/
> modules/4.18.0-80.el8.x86_64/extra/net/sctp/sctp_diag.ko.xz
> /lib/modules/4.18.0-80.el8.x86_64/extra/net/sctp/sctp.ko.xz"
> 
> But before calling read_modules_list the entry from "groups" is stored in a
> tmp file using this printf
> http://pkgs.devel.redhat.com/cgit/rpms/kmod/tree/weak-modules?h=rhel-8.1.
> 0#n1008
> 
> Since the entry from "groups" is not quoted, each line in the tmp file
> contains just one module.
> 
> printf '%s\n' $g > $tmp
> vs
> printf '%s\n' "$g" > $tmp
> 
> From this point on the script works with just a simple index array
> "modules", where each entry contains just one module, so the whole group
> info is lost. Based on the fix for this bug and how the add_weak_links works
> now, I think that if all modules are processed with a single
> update_modules_for_krel call, the result will be the same.
> 
> Am I missing something here?
> 
> Thanks

you can check git log for the reasoning. Quoting is not a problem there, the modules are read one by one to an array.

If you have a better solution, patches are really welcomed.

Comment 12 errata-xmlrpc 2019-11-05 22:06:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:3532