[PATCH] smtstate: Start smtstate service after network target

27 views
Skip to first unread message

Srikar Dronamraju

<srikar@linux.ibm.com>
unread,
Sep 2, 2025, 11:45:11 AMSep 2
to Tyrel Datwyler, Shrikanth Hegde, powerpc-utils-devel@googlegroups.com, Nysal Jan K . A, Srikar Dronamraju
While setting smtstate on boot, pc64_cpu may fail to set smt mode if there
is pci probe happening which disables cpu hotplug.

smtstate[14016]: /sys/devices/system/cpu/smt/control: Device or resource busy
smtstate[14017]: Error updating SMT=4
systemd[1]: smtstate.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: smtstate.service: Failed with result 'exit-code'.
systemd[1]: Failed to start SMT automatic initialization service.

Here are traces from cpu_down_maps_locked showing cpu_hotplug_disabled=1
and cpu_down_maps_locked returning -EBUSY causing ppc64_cpu command to
fail while setting smt mode.

ppc64_cpu 6302 [037] 19.370155: probe:cpu_down_maps_locked: (c000000000160b18) cpu_hotplug_disabled=1
ppc64_cpu 6302 [037] 19.370164: probe:cpu_down_maps_locked__return: (c000000000160b18 <- c000000000162508) retval=0xfffffffffffffff0

At the time of ppc64_cpu failure, tracing cpu_hotplug_enable() shows the
likely reason why cpu_hotplug_disabled=1 (A network driver was trying to
probe a pci device).

(udev-worker) 5478 [016] 19.613108: probe:cpu_hotplug_enable: (c00000000015dba8)
c00000000015dba8 cpu_hotplug_enable+0x8 (/boot/vmlinux)
c0000000008fa7a8 pci_device_probe+0x1f8 (/boot/vmlinux)
c000000000a02440 really_probe+0x2f0 (/boot/vmlinux)
c000000000a0294c __driver_probe_device+0x1bc (/boot/vmlinux)
c000000000a029f0 driver_probe_device+0x60 (/boot/vmlinux)
c000000000a031f8 __driver_attach+0xf8 (/boot/vmlinux)
c0000000009fead4 bus_for_each_dev+0xb4 (/boot/vmlinux)
c000000000a01744 driver_attach+0x34 (/boot/vmlinux)
c000000000a00b18 bus_add_driver+0x218 (/boot/vmlinux)
c000000000a04278 driver_register+0x98 (/boot/vmlinux)
c0000000008f7d68 __pci_register_driver+0x68 (/boot/vmlinux)
c0080000fb98ee7c [unknown] ([i40e])
c000000000012690 do_one_initcall+0x60 (/boot/vmlinux)
c00000000027af94 do_init_module+0x84 (/boot/vmlinux)
c000000000278c0c load_module+0x2bfc (/boot/vmlinux)
c0000000002798e0 __do_sys_init_module+0x210 (/boot/vmlinux)

Hence to make smtstate more robust, this change ensures smtstate.service
is only called after network initialization and hence avoid all other
instances which could be disabling cpu_hotlug_disabled.

Suggested-by: "Nysal Jan K.A" <ny...@linux.ibm.com>
Suggested-by: Shrikanth Hegde <ssh...@linux.ibm.com>
Signed-off-by: Srikar Dronamraju <sri...@linux.ibm.com>
---
systemd/smtstate.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/systemd/smtstate.service.in b/systemd/smtstate.service.in
index c2853650c51a..ba3f3d3a9f29 100644
--- a/systemd/smtstate.service.in
+++ b/systemd/smtstate.service.in
@@ -3,7 +3,7 @@ Description=SMT automatic initialization service
Documentation=man:smtstate(8)
Conflicts=shutdown.target
Before=shutdown.target
-After=sysinit.target
+After=network.target
DefaultDependencies=no

[Service]
--
2.49.0

Srikar Dronamraju

<srikar@linux.ibm.com>
unread,
Sep 17, 2025, 12:02:35 AMSep 17
to Tyrel Datwyler, Shrikanth Hegde, powerpc-utils-devel@googlegroups.com, Nysal Jan K . A
* Srikar Dronamraju <sri...@linux.ibm.com> [2025-09-02 21:14:16]:

> While setting smtstate on boot, pc64_cpu may fail to set smt mode if there
> is pci probe happening which disables cpu hotplug.
>

Hey Tyrel,

Did you get a chance to look at this patch?
Do let me know if you have any feedback.

--
Thanks and Regards
Srikar Dronamraju

Michal Suchánek

