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 1538745 - cpu-partitioning: CPUs still isolated after changing profile
Summary: cpu-partitioning: CPUs still isolated after changing profile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ondřej Lysoněk
QA Contact: Dominik Rehák
URL:
Whiteboard:
Depends On: 1469258
Blocks: 1394932 TUNED-7.5-REBASE
TreeView+ depends on / blocked
 
Reported: 2018-01-25 17:44 UTC by Luiz Capitulino
Modified: 2018-10-30 10:50 UTC (History)
8 users (show)

Fixed In Version: tuned-2.10.0-0.1.rc1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1469258
Environment:
Last Closed: 2018-10-30 10:48:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3172 0 None None None 2018-10-30 10:50:31 UTC

Description Luiz Capitulino 2018-01-25 17:44:13 UTC
We're cloning this issue for 7.6 because we're not fully satisfied with the fix implemented for 7.5: we need the user to be warned right away that s/he needs to take action immediately. Having a warning in the logs is not the best way to achieve this. Full issue description & discussion follows.


+++ This bug was initially created as a clone of Bug #1469258 +++

Description of problem:

Sometimes RHEL7 runs dracut after booting into a new kernel for the first time. If this happens when the cpu-partitioning profile is applied, the systemd configuration file /etc/systemd/system.conf will slip into the initrd image. This will cause cpu-partitioning systemd configuration, such as CPU isolation, to be in effect even when changing profiles or if tuned is stopped or even removed from the system.

This problem can be generalized by assuming that users may re-generate their initrd images at any time.


Version-Release number of selected component (if applicable): tuned-2.8.0-5.el7.noarch


How reproducible:


Steps to Reproduce:
1. Setup and activate cpu-partitioning profile
2. Run dracut or install a new kernel and reboot
3. Change to a different profile or stop tuned
4. Reboot and check that CPUs are still isolated

--- Additional comment from Red Hat Bugzilla Rules Engine on 2017-07-10 14:26:17 EDT ---

Since this bug report was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Jaroslav Škarvada on 2017-08-28 12:04:31 EDT ---

I am afraid we cannot resolve this in Tuned. There is nothing like omit_file dracut configuration, so we cannot prevent it from embedding the Tuned added configuration into the main initrd. I think we could either open dracut RFE bugzilla requesting such option, or just document this problem.

--- Additional comment from Luiz Capitulino on 2017-08-28 15:09:09 EDT ---

Would it be possible to print a message like "you should regenerate your initrd" when disabling the cpu-partitioning profile? I know this looks a bit silly, but at least we told the user what to do.

The problem with adding a configuration like omit_file in dracut is that we'll be disallowing the user from doing a configuration change that may be valid for s/he setup.

--- Additional comment from Jaroslav Škarvada on 2017-08-29 05:10:38 EDT ---

