linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Kent Overstreet <kent.overstreet@gmail.com>,
	Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-kernel@vger.kernel.org, pmladek@suse.com,
	rostedt@goodmis.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v3 29/33] PCI/P2PDMA: Convert to printbuf
Date: Wed, 8 Jun 2022 17:34:34 -0600	[thread overview]
Message-ID: <31d462be-c5c9-c895-0760-6b4a5cedfd14@deltatee.com> (raw)
In-Reply-To: <d5d0cc2e-79e1-3248-0f55-8f1afd21f926@gmail.com>



On 2022-06-08 17:24, Kent Overstreet wrote:
> On 6/8/22 17:11, Bjorn Helgaas wrote:
>> [+cc Logan, maintainer of p2pdma.c]
>>
>> On Sat, Jun 04, 2022 at 03:30:38PM -0400, Kent Overstreet wrote:
>>> This converts from seq_buf to printbuf. We're using printbuf in external
>>> buffer mode, so it's a direct conversion, aside from some trivial
>>> refactoring in cpu_show_meltdown() to make the code more consistent.
>>
>> cpu_show_meltdown() doesn't appear in p2pdma.c.  Leftover from another
>> patch?  Maybe from 27/33 ("powerpc: Convert to printbuf")?
>>
>> I'm not opposed to this, but it would be nice to say what the benefit
>> is.  How is printbuf better than seq_buf?  It's not obvious from the
>> patch how this is better/safer/shorter/etc.
>>
>> Even the cover letter [1] is not very clear about the benefit.  Yes, I
>> see it has something to do with improving buffer management, and I
>> know from experience that's a pain.  Concrete examples of typical
>> printbuf usage and bugs that printbufs avoid would be helpful.
> 
> Take a look at the vsprintf.c conversion if you want to see big
> improvements. Also, %pf() is another thing that's going to enable a lot
> more improvements.

IMHO I'm not sure how these benefits are a result of what looks largely
like a rewrite and rename of seq_buf... Seems to me like it should be
possible to stick with seq_buf and add features to it instead of doing a
replace and remove. As I understand the kernel community, that is always
the preferred practice and would certainly reduce a lot of churn in this
series. But I haven't looked at the entire series and it's not really
something I'm responsible for, so take my opinion with a grain of salt.

>> I guess "external buffer mode" means we use an existing buffer (on the
>> stack in this case) instead of allocating a buffer from the heap [2]?
>> And we do that for performance (i.e., we know the max size) and to
>> avoid sleeping to alloc?
> 
> I did it that way because I didn't want to touch unrelated code more
> than was necessary - just doing a direct conversion. Heap allocation
> would probably make sense here, but it's not my code.

It was changed to a heap allocation recently because my pending patch
set will add a path where this code is called in an atomic context and
cannot sleep. Simplest solution was stack allocation instead of tracking
GFP context for the atomic path.

Logan


  reply	other threads:[~2022-06-08 23:34 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-04 19:30 [PATCH v3 00/33] Printbufs Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 01/33] lib/printbuf: New data structure for printing strings Kent Overstreet
2022-06-09 13:55   ` Petr Mladek
2022-06-04 19:30 ` [PATCH v3 02/33] lib/string_helpers: Convert string_escape_mem() to printbuf Kent Overstreet
2022-06-09 14:25   ` Petr Mladek
2022-06-09 17:53     ` Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 03/33] vsprintf: Convert " Kent Overstreet
2022-06-15  9:09   ` Rasmus Villemoes
2022-06-15 18:44     ` Kent Overstreet
2022-06-17  8:59       ` Rasmus Villemoes
2022-06-04 19:30 ` [PATCH v3 04/33] lib/hexdump: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 05/33] vsprintf: %pf(%p) Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 06/33] lib/string_helpers: string_get_size() now returns characters wrote Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 07/33] lib/printbuf: Heap allocation Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 08/33] lib/printbuf: Tabstops, indenting Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 09/33] lib/printbuf: Unit specifiers Kent Overstreet
2022-06-05  1:06   ` Joe Perches
2022-06-04 19:30 ` [PATCH v3 10/33] lib/pretty-printers: prt_string_option(), prt_bitflags() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 11/33] vsprintf: Improve number() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 12/33] vsprintf: prt_u64_minwidth(), prt_u64() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 13/33] test_printf: Drop requirement that sprintf not write past nul Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 14/33] vsprintf: Start consolidating printf_spec handling Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 15/33] vsprintf: Refactor resource_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 16/33] vsprintf: Refactor fourcc_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 17/33] vsprintf: Refactor ip_addr_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 18/33] vsprintf: Refactor mac_address_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 19/33] vsprintf: time_and_date() no longer takes printf_spec Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 20/33] vsprintf: flags_string() " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 21/33] vsprintf: Refactor device_node_string, fwnode_string Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 22/33] vsprintf: Refactor hex_string, bitmap_string_list, bitmap_string Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 23/33] Input/joystick/analog: Convert from seq_buf -> printbuf Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 24/33] mm/memcontrol.c: Convert to printbuf Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 25/33] clk: tegra: bpmp: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 26/33] tools/testing/nvdimm: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 27/33] powerpc: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 28/33] x86/resctrl: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 29/33] PCI/P2PDMA: " Kent Overstreet
2022-06-08 21:11   ` Bjorn Helgaas
2022-06-08 23:24     ` Kent Overstreet
2022-06-08 23:34       ` Logan Gunthorpe [this message]
2022-06-08 23:40       ` Bjorn Helgaas
2022-06-04 19:30 ` [PATCH v3 30/33] tracing: trace_events_synth: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 31/33] d_path: prt_path() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 32/33] tracing: Convert to printbuf Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 33/33] Delete seq_buf Kent Overstreet
2022-06-05 16:21 ` [PATCH v3 00/33] Printbufs Steven Rostedt
2022-06-05 17:55   ` Kent Overstreet

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=31d462be-c5c9-c895-0760-6b4a5cedfd14@deltatee.com \
    --to=logang@deltatee.com \
    --cc=helgaas@kernel.org \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    /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).