<msuchanek@suse.de>
unread,
Sep 18, 2025, 3:53:05 AMSep 18
to Srikar Dronamraju, Tyrel Datwyler, Shrikanth Hegde, powerpc-utils-devel@googlegroups.com, Nysal Jan K . A
Hello,
smt_off should get the same dependency.

Thanks

Michal
>
> [Service]
> --
> 2.49.0
>
> --
> You received this message because you are subscribed to the Google Groups "Powerpc-utils development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to powerpc-utils-d...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/powerpc-utils-devel/20250902154428.559553-1-srikar%40linux.ibm.com.

Srikar Dronamraju

<srikar@linux.ibm.com>
unread,
Sep 19, 2025, 5:46:34 AMSep 19
to Michal Suchánek, Tyrel Datwyler, Shrikanth Hegde, powerpc-utils-devel@googlegroups.com, Nysal Jan K . A
* Michal Suchánek <msuc...@suse.de> [2025-09-18 09:53:00]:

Hi Michal,

>
> > @@ -3,7 +3,7 @@ Description=SMT automatic initialization service
> > Documentation=man:smtstate(8)
> > Conflicts=shutdown.target
> > Before=shutdown.target
> > -After=sysinit.target
> > +After=network.target
> > DefaultDependencies=no
>
> smt_off should get the same dependency.

Good observation, Will send a v2 with this incorporated.

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Sep 25, 2025, 7:51:34 PMSep 25
to Srikar Dronamraju, Shrikanth Hegde, powerpc-utils-devel@googlegroups.com, Nysal Jan K . A
Thanks for root causing this issue.

>
> Suggested-by: "Nysal Jan K.A" <ny...@linux.ibm.com>
> Suggested-by: Shrikanth Hegde <ssh...@linux.ibm.com>
> Signed-off-by: Srikar Dronamraju <sri...@linux.ibm.com>
> ---
> systemd/smtstate.service.in | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/systemd/smtstate.service.in b/systemd/smtstate.service.in
> index c2853650c51a..ba3f3d3a9f29 100644
> --- a/systemd/smtstate.service.in
> +++ b/systemd/smtstate.service.in
> @@ -3,7 +3,7 @@ Description=SMT automatic initialization service
> Documentation=man:smtstate(8)
> Conflicts=shutdown.target
> Before=shutdown.target
> -After=sysinit.target
> +After=network.target
> DefaultDependencies=no

As mentioned by Michal please update smt_off with the same dependency in v2.

-Tyrel
>
> [Service]

Srikar Dronamraju

<srikar@linux.ibm.com>
unread,
Sep 29, 2025, 2:11:15 PMSep 29
to powerpc-utils-devel@googlegroups.com, Tyrel Datwyler, Srikar Dronamraju, Michal Suchanek, Nysal Jan K.A, Shrikanth Hegde
While setting smtstate on boot, ppc64_cpu may fail to set smt mode if
Similarly make smt_off service also more robust by ensuring its only called
after network initialization.

Suggested-by: Michal Suchanek <msuchanek@suse.d>
Suggested-by: "Nysal Jan K.A" <ny...@linux.ibm.com>
Suggested-by: Shrikanth Hegde <ssh...@linux.ibm.com>
Signed-off-by: Srikar Dronamraju <sri...@linux.ibm.com>
---
Changelog v2 -> v1:
v1: https://groups.google.com/g/powerpc-utils-devel/c/MLj3tX9GqGY
- Provide same dependency to smt_off service (Suggestion by Michal Suchanek)

systemd/smt_off.service.in | 1 +
systemd/smtstate.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/systemd/smt_off.service.in b/systemd/smt_off.service.in
index ed95945a1a43..e0c133eeea18 100644
--- a/systemd/smt_off.service.in
+++ b/systemd/smt_off.service.in
@@ -1,6 +1,7 @@
[Unit]
Description=ppc64 set SMT off
Before=libvirt-bin.service
+After=network.target

[Service]
Type=oneshot
diff --git a/systemd/smtstate.service.in b/systemd/smtstate.service.in
index c2853650c51a..ba3f3d3a9f29 100644
--- a/systemd/smtstate.service.in
+++ b/systemd/smtstate.service.in
@@ -3,7 +3,7 @@ Description=SMT automatic initialization service
Documentation=man:smtstate(8)
Conflicts=shutdown.target
Before=shutdown.target
-After=sysinit.target
+After=network.target
DefaultDependencies=no

[Service]
--
2.51.0

Shrikanth Hegde

<sshegde@linux.ibm.com>
unread,
Sep 30, 2025, 1:27:45 AMSep 30
to Srikar Dronamraju, Tyrel Datwyler, Michal Suchanek, Nysal Jan K.A, powerpc-utils-devel@googlegroups.com
Should this be changed to libvirtd.service now?