(In reply to Luiz Capitulino from comment #3)
> Would it be possible to print a message like "you should regenerate your
> initrd" when disabling the cpu-partitioning profile? I know this looks a bit
> silly, but at least we told the user what to do.
> 
This shouldnt' be problem.

> The problem with adding a configuration like omit_file in dracut is that
> we'll be disallowing the user from doing a configuration change that may be
> valid for s/he setup.

I meant omit just Tuned configuration files, e.g.:

/etc/systemd/system.conf.d/05tuned.conf (which we currently don't ship, but we could easily switch to it from /etc/systemd/system.conf), and
/usr/lib/dracut/hooks/pre-udev/00-tuned-pre-udev.sh

--- Additional comment from Jaroslav Škarvada on 2017-08-29 07:54:43 EDT ---

(In reply to Jaroslav Škarvada from comment #4)
> (In reply to Luiz Capitulino from comment #3)
> > Would it be possible to print a message like "you should regenerate your
> > initrd" when disabling the cpu-partitioning profile? I know this looks a bit
> > silly, but at least we told the user what to do.
> > 
> This shouldnt' be problem.
> 
Upstream commit:
https://github.com/redhat-performance/tuned/commit/d2c170a42e2c823f3c67c609fe528ffccfee5bce

--- Additional comment from Fedora Update System on 2017-10-13 10:21:10 EDT ---

tuned-2.9.0-0.1.rc1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d9c6b990df

--- Additional comment from errata-xmlrpc on 2017-10-13 11:15:34 EDT ---

Bug report changed to ON_QA status by Errata System.
A QE request has been submitted for advisory RHEA-2017:30932-01
https://errata.devel.redhat.com/advisory/30932

--- Additional comment from Fedora Update System on 2017-10-13 18:25:27 EDT ---

tuned-2.9.0-0.1.rc1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d9c6b990df

--- Additional comment from Fedora Update System on 2017-10-13 19:25:18 EDT ---

tuned-2.9.0-0.1.rc1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5f0849d207

--- Additional comment from Fedora Update System on 2017-10-29 17:07:24 EDT ---

tuned-2.9.0-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0e45ce4685

--- Additional comment from Fedora Update System on 2017-10-29 17:13:29 EDT ---

tuned-2.9.0-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-c30e9bd1ea

--- Additional comment from Joe Mario on 2017-12-18 16:10:21 EST ---

Hi Jaroslav:

Does "ON_QA" mean the need to get it backported to the RHEL 7.4z stream 
is no longer a priority?

We just got bit by this bug on RHEL 7.4, costing lots of testing hours 
because cpus were still isolated during our throughput-performance work.
No one expects throughput-performance to have isolated cpus.

As we work with customers on performance, they love the cpu-partitioning
profile.  I expect some of them will be hitting it as well.

What do we need to do to get the commit from comments #4 & #5 above to be backported into RHEL 7.4z?

Thank you.
Joe

--- Additional comment from Jaroslav Škarvada on 2017-12-19 03:12:09 EST ---

(In reply to Joe Mario from comment #12)
> Hi Jaroslav:
> 
> Does "ON_QA" mean the need to get it backported to the RHEL 7.4z stream 
> is no longer a priority?
> 
> We just got bit by this bug on RHEL 7.4, costing lots of testing hours 
> because cpus were still isolated during our throughput-performance work.
> No one expects throughput-performance to have isolated cpus.
> 
> As we work with customers on performance, they love the cpu-partitioning
> profile.  I expect some of them will be hitting it as well.
> 
> What do we need to do to get the commit from comments #4 & #5 above to be
> backported into RHEL 7.4z?
> 
> Thank you.
> Joe

Reply in PM.

--- Additional comment from Jaroslav Škarvada on 2017-12-19 03:36:20 EST ---

(In reply to Jaroslav Škarvada from comment #13)
> (In reply to Joe Mario from comment #12)
> > Hi Jaroslav:
> > 
> > Does "ON_QA" mean the need to get it backported to the RHEL 7.4z stream 
> > is no longer a priority?
> > 
> > We just got bit by this bug on RHEL 7.4, costing lots of testing hours 
> > because cpus were still isolated during our throughput-performance work.
> > No one expects throughput-performance to have isolated cpus.
> > 
> > As we work with customers on performance, they love the cpu-partitioning
> > profile.  I expect some of them will be hitting it as well.
> > 
> > What do we need to do to get the commit from comments #4 & #5 above to be
> > backported into RHEL 7.4z?
> > 
> > Thank you.
> > Joe
> 
> Reply in PM.

At the moment it's in regular RHEL-7.5 errata. For the Z-stream (7.4.z) we need Z-stream clone of this bug. The clone is done by PM, so it requires approval from PM (Product Management).

--- Additional comment from Luiz Capitulino on 2018-01-23 09:05:45 EST ---

Jaroslav,

I'm verifying this BZ. However, I don't see the message printed when I have the cpu-partitioning profile active and stop tuned or change to a different profile. So, has this been fixed?

In any case, I've been thinking that it would be a better solution to run "dracut -f" from cpu-partitioning's stop() method in script.sh. This way we guarantee that users won't get this issue. Would this be feasible to do?

--- Additional comment from Jaroslav Škarvada on 2018-01-25 05:02:10 EST ---

(In reply to Luiz Capitulino from comment #15)
> Jaroslav,
> 
> I'm verifying this BZ. However, I don't see the message printed when I have
> the cpu-partitioning profile active and stop tuned or change to a different
> profile. So, has this been fixed?

At the moment the message is printed only to the log. There is currently no mechanism how to pass the stop messages to the controlling client (e.g. to tuned-adm) to write such messages to the console. It would require extension of the DBus API. Of course, we can do it.

> 
> In any case, I've been thinking that it would be a better solution to run
> "dracut -f" from cpu-partitioning's stop() method in script.sh. This way we
> guarantee that users won't get this issue. Would this be feasible to do?

The 'dracut -f' can take significant time to finish, which could under some circumstances (big initrd, slow/loaded machine) cause systemd service/unit timeout to occur.

I think the most robust for the service itself is just a message. Feel free to clone this BZ or file new BZ proposing addition of the communication interface between the client/server which would allow showing informal messages on the console.

--- Additional comment from Luiz Capitulino on 2018-01-25 09:48:51 EST ---

I don't want to be pedantic, but I don't think that having this message in the logs is good enough: what we want is to let the user know right away that s/he needs to do something right now. I don't think a message in the log qualifies.

I think we have to move this back to opened and rethink the solution for this BZ,  independently of the solution we choose and even if this means moving this to 7.5.

Do you agree? Can I re-open it?

--- Additional comment from Jaroslav Škarvada on 2018-01-25 11:45:30 EST ---

(In reply to Luiz Capitulino from comment #17)
> I don't want to be pedantic, but I don't think that having this message in
> the logs is good enough: what we want is to let the user know right away
> that s/he needs to do something right now. I don't think a message in the
> log qualifies.
> 
> I think we have to move this back to opened and rethink the solution for
> this BZ,  independently of the solution we choose and even if this means
> moving this to 7.5.
> 
> Do you agree? Can I re-open it?

We cannot extend the API for 7.5, because it's too late, devel phase is over. The bug is already referenced in changelog and errata. The message in the log is slight improvement in comparison to the previous state and is something which can be easily tested. That's why I would prefer cloning this bugzilla to 7.6 - all history will stay preserved and it will get new number and let's call it new feature/improvement.

Otherwise we would have to drop this bug from the errata and postpone it to 7.6. But unfortunately we cannot update already released changelog. That's why I would prefer the former approach.

Comment 2 Ondřej Lysoněk 2018-06-05 12:26:05 UTC
Fixing keywords. A patch for this has not yet been created.

Comment 3 Jaroslav Škarvada 2018-06-11 18:15:31 UTC
It should be fixed by following upstream commit:
https://github.com/redhat-performance/tuned/commit/6c1df704ce65de429b90bd99102188be39a463d0

Comment 4 Joe Mario 2018-06-11 18:42:32 UTC
Hi Jaroslav:
 I'm trying to understand how the above commit will help.
 
 I do see the above commit adds a logging infrastructure to tuned,
 which is good.

 But I'm wondering how it would help in a scenario like this:

 a) User is running with the cpu-partitioning profile.
 b) User installs new kernel and new microcode from Red Hat.
 c) The new microcode rpm calls "dracut -f" which modifies the default
    system cpu affinity in /etc/systemd/system.conf
 d) Currently, the only way to restore the default cpu system affinity
    is for the user to edit and modify that file.

 How does the above tuned patch alert the user to avoid the above
 use case?

Comment 5 Ondřej Lysoněk 2018-06-12 07:21:51 UTC
(In reply to Joe Mario from comment #4)
>  But I'm wondering how it would help in a scenario like this:
> 
>  a) User is running with the cpu-partitioning profile.
>  b) User installs new kernel and new microcode from Red Hat.
>  c) The new microcode rpm calls "dracut -f" which modifies the default
>     system cpu affinity in /etc/systemd/system.conf

I'm not sure what you mean here. As I understand it, dracut will not modify /etc/systemd/system.conf. It will only copy that file to the initrd image.

>  d) Currently, the only way to restore the default cpu system affinity
>     is for the user to edit and modify that file.

Changes made by Tuned to /etc/systemd/system.conf on the root filesystem should be reverted when a different profile is applied or Tuned is stopped. Does that not happen?

>  How does the above tuned patch alert the user to avoid the above
>  use case?

Assume Tuned is running and the cpu-partitioning profile is applied. When the user switches to a different profile, the changes to /etc/systemd/system.conf made by Tuned will be reverted. This reversion will not propagate to the initrd image, but the user will be notified that they should run dracut to push the changes to the initrd image, e.g:
# tuned-adm profile cpu-partitioning
# tuned-adm profile throughput-performance
CONSOLE  tuned.plugins.plugin_systemd: you may need to manualy run 'dracut -f' to update the systemd configuration in initrd image

The user will not see the message if they do something like
# systemctl stop tuned && systemctl disable tuned
but that is expected. The message will be in /var/log/tuned/tuned.log though.

What I forgot to add in the above commit is printing the message when 'tuned-adm off' is executed. I'll add that.

Comment 6 Joe Mario 2018-06-12 10:16:12 UTC
> I'm not sure what you mean here. As I understand it, dracut will not modify
> /etc/systemd/system.conf. It will only copy that file to the initrd image.

Hi Ondrej:
I'm wondering if you missed the use case and severity of this problem.

Here is what we're seeing happen:

1) Set your tuned to cpu-partitioning with a several cpus selected to
   be isolated (in /etc/tuned/cpu-partitioning-variables.conf),
   and reboot.

2) Now with tuned set to cpu-partitioning, install new microcode as our
   customers are doing with the Spectre-Meltdown fixes.  To simplify this
   step, all you need to do is run "dracut -f".   Reboot.

