Re: [PATCH v4 00/34] Printbufs - new data structure for building strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 20, 2022 at 04:19:31AM +0000, David Laight wrote:
> I really think that is a bad idea.
> printk() already uses a lot of stack, anything doing a recursive
> call is just making that worse.
> Especially since these calls can often be in error paths
> which are not often tested and can already be on deep stacks.

So it seems this is something you never actually checked, and I naively assumed
that you might actually know what you were talking about - an understandable
mistake, I think, because vsprintf.c is _a fucking mess_ and high stack usage
would be believable.

But the main part we're concerned with here, snprint() or prt_printf(), has no
such stack usage problems. On v5.18, the frame size is under 64 bytes. On my
branch, it's 72 bytes - higher because we do need to save arguments on the stack
for the pretty-printer invocation, and there's no way around that without
dropping to asm - although I'm allowing up to 8 arguments (besides the printbuf
itself), which is probably excessive.

So I'm not seeing what you're talking about.

In the leaf functions, the individual pretty-printers/%p extensions, those are
doing completely ridiculous things and I have fixed them all except
symbol_string() on my branch, and I'll get to that one.

Having a proper string library with useful helpers really makes things easier,
it turns out.

As for recursive %pf() invocations blowing the stack? I seriously fucking doubt
it, once you're in a pretty-printer where you've already got a printbuf you can
output to there's not much reason to be doing recursive calls to prt_printf()
passing it yet another pretty printer - that's not where %pf() is convenient,
what it makes convenient is using pretty printers when you're calling printk()
directly. In a pretty printer fuction, if you want to do recursive
pretty-printer calls you'd just call it directly! prt_printf(out, "%pf(%p)"),
foo_to_text, foo) is silly when you can just call foo_to_text(out, foo).

Now, I ask both of you please take your bureaucratic nitpicky nonsense and,
kindly, pretty please with sugar on top - stuff it. I much prefer to work with
people who don't waste my time, and who have actual _taste_.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux