linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	"Md. Haris Iqbal" <haris.iqbal@ionos.com>,
	Jack Wang <jinpu.wang@ionos.com>, Coly Li <colyli@kernel.org>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Carlos Maiolino <cem@kernel.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <jth@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@kernel.org>,
	linux-bcache@vger.kernel.org, dm-devel@lists.linux.dev,
	linux-btrfs@vger.kernel.org, gfs2@lists.linux.dev,
	linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: add more bio helper
Date: Thu, 24 Apr 2025 10:37:40 +0200	[thread overview]
Message-ID: <20250424083740.GA24723@lst.de> (raw)
In-Reply-To: <q53k4x5nshvr2zatrgyhygxouv7ijyepe6cj2pfooemi6gbu4y@lpxxcvozazzu>

On Wed, Apr 23, 2025 at 02:02:11PM -0400, Kent Overstreet wrote:
> Allocating your own bio doesn't allow you to safely exceed the
> BIO_MAX_VECS limit - there's places in the io path that need to bounce,
> and they all use biosets.

Yes.  Another reason not to do it, which I don't want to anyway.

But we do have a few places that do it like squashs which we need to
weed out.  And/or finally kill the bounce bufferingreal, which is long
overdue.

> That may be an issue even for non vmalloc bios, unless everything that
> bounces has been converted to bounce to a folio of the same order.

Anything that actually hits the bounce buffering is going to
cause problems because it hasn't kept up with the evolution of
the block layer, and is basically not used for anything relevant.

> > The problem with transparent vmalloc handling is that it's not possible.
> > The magic handling for virtually indexed caches can be hidden on the
> > submission side, but the completion side also needs to call
> > invalidate_kernel_vmap_range for reads.  Requiring the caller to know
> > they deal vmalloc is a way to at least keep that on the radar.
> 
> yeesh, that's a landmine.
> 
> having a separate bio_add_vmalloc as a hint is still a really bad
> "solution", unfortunately. And since this is something we don't have
> sanitizers or debug code for, and it only shows up on some archs -
> that's nasty.

Well, we can't do it in the block stack because that doesn't have the
vmalloc address available.  So the caller has to do it, and having a
very visible sign is the best we can do.  Yes, signs aren't the
best cure for landmines, but they are better than nothing.

> > Not for a purely synchronous helper we could handle both, but so far
> > I've not seen anything but the xfs log recovery code that needs it,
> > and we'd probably get into needing to pass a bio_set to avoid
> > deadlock when used deeper in the stack, etc.  I can look into that
> > if we have more than a single user, but for now it doesn't seem
> > worth it.
> 
> bcache and bcachefs btree buffers can also be vmalloc backed. Possibly
> also the prio_set path in bcache, for reading/writing bucket gens, but
> I'd have to check.

But do you do synchronous I/O, i.e. using sumit_bio_wait on them?

> 
> > Having a common helper for vmalloc and the kernel direct mapping
> > is actually how I started, but then I ran into all the issues with
> > it and with the extremely simple helpers for the direct mapping
> > which are used a lot, and the more complicated version for vmalloc
> > which just has a few users instead.
> 
> *nod*
> 
> What else did you run into? invalidate_kernel_vmap_range() seems like
> the only problematic one, given that is_vmalloc_addr() is cheap.

