Page MenuHomeFreeBSD

Improve sdhci slot_printf() debug printing.
ClosedPublic

Authored by bz on Mar 29 2019, 9:51 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 18 2024, 6:13 PM
Unknown Object (File)
Feb 10 2024, 2:59 PM
Unknown Object (File)
Jan 15 2024, 2:31 PM
Unknown Object (File)
Dec 29 2023, 8:47 AM
Unknown Object (File)
Dec 23 2023, 3:16 AM
Unknown Object (File)
Dec 20 2023, 9:23 PM
Unknown Object (File)
Nov 6 2023, 5:36 AM
Unknown Object (File)
Sep 1 2023, 8:08 AM
Subscribers

Details

Summary

Improve sdhci slot_printf() debug printing.

Currently slot_printf() uses two printf() calls to print the
device-slot name, and actual message. When other printf()s are
ongoing in parallel this can lead to mixed message on the console,
which is especially unhelpful for debugging or error messages.

Take a hit on the stack and vsnprintf() the message so the buffer.
This way it can be printed along with the device-slot name in one go
avoiding console gibberish.

Sponsored by: The FreeBSD Foundation
MFC After: 2 weeks

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

marius requested changes to this revision.Mar 31 2019, 10:35 PM
marius added inline comments.
sys/dev/sdhci/sdhci.c
188 โ†—(On Diff #55588)

Apart from the fact that MAX_INPUT doesn't seem like a good match (maximum _output_ would be the interesting part), just hardcoding a size of 128 (and, thus, also saving some stack) should be more than sufficient given that implementing messages that don't fit within 80 columns would be inconvenient.

This revision now requires changes to proceed.Mar 31 2019, 10:35 PM
sys/dev/sdhci/sdhci.c
188 โ†—(On Diff #55588)

+1
Or plan B: use sbuf.
But I don't know what can / can't be malloced from the contexts this has been called from. If it's at all complicated, marius' suggestion is sufficient and likely just fine.

Update based on feedback from marius/imp.

bz marked 2 inline comments as done.Apr 30 2019, 8:36 PM

I'd like to commit this the next days. Can someone please review? If not it'll go in by Sat 8 June.

Thanks, looks good to me now

This revision is now accepted and ready to land.Jun 7 2019, 9:55 PM
This revision was automatically updated to reflect the committed changes.