> +After=network.target
>
> [Service]
> Type=oneshot
> diff --git a/systemd/smtstate.service.in b/systemd/smtstate.service.in
> index c2853650c51a..ba3f3d3a9f29 100644
> --- a/systemd/smtstate.service.in
> +++ b/systemd/smtstate.service.in
> @@ -3,7 +3,7 @@ Description=SMT automatic initialization service
> Documentation=man:smtstate(8)
> Conflicts=shutdown.target
> Before=shutdown.target
> -After=sysinit.target
> +After=network.target
> DefaultDependencies=no
>
> [Service]

IMHO, it would be better to split the patches into two.
(though changes are minimal)




Srikar Dronamraju

<srikar@linux.ibm.com>
unread,
Sep 30, 2025, 1:35:08 AMSep 30
to Shrikanth Hegde, Tyrel Datwyler, Michal Suchanek, Nysal Jan K.A, powerpc-utils-devel@googlegroups.com
* Shrikanth Hegde <ssh...@linux.ibm.com> [2025-09-30 10:57:32]:
Not sure, I think if this needed, then it should be done as a separate patch
by a person who is more knowledgeable about what the name of libvirtd
service is and when it changed.

>
> > +After=network.target
> > [Service]
> > Type=oneshot
> > diff --git a/systemd/smtstate.service.in b/systemd/smtstate.service.in
> > index c2853650c51a..ba3f3d3a9f29 100644
> > --- a/systemd/smtstate.service.in
> > +++ b/systemd/smtstate.service.in
> > @@ -3,7 +3,7 @@ Description=SMT automatic initialization service
> > Documentation=man:smtstate(8)
> > Conflicts=shutdown.target
> > Before=shutdown.target
> > -After=sysinit.target
> > +After=network.target
> > DefaultDependencies=no
> > [Service]
>
> IMHO, it would be better to split the patches into two.
> (though changes are minimal)
>
>

Will wait for Tyrel's inputs on this.
Probably, you could have commented to Michal or Tyrel's comment, that it
should have been done as a separate patch.

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Oct 3, 2025, 3:15:12 PMOct 3
to Srikar Dronamraju, Shrikanth Hegde, Michal Suchanek, Nysal Jan K.A, powerpc-utils-devel@googlegroups.com
On 9/29/25 10:35 PM, Srikar Dronamraju wrote:
> * Shrikanth Hegde <ssh...@linux.ibm.com> [2025-09-30 10:57:32]:
>
>>
>>
>> On 9/29/25 11:40 PM, Srikar Dronamraju wrote:
>>> While setting smtstate on boot, ppc64_cpu may fail to set smt mode if
>>> there is pci probe happening which disables cpu hotplug.

<snip>

>>
>> IMHO, it would be better to split the patches into two.
>> (though changes are minimal)
>>
>>
>
> Will wait for Tyrel's inputs on this.
> Probably, you could have commented to Michal or Tyrel's comment, that it
> should have been done as a separate patch.
>

I don't see any reason to break this up as it just generates extra churn. Both
service files manage the SMT state and functionally they both require the same
after target change so I prefer this is done in one shot.

-Tyrel

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Oct 3, 2025, 3:23:15 PMOct 3
to Srikar Dronamraju, Shrikanth Hegde, Michal Suchanek, Nysal Jan K.A, powerpc-utils-devel@googlegroups.com
On 9/29/25 10:35 PM, Srikar Dronamraju wrote:
Yes, lets change this in a separate patch. The libvirt-bin.service target I
believe was used on older Ubuntu versions. If I recall correctly the smt_off
service was originally implemented because we needed SMT disabled on bare metal
PowerKVM machines which were Ubuntu based.

Current Ubuntu uses libvirtd.service and even older ones that still had
libvirt-bin.service aliased it to libvirtd.service.

-Tyrel

Shrikanth Hegde

<sshegde@linux.ibm.com>
unread,
Oct 4, 2025, 1:51:05 AMOct 4
to Tyrel Datwyler, Srikar Dronamraju, Michal Suchanek, Nysal Jan K.A, powerpc-utils-devel@googlegroups.com
alright then.

Reviewed-by: Shrikanth Hegde <ssh...@linux.ibm.com>

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Oct 15, 2025, 2:00:21 PM (5 days ago) Oct 15
to Srikar Dronamraju, powerpc-utils-devel@googlegroups.com, Michal Suchanek, Nysal Jan K.A, Shrikanth Hegde
Reply all
Reply to author
Forward
0 new messages