3) Now set your tuned back to some other tuned profile, like 
   throughput-performance or network-latency, or whatever.  Reboot.

4) After you reboot, look at the affinity for all user processes.  
   For example: "cat /proc/$$/status |grep Cpu".
   You will see all the processes still have the isolated affinitity
   from the /etc/tuned/cpu-partitioning-variables.conf file even though
   you are no longer set to cpu-partitioning.

5) Even if you install new kernels, they will all inherit the restricted
   cpu-parititoning affinity from that conf file (even though you're
   set to some other tuned like throughput-performance).

6) The only way I've been able to fix this is to edit /etc/systemd/system.conf.

Given the decision for RHEL to once again ship microcode for Spectre-Meltdown
CVE fixes, our customers running cpu-partitioning will hit the above
bug much more often.

If I'm understanding the changes made for this BZ, it sounds like they're
not addressing the problem that is giving customers the biggest problem.

Please confirm you're understanding this reply.

Thank you.
Joe

Comment 7 Joe Mario 2018-06-12 10:38:34 UTC
[Added info to the my previous reply]

From memory, here is what I think is happening.

a) cpu-partitioning modifies /etc/systemd/system.conf's Affinity value.

b) dracut reads that Affinity value and updates the current kernel's
  initrd image.  If it happens to be the modified value from 
  cpu-partitioning, then the problem just got created.

