From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
John Ogness <john.ogness@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/2] hexdump: Allow skipping identical lines
Date: Mon, 13 Jan 2025 14:40:04 +0200 [thread overview]
Message-ID: <Z4UJpNnperJkbQFn@smile.fi.intel.com> (raw)
In-Reply-To: <20250110-perso-hexdump-v2-0-7f9a6a799170@bootlin.com>
On Fri, Jan 10, 2025 at 07:42:03PM +0100, Miquel Raynal wrote:
> While working on NAND issues, I used print_hex_dump() a lot to compare
> data. But I am mostly working on embedded systems where the kernel
> messages go through a serial console. Sometimes network support is an
> option, sometimes not. Anyway, I often print buffers both in kernel
> space and user space to compare them, and they may be full of 0's or
> 1's, which means lines are repeated a lot in the output and this is slow
> *and* hard to compare.
>
> I initially hacked into lib/hexdump.c for my own purpose and just
> discarded all the other users, but it felt like this might be a useful
> feature for others and decided to make it a public patch.
>
> * First patch changes the "ascii" parameter into a "flags" variable now
> accepting the value: DUMP_FLAG_ASCII.
> * Second patch adds a new flag to skip the identical lines, because this
> must be an opt-in parameter, I guess.
>
> The patch series has successfully gone through a round of
> kernel-test-robot.
>
> The Cc-list, as provided by get_maintainers.pl, was returning 330
> e-mail addresses which felt to much, so I ran the script only on the
> second patch (the printk/includes/debug/Doc changes). It gave this
> Cc-list which sounds more reasonable. Hopefully this is a smart move,
> otherwise let me know what you think would be best.
...
> 000007e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>
> And with the new flag added the code looks like this:
>
> print_hex_dump_debug("", DUMP_PREFIX_OFFSET, 32, 1, spinand->databuf, mtd->writesize,
> - 0);
> + DUMP_FLAG_SKIP_IDENTICAL_LINES);
>
> And the output is easier to parse and also faster to show on a serial
> console:
>
> 00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 00 10 00 2b 10 f1 92 00 00 00 00
> 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 db 93 e9 fc
> 00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> *
I see disadvantage in the output here, i.e. there is no visibility of how many
identical lines (bytes) were actually dumped. And IIRC the hexdump(1) behaviour
it prints last line no matter what.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-01-13 12:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 18:42 [PATCH v2 0/2] hexdump: Allow skipping identical lines Miquel Raynal
2025-01-10 18:42 ` [PATCH v2 1/2] hexdump: Convert the ascii boolean into a flag variable Miquel Raynal
2025-01-10 18:42 ` [PATCH v2 2/2] hexdump: Allow skipping identical lines Miquel Raynal
2025-01-10 19:39 ` David Laight
2025-01-11 9:54 ` Miquel Raynal
2025-01-11 12:10 ` David Laight
2025-01-13 10:04 ` Andy Shevchenko
2025-01-11 5:36 ` Randy Dunlap
2025-01-13 12:35 ` Andy Shevchenko
2025-01-17 16:27 ` Petr Mladek
2025-01-17 19:25 ` David Laight
2025-01-20 9:29 ` Miquel Raynal
2025-01-20 10:25 ` Petr Mladek
2025-01-13 12:40 ` Andy Shevchenko [this message]
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=Z4UJpNnperJkbQFn@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=john.ogness@linutronix.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=miquel.raynal@bootlin.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=thomas.petazzoni@bootlin.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;
as well as URLs for NNTP newsgroup(s).