New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: add support for moving devices between instances #477
Conversation
|
This pull request introduces 3 alerts when merging e131879 into 420267f - view on LGTM.com new alerts:
|
e131879
to
6116483
Compare
|
This pull request introduces 3 alerts when merging 6116483 into f43df56 - view on LGTM.com new alerts:
Heads-up: LGTM.com's PR analysis will be disabled on the 5th of December, and LGTM.com will be shut down ⏻ completely on the 16th of December 2022. It looks like GitHub code scanning with CodeQL is already set up for this repo, so no further action is needed 🚀. For more information, please check out our post on the GitHub blog. |
6116483
to
464a500
Compare
|
I did some early testing and it seems to work for the most part. Where it fails, however, is when we include a parent profile that already provides a |
|
A couple of generic comments. Would it make sense to:
|
|
Adding another issue for tracking. When using the following spec: All devices are assigned to the |
tuned/plugins/hotplug.py
Outdated
| or accepted by the instance. | ||
| """ | ||
| if device_name in self._assigned_devices: | ||
| log.error("device '%s' is already assigned to instance" % device_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to drop the severity to Warning here? Error seems too high. Also knowing which instance would help.
464a500
to
38d2943
Compare
533968f
to
7a77511
Compare
|
I simplified the API, I dropped the deplug/hotplug methods which could lead to races and inconsistent internal states which is not trivial to handle and added more robust method 'instance_acquire_devices(devices, instance_name)'. See the edited comment 0 for description. |
7a77511
to
cfa5e0a
Compare
|
Thank you for the changes, @yarda . I didn't check out your code (yet), but did some testing and I'm getting the following: When using your example above and running I also get similar results when using socket API from PR470. Is this expected? |
It's bug in the error message, it should be: I will PR fix. Do you have the 'cpus_perf' plugin instance defined? Could you provide your testing profile? |
Extends the runtime API by the method:
instance_acquire_devices(devices, instance_name)
E.g. consider the following TuneD profile:
[cpus_perf]
type=cpu
devices=cpu0, cpu1
governor=performance
[cpus_idle]
type=cpu
devices=${f:cpulist2devs:2-3}
governor=ondemand
[cpus_idle2]
type=cpu
devices=${f:cpulist2devs:4-5,7}
governor=ondemand
Notice that it's possible to use internal function 'cpulist2devs' to easily
specify cpulists.
After the following API call:
instance_acquire_devices("cpulist:2-5,7", "cpus_perf")
It will result in cpu0 - cpu5 and cpu7 having the "performance" governor.
It's also possible to specify full device names in the API instead of the
cpulist, e.g.:
instance_acquire_devices("cpu2,cpu3,cpu4,cpu5,cpu7", "cpus_perf")
In case the comma is part of the device name, it can be escaped by "\,".
In case the device name starts with the string "cpulist:", e.g. there is
by accident device named "cpulist:abcd", it's possible to use
"cpulist:cpulist:abcd" to escape it and don't recognize it as the cpulist.
The cpulist expand feature also supports bitmasks variant prefixed by the
0x and written as a string, e.g. "0xffffffff", i.e. all the standard
TuneD cpulist syntaxes are supported.
Resolves: rhbz#2113925
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
cfa5e0a
to
841a4cc
Compare
|
I tried with the profile from comment 0: Btw |
I was using a different profile than I intended. Sorry about that. It seems to work as expected now. Will do a bit more testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Extends the runtime API by the method:
E.g. consider the following TuneD profile:
Notice that it's possible to use internal function 'cpulist2devs' to easily
specify cpulists.
After the following API call:
It will result in cpu0 - cpu5 and cpu7 having the "performance" governor.
It's also possible to specify full device names in the API instead of the
cpulist, e.g.:
In case the comma is part of the device name, it can be escaped by ",".
In case the device name starts with the string "cpulist:", e.g. there is
by accident device named "cpulist:abcd", it's possible to use
"cpulist:cpulist:abcd" to escape it and don't recognize it as the cpulist.
The cpulist expand feature also supports bitmasks variant prefixed by the
0x and written as a string, e.g. "0xffffffff", i.e. all the standard
TuneD cpulist syntaxes are supported.
Resolves: rhbz#2113925
Signed-off-by: Jaroslav Škarvada jskarvad@redhat.com