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)
Thu, Nov 7, 12:21 PM
Unknown Object (File)
Oct 17 2024, 7:52 PM
Unknown Object (File)
Oct 14 2024, 1:57 AM
Unknown Object (File)
Oct 7 2024, 7:00 PM
Unknown Object (File)
Oct 3 2024, 5:01 PM
Unknown Object (File)
Oct 3 2024, 10:18 AM
Unknown Object (File)
Oct 1 2024, 3:59 PM
Unknown Object (File)
Oct 1 2024, 1:29 PM
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.