diff mbox series

opal-prd: Load opal-prd service after systemd-modules-load service

Message ID 20210309100103.32254-1-hegdevasant@linux.vnet.ibm.com
State New
Headers show
Series opal-prd: Load opal-prd service after systemd-modules-load service | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (1cdde9466ab658fb5b5a53af8c4e6a8929eef698)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Vasant Hegde March 9, 2021, 10:01 a.m. UTC
In some cases opal-prd daemon is failing to start during boot. This is
because systemd is trying to start service before `opal-prd` kernel module
load.

Sample failure message:
----------------------
Feb 21 19:03:09 grsp1 opal-prd: FW: Can't open PRD device /dev/opal-prd: No such file or directory
Feb 21 19:03:09 grsp1 opal-prd: FW: Error initialising PRD channel

Lets start opal-prd service after systemd-modules-load is started. Also
create conf file to load opal-prd module during boot. This will make sure
systemd tries to start opal-prd daemon after opal-prd kernel module load.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 external/opal-prd/opal-prd.service |  1 +
 skiboot.spec                       | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Dan Horák March 9, 2021, 10:17 a.m. UTC | #1
Hi Vasant,

On Tue,  9 Mar 2021 15:31:03 +0530
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> wrote:

> In some cases opal-prd daemon is failing to start during boot. This is
> because systemd is trying to start service before `opal-prd` kernel module
> load.
> 
> Sample failure message:
> ----------------------
> Feb 21 19:03:09 grsp1 opal-prd: FW: Can't open PRD device /dev/opal-prd: No such file or directory
> Feb 21 19:03:09 grsp1 opal-prd: FW: Error initialising PRD channel
> 
> Lets start opal-prd service after systemd-modules-load is started. Also
> create conf file to load opal-prd module during boot. This will make sure
> systemd tries to start opal-prd daemon after opal-prd kernel module load.
> 
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
>  external/opal-prd/opal-prd.service |  1 +
>  skiboot.spec                       | 12 +++++++++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/external/opal-prd/opal-prd.service b/external/opal-prd/opal-prd.service
> index dce0dd262..cf514e498 100644
> --- a/external/opal-prd/opal-prd.service
> +++ b/external/opal-prd/opal-prd.service
> @@ -2,6 +2,7 @@
>  Description=OPAL PRD daemon
>  ConditionVirtualization=false
>  ConditionPathExists=/sys/firmware/devicetree/base/ibm,opal/diagnostics
> +After=systemd-modules-load.service
>  
>  [Service]
>  ExecStart=/usr/sbin/opal-prd
> diff --git a/skiboot.spec b/skiboot.spec
> index 38c686811..fbb21b562 100644
> --- a/skiboot.spec
> +++ b/skiboot.spec
> @@ -1,5 +1,5 @@
>  Name:		opal-prd
> -Version:	5.10
> +Version:	6.7
>  Release:	1%{?dist}
>  Summary:	OPAL Processor Recovery Diagnostics Daemon
>  
> @@ -11,6 +11,7 @@ ExclusiveArch:	ppc64le
>  BuildRequires:	systemd
>  
>  Requires:	systemd
> +Requires:	systemd-udev
>  
>  Source0:	https://github.com/open-power/skiboot/archive/v%{version}.tar.gz
>  
> @@ -62,6 +63,10 @@ make -C external/pflash install DESTDIR=%{buildroot} prefix=/usr
>  mkdir -p %{buildroot}%{_unitdir}
>  install -m 644 -p external/opal-prd/opal-prd.service %{buildroot}%{_unitdir}/opal-prd.service
>  
> +# Auto-load kernel module after boot/reboot
> +mkdir -p %{buildroot}/%{_sysconfdir}/modules-load.d
> +echo 'opal-prd' > %{buildroot}/%{_sysconfdir}/modules-load.d/%{name}.conf