Step "b" is where the damage is done because now the system's default
affinity (even if you set tuned to something else) is the restricted 
tuned from when cpu-partitioning was in place.

Editing /etc/systemd/system.conf and rerunning "dracut -f" is the only
way I know to fix this.

Joe

Comment 8 Ondřej Lysoněk 2018-06-12 11:03:29 UTC
(In reply to Joe Mario from comment #6)
> 6) The only way I've been able to fix this is to edit
> /etc/systemd/system.conf.

Are you saying the /etc/systemd/system.conf file on the root filesystem contains an (uncommented) CPUAffinity option even after you set the throughput-performance profile? That should have been automatically deleted when you changed the profile. I cannot reproduce this - if I run 'dracut -f' after changing to throughput-performance and reboot, the CPUs are no longer isolated. What tuned version are you using?

(In reply to Joe Mario from comment #7)
> Editing /etc/systemd/system.conf and rerunning "dracut -f" is the only
> way I know to fix this.

If editing /etc/systemd/system.conf is necessary, then that sounds like a bug in Tuned. On the other hand, it is expected that running 'dracut -f' after changing the profile  is necessary. So far the consensus seemed to be that informing the user about the need to run that command would be a sufficient solution. If you think that is not enough, we may want to file that RFE for dracut as suggested here:
https://bugzilla.redhat.com/show_bug.cgi?id=1469258#c2

Comment 10 Joe Mario 2018-06-12 14:54:13 UTC
> Are you saying the /etc/systemd/system.conf file on the root 
> filesystem contains an (uncommented) CPUAffinity option even after you 
> set the throughput-performance profile? 

Hi Ondrej:

I think you missed a reboot.

These are the steps, (from memory but I've hit this problem many times):
1) Set tuned cpu-partitioning.
2) Reboot
3) Run "dracut -f" 
4) Reboot
5) Set tuned throughput-performance
6) Reboot
7) Check your process affinity (cat /proc/$$/status |grep Cpu")

In step "7", even though your tuned is throughput-performance, your
process affinity will be that from the previous cpu-partitioning.

Let me know if this does not reproduce for you.
Joe

Comment 11 Ondřej Lysoněk 2018-06-13 07:49:27 UTC
(In reply to Joe Mario from comment #10)
> > Are you saying the /etc/systemd/system.conf file on the root 
> > filesystem contains an (uncommented) CPUAffinity option even after you 
> > set the throughput-performance profile? 
> 
> Hi Ondrej:
> 
> I think you missed a reboot.

I did not.

> These are the steps, (from memory but I've hit this problem many times):
> 1) Set tuned cpu-partitioning.
> 2) Reboot
> 3) Run "dracut -f" 
> 4) Reboot
> 5) Set tuned throughput-performance
> 6) Reboot
> 7) Check your process affinity (cat /proc/$$/status |grep Cpu")
> 
> In step "7", even though your tuned is throughput-performance, your
> process affinity will be that from the previous cpu-partitioning.

Yes, I can reproduce this. But that is a separate issue. What I'm asking you, is whether you see the *CPUAffinity option* in the /etc/systemd/system.conf file on the *root filesystem* after you set the throughput-performance profile. That should not happen. Does it happen for you?

If you do the following:
1) Set tuned cpu-partitioning.
2) Reboot
3) Run "dracut -f" 
4) Reboot
5) Set tuned throughput-performance
6) Run "dracut -f"
7) Reboot
8) Check your process affinity (cat /proc/$$/status |grep Cpu")

Then in step 8, you should see the correct affinity. Do you see this behaviour?

Comment 12 Ondřej Lysoněk 2018-06-13 07:55:56 UTC
Notice step 6, 'Run "dracut -f"',  in the steps I provided.

Comment 13 Joe Mario 2018-06-13 13:36:10 UTC
Hi Ondrej:
 You are correct.  I just redid the steps that caused us problems and verified
 the step to rerun dracut should work.

 I tried multiple tuned/kernel-install/microcode-install/reboot combinations
 and verified that in all cases setting a different profile (away from 
 cpu-partitioning) and then running dracut did resolve it.

 I apologize for the distraction of yesterday's previous comments I made.

 I do have a question, since I'm not running the new patched tuned yet.
 Will the new message to manually run dracut be emitted to the console 
 only or also to the user's terminal?

 I ask that because of the recent CVE kernels we announced in early 
 May, (which also require microcode).  RHEL will once again begin shipping
 microcode.  That means there will be lots of customers who will be 
 installing these kernels and will be updating their microcode (and implictly
 calling dracut).

 If the tuned message to rerun dracut isn't "put in front of their face",
 those using cpu-partitioning will find themselves running some profile 
 (not cpu-partitioning) and will have isolated cpus for all the user 
 processes on their box.

 In summary, the steps recommended in the message do appear to work, (thank
 you and sorry for the noise I caused).  We just need to make sure the
 message emitted gets seen.

Thank you.
Joe

Comment 14 Ondřej Lysoněk 2018-06-13 13:50:34 UTC
I'm glad we're on the same page now :).

