linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension
@ 2021-08-26 18:43 Joe Perches
  2021-08-26 18:43 ` [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex Joe Perches
  2021-08-27  7:51 ` [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Andy Shevchenko
  0 siblings, 2 replies; 12+ messages in thread
From: Joe Perches @ 2021-08-26 18:43 UTC (permalink / raw)
  To: Andy Shevchenko, Rasmus Villemoes, linux-scsi, storagedev
  Cc: linux-doc, linux-kernel, linux-staging

Several sysfs uses that could use %*ph are upper case hex output.
Add a flag to the short hex formatting routine in vsprintf to support them.
Add documentation too.

Joe Perches (5):
  vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  scsi: aacraid: Use vsprintf %phNX extension
  scsi: hpsa: Use vsprintf %phNX extension
  scsi: smartpqi: Use vsprintf %phNX extension
  staging: r8188eu: Use vsprintf extension %phCX to format a copy_to_user string

 Documentation/core-api/printk-formats.rst    |  6 +++
 drivers/scsi/aacraid/linit.c                 |  7 +---
 drivers/scsi/hpsa.c                          |  8 +---
 drivers/scsi/smartpqi/smartpqi_init.c        |  8 +---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c |  9 ++---
 lib/vsprintf.c                               | 42 ++++++++++++--------
 6 files changed, 37 insertions(+), 43 deletions(-)

-- 
2.30.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  2021-08-26 18:43 [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Joe Perches
@ 2021-08-26 18:43 ` Joe Perches
  2021-08-27  7:48   ` Andy Shevchenko
  2021-08-27  7:51 ` [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Andy Shevchenko
  1 sibling, 1 reply; 12+ messages in thread
From: Joe Perches @ 2021-08-26 18:43 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Andy Shevchenko,
	Rasmus Villemoes
  Cc: Jonathan Corbet, linux-doc, linux-kernel

A few sysfs output uses of hex arrays are uppercase and are nominally ABI.

Add a mechanism to the existing vsprintf %*ph hex output extension to
support upper case hex output.

Signed-off-by: Joe Perches <joe@perches.com>
---
 Documentation/core-api/printk-formats.rst |  6 ++++
 lib/vsprintf.c                            | 42 ++++++++++++++---------
 2 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index e08bbe9b0cbf3..ca750274992e6 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -284,10 +284,16 @@ Raw buffer as a hex string
 
 ::
 
+	The preferred output is lowercase
 	%*ph	00 01 02  ...  3f
 	%*phC	00:01:02: ... :3f
 	%*phD	00-01-02- ... -3f
 	%*phN	000102 ... 3f
+	Formats with X are uppercase, used for backwards compatibility
+	%*phX	00 01 02  ...  3F
+	%*phCX	00:01:02: ... :3F
+	%*phDX	00-01-02- ... -3F
+	%*phNX	000102 ... 3F
 
 For printing small buffers (up to 64 bytes long) as a hex string with a
 certain separator. For larger buffers consider using
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 134216c45980e..5c22a07bbe3a7 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1147,7 +1147,10 @@ char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
 {
 	int i, len = 1;		/* if we pass '%ph[CDN]', field width remains
 				   negative value, fallback to the default */
-	char separator;
+	char separator = ' ';
+	int count = 1;
+	bool found = true;
+	char locase = 0x20;	/* ASCII OR'd for lower case see: number() */
 
 	if (spec.field_width == 0)
 		/* nothing to print */
@@ -1156,30 +1159,35 @@ char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
 	if (check_pointer(&buf, end, addr, spec))
 		return buf;
 
-	switch (fmt[1]) {
-	case 'C':
-		separator = ':';
-		break;
-	case 'D':
-		separator = '-';
-		break;
-	case 'N':
-		separator = 0;
-		break;
-	default:
-		separator = ' ';
-		break;
-	}
+	do {
+		switch (fmt[count++]) {
+		case 'C':
+			separator = ':';
+			break;
+		case 'D':
+			separator = '-';
+			break;
+		case 'N':
+			separator = 0;
+			break;
+		case 'X':
+			locase = 0;
+			break;
+		default:
+			found = false;
+			break;
+		}
+	} while (found);
 
 	if (spec.field_width > 0)
 		len = min_t(int, spec.field_width, 64);
 
 	for (i = 0; i < len; ++i) {
 		if (buf < end)
-			*buf = hex_asc_hi(addr[i]);
+			*buf = hex_asc_upper_hi(addr[i]) | locase;
 		++buf;
 		if (buf < end)
-			*buf = hex_asc_lo(addr[i]);
+			*buf = hex_asc_upper_lo(addr[i]) | locase;
 		++buf;
 
 		if (separator && i != len - 1) {
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  2021-08-26 18:43 ` [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex Joe Perches
@ 2021-08-27  7:48   ` Andy Shevchenko
  2021-08-27  8:08     ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-08-27  7:48 UTC (permalink / raw)
  To: Joe Perches
  Cc: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Rasmus Villemoes,
	Jonathan Corbet, linux-doc, linux-kernel

On Thu, Aug 26, 2021 at 11:43:01AM -0700, Joe Perches wrote:
> A few sysfs output uses of hex arrays are uppercase and are nominally ABI.
> 
> Add a mechanism to the existing vsprintf %*ph hex output extension to
> support upper case hex output.

...

> +	The preferred output is lowercase
>  	%*ph	00 01 02  ...  3f
>  	%*phC	00:01:02: ... :3f
>  	%*phD	00-01-02- ... -3f
>  	%*phN	000102 ... 3f
> +	Formats with X are uppercase, used for backwards compatibility
> +	%*phX	00 01 02  ...  3F
> +	%*phCX	00:01:02: ... :3F
> +	%*phDX	00-01-02- ... -3F
> +	%*phNX	000102 ... 3F

Why not using %*pH...?

...

> +	char locase = 0x20;	/* ASCII OR'd for lower case see: number() */

If you use h vs H, you may derive this from (fmt[...] & SMALL).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension
  2021-08-26 18:43 [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Joe Perches
  2021-08-26 18:43 ` [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex Joe Perches
@ 2021-08-27  7:51 ` Andy Shevchenko
  2021-08-27  8:10   ` Joe Perches
  1 sibling, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-08-27  7:51 UTC (permalink / raw)
  To: Joe Perches
  Cc: Rasmus Villemoes, linux-scsi, storagedev, linux-doc, linux-kernel,
	linux-staging

On Thu, Aug 26, 2021 at 11:43:00AM -0700, Joe Perches wrote:
> Several sysfs uses that could use %*ph are upper case hex output.
> Add a flag to the short hex formatting routine in vsprintf to support them.
> Add documentation too.

Thanks!

Unfortunately I have got only first patch and this cover letter. Can you,
please, Cc entire series?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  2021-08-27  7:48   ` Andy Shevchenko
@ 2021-08-27  8:08     ` Joe Perches
  2021-08-27  8:49       ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2021-08-27  8:08 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Rasmus Villemoes,
	Jonathan Corbet, linux-doc, linux-kernel

On Fri, 2021-08-27 at 10:48 +0300, Andy Shevchenko wrote:
> On Thu, Aug 26, 2021 at 11:43:01AM -0700, Joe Perches wrote:
> > A few sysfs output uses of hex arrays are uppercase and are nominally ABI.
> > 
> > Add a mechanism to the existing vsprintf %*ph hex output extension to
> > support upper case hex output.
> 
> ...
> 
> > +	The preferred output is lowercase
> >  	%*ph	00 01 02  ...  3f
> >  	%*phC	00:01:02: ... :3f
> >  	%*phD	00-01-02- ... -3f
> >  	%*phN	000102 ... 3f
> > +	Formats with X are uppercase, used for backwards compatibility
> > +	%*phX	00 01 02  ...  3F
> > +	%*phCX	00:01:02: ... :3F
> > +	%*phDX	00-01-02- ... -3F
> > +	%*phNX	000102 ... 3F
> 
> Why not using %*pH...?

I find X more intelligible.

> > +	char locase = 0x20;	/* ASCII OR'd for lower case see: number() */
> 
> If you use h vs H, you may derive this from (fmt[...] & SMALL).

It's not necessary to use any more of the rather limited vsprintf
extension namespace.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension
  2021-08-27  7:51 ` [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Andy Shevchenko
@ 2021-08-27  8:10   ` Joe Perches
  2021-08-27  8:46     ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2021-08-27  8:10 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rasmus Villemoes, linux-scsi, storagedev, linux-doc, linux-kernel,
	linux-staging

On Fri, 2021-08-27 at 10:51 +0300, Andy Shevchenko wrote:
> On Thu, Aug 26, 2021 at 11:43:00AM -0700, Joe Perches wrote:
> > Several sysfs uses that could use %*ph are upper case hex output.
> > Add a flag to the short hex formatting routine in vsprintf to support them.
> > Add documentation too.
> 
> Thanks!
> 
> Unfortunately I have got only first patch and this cover letter. Can you,
> please, Cc entire series?

It's on lore.

https://lore.kernel.org/lkml/cover.1630003183.git.joe@perches.com/T/#u
 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension
  2021-08-27  8:10   ` Joe Perches
@ 2021-08-27  8:46     ` Andy Shevchenko
  2021-08-27 10:23       ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-08-27  8:46 UTC (permalink / raw)
  To: Joe Perches
  Cc: Rasmus Villemoes, linux-scsi, storagedev, linux-doc, linux-kernel,
	linux-staging

On Fri, Aug 27, 2021 at 01:10:41AM -0700, Joe Perches wrote:
> On Fri, 2021-08-27 at 10:51 +0300, Andy Shevchenko wrote:
> > On Thu, Aug 26, 2021 at 11:43:00AM -0700, Joe Perches wrote:
> > > Several sysfs uses that could use %*ph are upper case hex output.
> > > Add a flag to the short hex formatting routine in vsprintf to support them.
> > > Add documentation too.
> >
> > Thanks!
> >
> > Unfortunately I have got only first patch and this cover letter. Can you,
> > please, Cc entire series?
> 
> It's on lore.
> 
> https://lore.kernel.org/lkml/cover.1630003183.git.joe@perches.com/T/#u

Thanks. So, you won't me to review them in a regular way :-)

TBH, I think those examples may pretty much be safe to use small
letters always.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  2021-08-27  8:08     ` Joe Perches
@ 2021-08-27  8:49       ` Andy Shevchenko
  2021-08-27 10:49         ` Petr Mladek
  2021-08-28  2:49         ` Joe Perches
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Shevchenko @ 2021-08-27  8:49 UTC (permalink / raw)
  To: Joe Perches
  Cc: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Rasmus Villemoes,
	Jonathan Corbet, linux-doc, linux-kernel

On Fri, Aug 27, 2021 at 01:08:10AM -0700, Joe Perches wrote:
> On Fri, 2021-08-27 at 10:48 +0300, Andy Shevchenko wrote:
> > On Thu, Aug 26, 2021 at 11:43:01AM -0700, Joe Perches wrote:
> > > A few sysfs output uses of hex arrays are uppercase and are nominally ABI.
> > > 
> > > Add a mechanism to the existing vsprintf %*ph hex output extension to
> > > support upper case hex output.
> > 
> > ...
> > 
> > > +	The preferred output is lowercase
> > >  	%*ph	00 01 02  ...  3f
> > >  	%*phC	00:01:02: ... :3f
> > >  	%*phD	00-01-02- ... -3f
> > >  	%*phN	000102 ... 3f
> > > +	Formats with X are uppercase, used for backwards compatibility
> > > +	%*phX	00 01 02  ...  3F
> > > +	%*phCX	00:01:02: ... :3F
> > > +	%*phDX	00-01-02- ... -3F
> > > +	%*phNX	000102 ... 3F
> > 
> > Why not using %*pH...?
> 
> I find X more intelligible.
> 
> > > +	char locase = 0x20;	/* ASCII OR'd for lower case see: number() */
> > 
> > If you use h vs H, you may derive this from (fmt[...] & SMALL).
> 
> It's not necessary to use any more of the rather limited vsprintf
> extension namespace.

I understand your concern, but %*ph is quite widely used (I guess top 1 or 2
among all %p extensions), its performance degradation with your code may affect
a lot of other users and hence a kernel as a whole.

So, that's why my proposal stays.

Of course you may provide a benchmark (btw, where are the test cases for this?)
for yours and mine variant and we will see if it makes sense to optimize.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension
  2021-08-27  8:46     ` Andy Shevchenko
@ 2021-08-27 10:23       ` Greg KH
  2021-08-27 16:09         ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Greg KH @ 2021-08-27 10:23 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Joe Perches, Rasmus Villemoes, linux-scsi, storagedev, linux-doc,
	linux-kernel, linux-staging

On Fri, Aug 27, 2021 at 11:46:20AM +0300, Andy Shevchenko wrote:
> On Fri, Aug 27, 2021 at 01:10:41AM -0700, Joe Perches wrote:
> > On Fri, 2021-08-27 at 10:51 +0300, Andy Shevchenko wrote:
> > > On Thu, Aug 26, 2021 at 11:43:00AM -0700, Joe Perches wrote:
> > > > Several sysfs uses that could use %*ph are upper case hex output.
> > > > Add a flag to the short hex formatting routine in vsprintf to support them.
> > > > Add documentation too.
> > >
> > > Thanks!
> > >
> > > Unfortunately I have got only first patch and this cover letter. Can you,
> > > please, Cc entire series?
> > 
> > It's on lore.
> > 
> > https://lore.kernel.org/lkml/cover.1630003183.git.joe@perches.com/T/#u
> 
> Thanks. So, you won't me to review them in a regular way :-)
> 
> TBH, I think those examples may pretty much be safe to use small
> letters always.

I agree, let's just fix the users here to use small letters instead of
adding another modifier to the kernel.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  2021-08-27  8:49       ` Andy Shevchenko
@ 2021-08-27 10:49         ` Petr Mladek
  2021-08-28  2:49         ` Joe Perches
  1 sibling, 0 replies; 12+ messages in thread
From: Petr Mladek @ 2021-08-27 10:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Joe Perches, Steven Rostedt, Sergey Senozhatsky, Rasmus Villemoes,
	Matthew Wilcox, Jonathan Corbet, linux-doc, linux-kernel

On Fri 2021-08-27 11:49:07, Andy Shevchenko wrote:
> On Fri, Aug 27, 2021 at 01:08:10AM -0700, Joe Perches wrote:
> > On Fri, 2021-08-27 at 10:48 +0300, Andy Shevchenko wrote:
> > > On Thu, Aug 26, 2021 at 11:43:01AM -0700, Joe Perches wrote:
> > > > A few sysfs output uses of hex arrays are uppercase and are nominally ABI.
> > > > 
> > > > Add a mechanism to the existing vsprintf %*ph hex output extension to
> > > > support upper case hex output.
> > > 
> > > ...
> > > 
> > > > +	The preferred output is lowercase
> > > >  	%*ph	00 01 02  ...  3f
> > > >  	%*phC	00:01:02: ... :3f
> > > >  	%*phD	00-01-02- ... -3f
> > > >  	%*phN	000102 ... 3f
> > > > +	Formats with X are uppercase, used for backwards compatibility
> > > > +	%*phX	00 01 02  ...  3F
> > > > +	%*phCX	00:01:02: ... :3F
> > > > +	%*phDX	00-01-02- ... -3F
> > > > +	%*phNX	000102 ... 3F
> > > 
> > > Why not using %*pH...?

I though about this as well.

> > I find X more intelligible.

I would slightly prefer %pH. I always have problems to parse long
sequences of modifiers. So, the shorter format the better.

Of course, it means that 'H' won't be usable for another purpose.
But it will happen one day anyway. Well, this is why I do not
have strong opinion.

I am more and more convinced that we will need another approach.
Mathew Wilcox has had an idea to add support for custom callbacks
that would be able to format the string, something like:

   vsprintf("Date: %pX(%p)\n", format_date, time_stamp);

I think that it might even be possible to do something like:

   vsprintf("Date: %pX\n", format_date(time));

, where the format_date() would be a macro that would create
a struct at stack a pass it as a pointer:

#define format_date(time)			   \
({						   \
	struct vsprintf_callback c = {		   \
		.func = vsprintf_format_date,	   \
		.arg1 = time,			   \
	}					   \
						   \
	&c;					   \
})

and vsprintf would internally do something like:

char *custom_format(char *buf, char *end, vsprintf_callback *c,
			 struct printf_spec spec, const char *fmt)
{
	return c->func(buf, end, c->arg1, spec);
}

It would allow to replace all the magic %pXYZ modifiers with
self-explanatory callbacks. While still keeping it easy to use.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension
  2021-08-27 10:23       ` Greg KH
@ 2021-08-27 16:09         ` Joe Perches
  0 siblings, 0 replies; 12+ messages in thread
From: Joe Perches @ 2021-08-27 16:09 UTC (permalink / raw)
  To: Greg KH, Andy Shevchenko
  Cc: Rasmus Villemoes, linux-scsi, storagedev, linux-doc, linux-kernel,
	linux-staging

On Fri, 2021-08-27 at 12:23 +0200, Greg KH wrote:
> On Fri, Aug 27, 2021 at 11:46:20AM +0300, Andy Shevchenko wrote:
> > On Fri, Aug 27, 2021 at 01:10:41AM -0700, Joe Perches wrote:
> > > On Fri, 2021-08-27 at 10:51 +0300, Andy Shevchenko wrote:
> > > > On Thu, Aug 26, 2021 at 11:43:00AM -0700, Joe Perches wrote:
> > > > > Several sysfs uses that could use %*ph are upper case hex output.
> > > > > Add a flag to the short hex formatting routine in vsprintf to support them.
> > > > > Add documentation too.
> > > > 
> > > > Thanks!
> > > > 
> > > > Unfortunately I have got only first patch and this cover letter. Can you,
> > > > please, Cc entire series?
> > > 
> > > It's on lore.
> > > 
> > > https://lore.kernel.org/lkml/cover.1630003183.git.joe@perches.com/T/#u
> > 
> > Thanks. So, you won't me to review them in a regular way :-)
> > 
> > TBH, I think those examples may pretty much be safe to use small
> > letters always.
> 
> I agree, let's just fix the users here to use small letters instead of
> adding another modifier to the kernel.

ABI _should_ mean stability for random parsers.

I don't use these so I don't care that much.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex
  2021-08-27  8:49       ` Andy Shevchenko
  2021-08-27 10:49         ` Petr Mladek
@ 2021-08-28  2:49         ` Joe Perches
  1 sibling, 0 replies; 12+ messages in thread
From: Joe Perches @ 2021-08-28  2:49 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Rasmus Villemoes,
	Jonathan Corbet, linux-doc, linux-kernel

On Fri, 2021-08-27 at 11:49 +0300, Andy Shevchenko wrote:
> On Fri, Aug 27, 2021 at 01:08:10AM -0700, Joe Perches wrote:
> > On Fri, 2021-08-27 at 10:48 +0300, Andy Shevchenko wrote:
> > > On Thu, Aug 26, 2021 at 11:43:01AM -0700, Joe Perches wrote:
> > > > A few sysfs output uses of hex arrays are uppercase and are nominally ABI.
> > > > 
> > > > Add a mechanism to the existing vsprintf %*ph hex output extension to
> > > > support upper case hex output.
> > > 
> > > ...
> > > 
> > > > +	The preferred output is lowercase
> > > >  	%*ph	00 01 02  ...  3f
> > > >  	%*phC	00:01:02: ... :3f
> > > >  	%*phD	00-01-02- ... -3f
> > > >  	%*phN	000102 ... 3f
> > > > +	Formats with X are uppercase, used for backwards compatibility
> > > > +	%*phX	00 01 02  ...  3F
> > > > +	%*phCX	00:01:02: ... :3F
> > > > +	%*phDX	00-01-02- ... -3F
> > > > +	%*phNX	000102 ... 3F
> > > 
> > > Why not using %*pH...?
> > 
> > I find X more intelligible.
> > 
> > > > +	char locase = 0x20;	/* ASCII OR'd for lower case see: number() */
> > > 
> > > If you use h vs H, you may derive this from (fmt[...] & SMALL).
> > 
> > It's not necessary to use any more of the rather limited vsprintf
> > extension namespace.
> 
> I understand your concern, but %*ph is quite widely used (I guess top 1 or 2
> among all %p extensions),

Cumulatively 3rd after %pM and %pOF

> its performance degradation with your code may affect
> a lot of other users and hence a kernel as a whole.
> 
> So, that's why my proposal stays.

Knock yourself out.

> Of course you may provide a benchmark (btw, where are the test cases for this?)

You are welcome to provide both test cases and benchmarks.
I find the whole thing rather dull.

> for yours and mine variant and we will see if it makes sense to optimize.

It doesn't.  Anyone thinking there is a required printf/vsprintf
optimization in the kernel is decidedly barking up the wrong tree.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-08-28  2:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-26 18:43 [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Joe Perches
2021-08-26 18:43 ` [PATCH 1/5] vsprintf/Documentation: Add X to %*ph extension to output upper case hex Joe Perches
2021-08-27  7:48   ` Andy Shevchenko
2021-08-27  8:08     ` Joe Perches
2021-08-27  8:49       ` Andy Shevchenko
2021-08-27 10:49         ` Petr Mladek
2021-08-28  2:49         ` Joe Perches
2021-08-27  7:51 ` [PATCH 0/5] vsprintf and uses: Add upper case output to %*ph extension Andy Shevchenko
2021-08-27  8:10   ` Joe Perches
2021-08-27  8:46     ` Andy Shevchenko
2021-08-27 10:23       ` Greg KH
2021-08-27 16:09         ` Joe Perches

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).