it should use the system path %{buildroot}%{_prefix}/lib/modules-load.d,
see for example
https://src.fedoraproject.org/rpms/s390utils/blob/rawhide/f/s390utils.spec#_239

/etc (%sysconfdir) is reserved for local admin's modifications

Would forced loading of the opal-prd module cause any issue in pseries
systems (eg. KVM guests)?


		Dan

> +
>  mkdir -p %{buildroot}%{_datadir}/qemu
>  install -m 644 -p skiboot.lid %{buildroot}%{_datadir}/qemu/skiboot.lid
>  
> @@ -91,6 +96,7 @@ fi
>  %{_sbindir}/opal-prd
>  %{_unitdir}/opal-prd.service
>  %{_mandir}/man8/*
> +%config(noreplace) %{_sysconfdir}/modules-load.d/%{name}.conf
>  
>  %files -n opal-utils
>  %doc README.md
> @@ -108,6 +114,10 @@ fi
>  %{_datadir}/qemu/
>  
>  %changelog
> +* Tue Mar 9 2021 Vasant Hegde <hegdevasant@linux.vnet.ibm.com> - 6.7
> +- Update to v6.7 release
> +- Create conf file to load opal-prd module at boot
> +
>  * Thu Mar 01 2018 Murilo Opsfelder Araujo <muriloo@linux.vnet.ibm.com> - 5.10-1
>  - Update to v5.10 release
>  
> -- 
> 2.26.2
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Vasant Hegde March 9, 2021, 11:14 a.m. UTC | #2
On 3/9/21 3:47 PM, Dan Horák wrote:
> Hi Vasant,
> 
> On Tue,  9 Mar 2021 15:31:03 +0530
> Vasant Hegde <hegdevasant@linux.vnet.ibm.com> wrote:
> 
>> In some cases opal-prd daemon is failing to start during boot. This is
>> because systemd is trying to start service before `opal-prd` kernel module
>> load.
>>
>> Sample failure message:
>> ----------------------
>> Feb 21 19:03:09 grsp1 opal-prd: FW: Can't open PRD device /dev/opal-prd: No such file or directory
>> Feb 21 19:03:09 grsp1 opal-prd: FW: Error initialising PRD channel
>>
>> Lets start opal-prd service after systemd-modules-load is started. Also
>> create conf file to load opal-prd module during boot. This will make sure
>> systemd tries to start opal-prd daemon after opal-prd kernel module load.
>>
>> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>> ---
>>   external/opal-prd/opal-prd.service |  1 +
>>   skiboot.spec                       | 12 +++++++++++-
>>   2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/external/opal-prd/opal-prd.service b/external/opal-prd/opal-prd.service
>> index dce0dd262..cf514e498 100644
>> --- a/external/opal-prd/opal-prd.service
>> +++ b/external/opal-prd/opal-prd.service
>> @@ -2,6 +2,7 @@
>>   Description=OPAL PRD daemon
>>   ConditionVirtualization=false
>>   ConditionPathExists=/sys/firmware/devicetree/base/ibm,opal/diagnostics
>> +After=systemd-modules-load.service
>>   
>>   [Service]
>>   ExecStart=/usr/sbin/opal-prd
>> diff --git a/skiboot.spec b/skiboot.spec
>> index 38c686811..fbb21b562 100644
>> --- a/skiboot.spec
>> +++ b/skiboot.spec
>> @@ -1,5 +1,5 @@
>>   Name:		opal-prd
>> -Version:	5.10
>> +Version:	6.7
>>   Release:	1%{?dist}
>>   Summary:	OPAL Processor Recovery Diagnostics Daemon
>>   
>> @@ -11,6 +11,7 @@ ExclusiveArch:	ppc64le
>>   BuildRequires:	systemd
>>   
>>   Requires:	systemd
>> +Requires:	systemd-udev
>>   
>>   Source0:	https://github.com/open-power/skiboot/archive/v%{version}.tar.gz
>>   
>> @@ -62,6 +63,10 @@ make -C external/pflash install DESTDIR=%{buildroot} prefix=/usr
>>   mkdir -p %{buildroot}%{_unitdir}
>>   install -m 644 -p external/opal-prd/opal-prd.service %{buildroot}%{_unitdir}/opal-prd.service
>>   
>> +# Auto-load kernel module after boot/reboot
>> +mkdir -p %{buildroot}/%{_sysconfdir}/modules-load.d
>> +echo 'opal-prd' > %{buildroot}/%{_sysconfdir}/modules-load.d/%{name}.conf
> 
> it should use the system path %{buildroot}%{_prefix}/lib/modules-load.d,
> see for example
> https://src.fedoraproject.org/rpms/s390utils/blob/rawhide/f/s390utils.spec#_239
> 
> /etc (%sysconfdir) is reserved for local admin's modifications

Oh yes. Let me fix.

> 
> Would forced loading of the opal-prd module cause any issue in pseries
> systems (eg. KVM guests)?
> 

Hmmm yeah. it will force to load prd module on guest... which is not good.


Thanks
-Vasant
diff mbox series

Patch

diff --git a/external/opal-prd/opal-prd.service b/external/opal-prd/opal-prd.service
index dce0dd262..cf514e498 100644
--- a/external/opal-prd/opal-prd.service
+++ b/external/opal-prd/opal-prd.service
@@ -2,6 +2,7 @@ 
 Description=OPAL PRD daemon
 ConditionVirtualization=false
 ConditionPathExists=/sys/firmware/devicetree/base/ibm,opal/diagnostics
+After=systemd-modules-load.service
 
 [Service]
 ExecStart=/usr/sbin/opal-prd
diff --git a/skiboot.spec b/skiboot.spec
index 38c686811..fbb21b562 100644
--- a/skiboot.spec
+++ b/skiboot.spec
@@ -1,5 +1,5 @@ 
 Name:		opal-prd
-Version:	5.10
+Version:	6.7
 Release:	1%{?dist}
 Summary:	OPAL Processor Recovery Diagnostics Daemon
 
@@ -11,6 +11,7 @@  ExclusiveArch:	ppc64le
 BuildRequires:	systemd
 
 Requires:	systemd
+Requires:	systemd-udev
 
 Source0:	https://github.com/open-power/skiboot/archive/v%{version}.tar.gz
 
@@ -62,6 +63,10 @@  make -C external/pflash install DESTDIR=%{buildroot} prefix=/usr
 mkdir -p %{buildroot}%{_unitdir}
 install -m 644 -p external/opal-prd/opal-prd.service %{buildroot}%{_unitdir}/opal-prd.service
 
+# Auto-load kernel module after boot/reboot
+mkdir -p %{buildroot}/%{_sysconfdir}/modules-load.d
+echo 'opal-prd' > %{buildroot}/%{_sysconfdir}/modules-load.d/%{name}.conf
+
 mkdir -p %{buildroot}%{_datadir}/qemu
 install -m 644 -p skiboot.lid %{buildroot}%{_datadir}/qemu/skiboot.lid
 
@@ -91,6 +96,7 @@  fi
 %{_sbindir}/opal-prd
 %{_unitdir}/opal-prd.service
 %{_mandir}/man8/*
+%config(noreplace) %{_sysconfdir}/modules-load.d/%{name}.conf
 
 %files -n opal-utils
 %doc README.md
@@ -108,6 +114,10 @@  fi
 %{_datadir}/qemu/
 
 %changelog
+* Tue Mar 9 2021 Vasant Hegde <hegdevasant@linux.vnet.ibm.com> - 6.7
+- Update to v6.7 release
+- Create conf file to load opal-prd module at boot
+
 * Thu Mar 01 2018 Murilo Opsfelder Araujo <muriloo@linux.vnet.ibm.com> - 5.10-1
 - Update to v5.10 release