Bug 279708 - comment for sleepq_switch describes the thread lock wrong
Summary: comment for sleepq_switch describes the thread lock wrong
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-13 11:57 UTC by thejonny
Modified: 2024-11-19 14:34 UTC (History)
2 users (show)

See Also:


Attachments
correct comment of sleepq_switch about thread lock (828 bytes, patch)
2024-06-13 11:57 UTC, thejonny
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description thejonny 2024-06-13 11:57:02 UTC
Created attachment 251431 [details]
correct comment of sleepq_switch about thread lock

sleepq_switch releases the thread lock, but the documentation comment says otherwise.

the shortest diff would be to change with to without in "Returns with thread lock."

but i would use the same formulation as in mi_switch:
"The thread lock is required on entry and is no longer held on return."
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-11-12 02:02:09 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1030ee9128373e7819e5d4a45475ad8cda24fec9

commit 1030ee9128373e7819e5d4a45475ad8cda24fec9
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-12 01:57:24 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-12 01:57:24 +0000

    sleepqueue: Fix the comment for sleepq_switch()

    The comment from mi_switch() applies here.

    PR:             279708
    Fixes:          686bcb5c14ab ("schedlock 4/4")
    MFC after:      1 week

 sys/kern/subr_sleepqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 2 Trycia Gibson 2024-11-18 02:57:53 UTC
The formula for program execution needs to be exactly the same to release the thread lock https://cgit.freebsd.org/src/commit/?id=1030ee9128373e7819e5d4a45475ad8cda24fec9 https://retrobowlonline.co 
The easiest way to make the modification would be to remove "Returns with thread lock."
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-11-19 14:32:03 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b9f9be5d92a345a52e1dedffb5fdd2e7b6bbc2e2

commit b9f9be5d92a345a52e1dedffb5fdd2e7b6bbc2e2
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-12 01:57:24 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-19 14:15:07 +0000

    sleepqueue: Fix the comment for sleepq_switch()

    The comment from mi_switch() applies here.

    PR:             279708
    Fixes:          686bcb5c14ab ("schedlock 4/4")
    MFC after:      1 week

    (cherry picked from commit 1030ee9128373e7819e5d4a45475ad8cda24fec9)

 sys/kern/subr_sleepqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-11-19 14:32:04 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5544391d872495b5517ac16ce9a46027925efc1a

commit 5544391d872495b5517ac16ce9a46027925efc1a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-12 01:57:24 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-19 14:15:15 +0000

    sleepqueue: Fix the comment for sleepq_switch()

    The comment from mi_switch() applies here.

    PR:             279708
    Fixes:          686bcb5c14ab ("schedlock 4/4")
    MFC after:      1 week

    (cherry picked from commit 1030ee9128373e7819e5d4a45475ad8cda24fec9)

 sys/kern/subr_sleepqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)