From: Michal Pecio <michal.pecio@gmail.com>
To: Niklas Neronin <niklas.neronin@linux.intel.com>
Cc: mathias.nyman@linux.intel.com, linux-usb@vger.kernel.org
Subject: Re: [PATCH 7/7] usb: xhci: standardize address format
Date: Tue, 9 Sep 2025 11:06:54 +0200 [thread overview]
Message-ID: <20250909110654.4d064391.michal.pecio@gmail.com> (raw)
In-Reply-To: <20250903170127.2190730-8-niklas.neronin@linux.intel.com>
On Wed, 3 Sep 2025 19:01:27 +0200, Niklas Neronin wrote:
> In the xHCI driver, printed hexadecimal values can be ambiguous, making it
> difficult to distinguish between values and addresses. To enhance clarity,
> all DMA addresses are now prefixed with the '@' symbol, ensuring immediate
> recognition as addresses.
Is it really a problem? Which values look like addresses?
Is it important enough to justify merge conflicts on multiple debug
messages when porting patches to stable? There are many inconsistencies
and typose in those messages, but I only clean them up if change is
necessary for other reasons.
> The '@' prefix is removed from '%p' specifiers, as they represent unique
> address IDs rather than actual addresses. The hashing process does not
> preserve any relation between addresses; for instance, if two addresses
> are X bytes apart, their hashed counterparts will not reflect this
> distinction.
Is it really a problem? BTW, you can reboot with 'no_hash_pointers'
to make %p work normally for debugging.
Personally, I do believe that there is a problem: those @ add no real
information and they need to be stripped by scripts or when copying
numbers from logs to calculators. But see comment above.
This problem applies to new cases added by this patch as well.
And what if the kernel starts hashing %pad by default? ;)
> Exceptions to the '@' prefix rule are functions xhci_ring_enqueue_show()
> and xhci_ring_dequeue_show(), which exclusively print to the enqueue and
> dequeue debugfs files, containing only addresses.
So debugfs will also get @ now, except for two files apparently?
Why are those files left out and inconsistent with the rest? If the
answer is "because the @ prefix is annoying and breaks tools" then the
same answer applies to every other debugfs file ;)
I have a script which parses event-ring/trbs and command-ring/trbs to
print commands and their completions together. Others may have other
scripts. They will stop working now. And for what gain?
debugfs is nothing but dumps od xHCI data structures, anyone going
there already knows what those fields are.
> Standardize printing of all 64-bit addresses read from registers, using
> the "0x%llx" specifier.
%#llx is easier to type and less eye sore than 0x%llx.
The 0x prefix is maybe rarely necessary for humans, but useful because
such format is ready to parse by hex-aware calculators or scripts.
Same argument works against @ prefix. Scripting languages, terminals
and text editors can select whole words and we don't need @ included.
> Adding padding is unnecessary and provides no useful information.
> Prefix the value with "0x" to clearly indicate that its a hexadecimal.
Sounds like an argument against converting to %pad in other places?
That being said, I'm not sure if %08llx is truly evil yet.
> $ git grep -n '0x%' | wc -l
> 39796
> $ git grep -n '%#' | wc -l
> 5204
Not sure what is this doing in a commit message?
> Redundant "0x" string prefix is removed from DMA addresses printed
> using the '%pad' specifier, since '%pad' automatically includes the
> "0x" prefix.
Not sure if urgent enough to bother, but makes sense of course.
Regards,
Michal
next prev parent reply other threads:[~2025-09-09 9:07 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 17:01 [PATCH 0/7] usb: xhci: enhancements to address printing Niklas Neronin
2025-09-03 17:01 ` [PATCH 1/7] usb: xhci-dbgcap: correct DMA address handling Niklas Neronin
2025-09-09 10:13 ` Michal Pecio
2025-09-10 8:00 ` Neronin, Niklas
2025-09-10 8:15 ` Michal Pecio
2025-09-03 17:01 ` [PATCH 2/7] usb: xhci: use '%pad' specifier for DMA address printing Niklas Neronin
2025-09-09 9:59 ` Michal Pecio
2025-09-09 11:29 ` Andy Shevchenko
2025-09-09 20:44 ` Michal Pecio
2025-09-10 5:56 ` Michal Pecio
2025-09-11 7:41 ` Andy Shevchenko
2025-09-11 9:34 ` Michal Pecio
2025-09-11 20:13 ` Andy Shevchenko
2025-09-12 9:46 ` Michal Pecio
2025-09-12 18:02 ` Andy Shevchenko
2025-09-13 8:12 ` Michal Pecio
2025-09-15 7:20 ` Andy Shevchenko
2025-09-15 10:22 ` Michal Pecio
2025-09-15 12:32 ` Neronin, Niklas
2025-09-16 9:32 ` Michal Pecio
2025-09-16 9:36 ` Michal Pecio
2025-09-15 14:22 ` Andy Shevchenko
2025-09-10 9:04 ` Michal Pecio
2025-09-10 9:17 ` Michal Pecio
2025-09-03 17:01 ` [PATCH 3/7] usb: xhci: improve Stream Context register debugging Niklas Neronin
2025-09-09 9:23 ` Michal Pecio
2025-09-03 17:01 ` [PATCH 4/7] usb: xhci: improve Endpoint " Niklas Neronin
2025-09-09 9:20 ` Michal Pecio
2025-09-09 10:24 ` Michal Pecio
2025-09-15 12:45 ` Neronin, Niklas
2025-09-03 17:01 ` [PATCH 5/7] usb: xhci: improve Command Ring Control " Niklas Neronin
2025-09-09 9:17 ` Michal Pecio
2025-09-09 10:20 ` Michal Pecio
2025-09-03 17:01 ` [PATCH 6/7] usb: xhci: improve Event Ring Dequeue Pointer Register debugging Niklas Neronin
2025-09-03 17:01 ` [PATCH 7/7] usb: xhci: standardize address format Niklas Neronin
2025-09-09 9:06 ` Michal Pecio [this message]
2025-09-15 13:24 ` Neronin, Niklas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250909110654.4d064391.michal.pecio@gmail.com \
--to=michal.pecio@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=niklas.neronin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox