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)
Mon, Nov 25, 1:43 AM
Unknown Object (File)
Nov 21 2024, 6:50 AM
Unknown Object (File)
Nov 18 2024, 4:24 PM
Unknown Object (File)
Nov 15 2024, 2:58 PM
Unknown Object (File)
Oct 15 2024, 4:47 AM
Unknown Object (File)
Oct 6 2024, 2:57 PM
Unknown Object (File)
Sep 30 2024, 4:23 PM
Unknown Object (File)
Sep 21 2024, 5:46 PM
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)