Page MenuHomeFreeBSD

Add rcorder(8) support to /etc/rc.resume
ClosedPublic

Authored by eugen_grosbein.net on May 1 2018, 3:04 AM.

Details

Summary

Add rcorder(8) support to /etc/rc.resume, so it calls "rcorder -k resume" and runs rcNG scripts containing "KEYWORD: resume" with single "resume" argument.

Working example is sysutils/cpupdate version g20180324_1 that defines extra_commands="resume" to reload CPU microcode cleared by suspend/resume sequence.

This change does nothing if system has no rcNG scripts with "KEYWORD: resume" inside.

Test Plan
  1. Use FreeBSD system with hardware supporting sleep/resume and Intel CPU that lacks IBRS support out of box but has microcode update bringing IBRS in.
  2. Install sysutils/cpupdate version g20180324_1 or newer and enable it in /etc/rc.conf (cpupdate_enable="YES").
  3. Make the system sleep/resume that clears loaded CPU microcode. WIth patch applied, rc.resume calls "service cpupdate resume" and microcode reloaded automatically.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

julian added a subscriber: julian.May 5 2018, 6:18 PM

should probably be documented somewhere.
mabe add a cross ref (see also) in the rc and rcorder man pages and add sections to whatever man pages mention how to resume (or add one)

julian requested changes to this revision.May 5 2018, 6:19 PM

docs needed

This revision now requires changes to proceed.May 5 2018, 6:19 PM

We have only one manual page acpiconf(8) that mentions /etc/rc.resume with exception of ancient apmd(8) page that is installed for i386 systems only. I've added needed description to acpiconf(8).

avg added a comment.May 8 2018, 1:21 PM

It would be nice to add a mention of rc.resume and the new resume keyword to rc(8) as Julian suggested.

In D15247#323501, @avg wrote:

It would be nice to add a mention of rc.resume and the new resume keyword to rc(8) as Julian suggested.

I would rather not duplicate same documentation in different places.
/etc/rc.resume is not used for auto-reboot nor general daemon startup described in rc(8).

Do you have any idea how to mention rc.resume in rc(8) correctly?

julian added a comment.EditedMay 9 2018, 12:16 AM
In D15247#323501, @avg wrote:

It would be nice to add a mention of rc.resume and the new resume keyword to rc(8) as Julian suggested.

I would rather not duplicate same documentation in different places.
/etc/rc.resume is not used for auto-reboot nor general daemon startup described in rc(8).
Do you have any idea how to mention rc.resume in rc(8) correctly?

as mentioned before, add some cross referencing in the related man pages. Use the "See also" sections.

Do you have any idea how to mention rc.resume in rc(8) correctly?

as mentioned before, add some cross referencing in the related man pages. Use the "See also" sections.

I don't see why rc(8) needs silent reference to acpiconf(8) as they are not related at all.

Add reference to rcorder(8) manual page.

avg added inline comments.May 13 2018, 11:52 AM
sbin/rcorder/rcorder.8
154 ↗(On Diff #42322)

It seems that rc.shutdown.8 is just an alias for rc.8, do we add a cross-references in such a case?
What precedents do we have?

Also, rc.8 has a section named "Operation of rc.shutdown".
Would it make sense to add a similar small section for rc.resume?
And rc.resume.8 alias for rc.8 (similarly to shutdown).

eugen_grosbein.net added a comment.EditedMay 13 2018, 5:02 PM

NAME

rc - command scripts for auto-reboot and daemon startup

/etc/rc.d/rc.resume is just script called by devd (see /etc/devd.conf) or apmd.conf (see /etc/apmd.conf). It has nothing to do with rc(8) auto-reboot or daemon startup procedures. I do not see why its description should be there.

It seems that rc.shutdown.8 is just an alias for rc.8, do we add a cross-references in such a case?

Yes, it is for now. I do not see how this could be bad. OTOH, I can imagine rc.shutdown.8 be separated from rc,8 to distinct file, so I prefer to link to the name, not to the file.

avg added a comment.May 13 2018, 8:55 PM

NAME

rc - command scripts for auto-reboot and daemon startup

/etc/rc.d/rc.resume is just script called by devd (see /etc/devd.conf) or apmd.conf (see /etc/apmd.conf). It has nothing to do with rc(8) auto-reboot or daemon startup procedures. I do not see why its description should be there.

By the same logic, rc.shutdown is just a script called by init.
rc.resume shares infrastructure with rc and you are extending that sharing.
I do not see why rc.resume cannot be described in rc.

avg added a comment.May 13 2018, 8:56 PM

It seems that rc.shutdown.8 is just an alias for rc.8, do we add a cross-references in such a case?

Yes, it is for now. I do not see how this could be bad. OTOH, I can imagine rc.shutdown.8 be separated from rc,8 to distinct file, so I prefer to link to the name, not to the file.

I understand your opinion. I asked for rules and precedents. Please research.

eugen_grosbein.net edited the test plan for this revision. (Show Details)May 17 2018, 7:20 PM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 27 2018, 5:21 PM
This revision was automatically updated to reflect the committed changes.