(In reply to Joe Mario from comment #13)
>  I do have a question, since I'm not running the new patched tuned yet.
>  Will the new message to manually run dracut be emitted to the console 
>  only or also to the user's terminal?

It will be printed to the terminal where the user runs tuned-adm, for example:
$ tuned-adm profile throughput-performance
CONSOLE  tuned.plugins.plugin_systemd: you may need to manualy run 'dracut -f' to update the systemd configuration in initrd image

It also goes to the Tuned log file (/var/log/tuned/tuned.log). It does *not* go to the *system console*. Perhaps the name of the log level, "CONSOLE", is a bit misleading...

Comment 15 Luiz Capitulino 2018-06-13 16:49:21 UTC
I can see the message in my terminal, but there's a small problem. The message reads:

CONSOLE  tuned.plugins.plugin_systemd: you may need to manualy run 'dracut -f' to update the systemd configuration in initrd image

But it should read instead:

CONSOLE  tuned.plugins.plugin_systemd: you may need to manualy run 'dracut -f && reboot' to update the systemd configuration in initrd image

Or:

CONSOLE  tuned.plugins.plugin_systemd: you may need to manualy run 'dracut -f' and reboot in order to update the systemd configuration in initrd image

Since this is tiny change, I don't think we need a BZ for it as long as you do it sooner rather than later.

Other than that, running dracut -f and rebooting does fix the problem for me. As Joe's issue is now clarified, this BZ is verified.

PS: one limitation of this solution is that people running tuned-adm from scripts may not see the message and nothing wrong will happen since tuned-adm doesn't fail.

Comment 19 errata-xmlrpc 2018-10-30 10:48:57 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-2018:3172


Note You need to log in before you can comment on or make changes to this bug.