invalidate_kernel_vmap_range is the major issue that can't be
worked around.  Everything else was mentioned before and can be
summarized as minor inconveniences.

  reply	other threads:[~2025-04-24  8:37 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22 14:26 add more bio helper Christoph Hellwig
2025-04-22 14:26 ` [PATCH 01/17] block: add a bio_add_virt_nofail helper Christoph Hellwig
2025-04-23  6:05   ` Hannes Reinecke
2025-04-24  5:56   ` Damien Le Moal
2025-04-29 11:02   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 02/17] block: add a bdev_rw_virt helper Christoph Hellwig
2025-04-23  6:07   ` Hannes Reinecke
2025-04-23  9:36     ` Christoph Hellwig
2025-04-24  5:59   ` Damien Le Moal
2025-04-24  6:26   ` John Garry
2025-04-29 11:03   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 03/17] block: add a bio_add_vmalloc helper Christoph Hellwig
2025-04-23  6:09   ` Hannes Reinecke
2025-04-24  6:06   ` Damien Le Moal
2025-04-29 11:05   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 04/17] block: remove the q argument from blk_rq_map_kern Christoph Hellwig
2025-04-23  6:10   ` Hannes Reinecke
2025-04-29 11:24     ` Johannes Thumshirn
2025-04-29 12:28       ` hch
2025-04-24  6:09   ` Damien Le Moal
2025-04-22 14:26 ` [PATCH 05/17] block: pass the operation to bio_{map,copy}_kern Christoph Hellwig
2025-04-23  6:11   ` Hannes Reinecke
2025-04-24  6:11   ` Damien Le Moal
2025-04-29 11:29   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 06/17] block: simplify bio_map_kern Christoph Hellwig
2025-04-23  6:14   ` Hannes Reinecke
2025-04-24  6:13   ` Damien Le Moal
2025-04-29 11:31   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 07/17] bcache: use bio_add_virt_nofail Christoph Hellwig
2025-04-24  6:14   ` Damien Le Moal
2025-04-29  2:06     ` Coly Li
2025-04-29 11:32   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 08/17] dm-bufio: " Christoph Hellwig
2025-04-24  6:14   ` Damien Le Moal
2025-04-29 11:33   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 09/17] dm-integrity: " Christoph Hellwig
2025-04-24  6:16   ` Damien Le Moal
2025-04-29 11:34   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 10/17] rnbd-srv: " Christoph Hellwig
2025-04-24  6:16   ` Damien Le Moal
2025-04-24  6:16   ` Damien Le Moal
2025-04-24  7:14   ` Jinpu Wang
2025-04-29 11:34   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 11/17] xfs: simplify xfs_buf_submit_bio Christoph Hellwig
2025-04-24  6:18   ` Damien Le Moal
2025-04-29 14:53   ` Darrick J. Wong
2025-04-22 14:26 ` [PATCH 12/17] xfs: simplify xfs_rw_bdev Christoph Hellwig
2025-04-24  6:20   ` Damien Le Moal
2025-04-29 14:53   ` Darrick J. Wong
2025-04-22 14:26 ` [PATCH 13/17] btrfs: use bdev_rw_virt in scrub_one_super Christoph Hellwig
2025-04-24  6:20   ` Damien Le Moal
2025-04-28  9:18   ` Johannes Thumshirn
2025-04-28  9:22   ` Qu Wenruo
2025-04-22 14:26 ` [PATCH 14/17] hfsplus: use bdev_rw_virt in hfsplus_submit_bio Christoph Hellwig
2025-04-24  6:21   ` Damien Le Moal
2025-04-29 11:39   ` Johannes Thumshirn
2025-04-22 14:26 ` [PATCH 15/17] gfs2: use bdev_rw_virt in gfs2_read_super Christoph Hellwig
2025-04-24  6:23   ` Damien Le Moal
2025-04-24  8:08     ` Andreas Gruenbacher
2025-04-22 14:26 ` [PATCH 16/17] zonefs: use bdev_rw_virt in zonefs_read_super Christoph Hellwig
2025-04-24  6:24   ` Damien Le Moal
2025-04-29 11:44   ` Johannes Thumshirn
2025-04-29 12:31     ` hch
2025-04-22 14:26 ` [PATCH 17/17] PM: hibernate: split and simplify hib_submit_io Christoph Hellwig
2025-04-24  6:26   ` Damien Le Moal
2025-04-29 11:12   ` Rafael J. Wysocki
2025-04-22 14:47 ` add more bio helper Kent Overstreet
2025-04-23  9:36   ` Christoph Hellwig
2025-04-23 10:37     ` Kent Overstreet
2025-04-23 16:07       ` Christoph Hellwig
2025-04-23 18:02         ` Kent Overstreet
2025-04-24  8:37           ` Christoph Hellwig [this message]
2025-04-24 12:01             ` 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=20250424083740.GA24723@lst.de \
    --to=hch@lst.de \
    --cc=agruenba@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=cem@kernel.org \
    --cc=clm@fb.com \
    --cc=colyli@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=dsterba@suse.com \
    --cc=gfs2@lists.linux.dev \
    --cc=haris.iqbal@ionos.com \
    --cc=jinpu.wang@ionos.com \
    --cc=josef@toxicpanda.com \
    --cc=jth@kernel.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=naohiro.aota@wdc.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=snitzer@kernel.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).