Page MenuHomeFreeBSD

kbd: replace vestigial spl calls with Giant assertions
ClosedPublic

Authored by emaste on Mar 23 2022, 6:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 9 2024, 10:00 AM
Unknown Object (File)
Dec 23 2023, 1:20 AM
Unknown Object (File)
Dec 15 2023, 1:32 PM
Unknown Object (File)
Dec 12 2023, 9:16 AM
Unknown Object (File)
Oct 3 2023, 2:18 PM
Unknown Object (File)
Sep 6 2023, 9:10 AM
Unknown Object (File)
Aug 31 2023, 3:56 AM
Unknown Object (File)
Aug 31 2023, 12:10 AM
Subscribers
None

Details

Summary
The keyboard driver used to be protected via spl* interrupt priority
calls but as with the rest of the kernel was migrated to use the Giant
lock (mutex).  The spl calls are NOPs but may be confusing; remove them
and add assertions that Giant is held.

PR:             206680

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste created this revision.

This seems ok. There is some conflation between the "bus topo" lock (which is Giant under the hood) and Giant: kbd_allocate() is called via DEVICE_ATTACH and is formally locked by the former, whereas cdev entry points are locked by Giant (via D_NEEDGIANT).

sys/dev/kbd/kbd.c
372

I think this function is unused, BTW. Maybe better to leave it though.

This revision is now accepted and ready to land.Mar 24 2022, 3:38 PM

There is some conflation between the "bus topo" lock (which is Giant under the hood) and Giant

I will mention this in the commit message. I think it's fine, the assertion will either be a small item to address with bus topology locking work or will be removed if kbd is brought out from under Giant.

sys/dev/kbd/kbd.c
372

I am grepping through all commits now to confirm.

sys/dev/kbd/kbd.c
372

Indeed, the only commits referencing kbd_change_callback in the tree are:

R10:617b90803690a7ece8e76a49803385516bac380b (introduction)
R10:c959700c776fc1dd722aa4d265ccda49ee227fef (style)
R10:04551c6ce5981d985b31476094aa79186a874554 (referenced in diff context lines)
R10:bbecb73b0ebe929ece4f2409c8d990718655a52d (style)