From: Christoph Hellwig <hch@lst.de>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>,
John Stultz <john.stultz@linaro.org>,
Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Damien Le Moal <Damien.LeMoal@wdc.com>,
Jens Axboe <axboe@kernel.dk>, David Anderson <dvander@google.com>,
Alistair Delva <adelva@google.com>, Todd Kjos <tkjos@google.com>,
Amit Pundir <amit.pundir@linaro.org>,
YongQin Liu <yongqin.liu@linaro.org>,
lkml <linux-kernel@vger.kernel.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [REGRESSION] "split bio_kmalloc from bio_alloc_bioset" causing crash shortly after bootup
Date: Tue, 23 Feb 2021 08:10:40 +0100 [thread overview]
Message-ID: <20210223071040.GB16980@lst.de> (raw)
In-Reply-To: <BYAPR04MB4965F0B60169371A25CD423E86809@BYAPR04MB4965.namprd04.prod.outlook.com>
On Tue, Feb 23, 2021 at 03:51:23AM +0000, Chaitanya Kulkarni wrote:
> Looking at the other call sites do we need something like following ?
> Since __blk_queue_bounce() passes the NULL for the passthru case as a
> bio_set value ?
Well, that is a somewhat odd calling convention. What about the patch below
instead? That being we really need to kill this bouncing code off..
diff --git a/block/bounce.c b/block/bounce.c
index fc55314aa4269a..789fbcacb1e92a 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -214,9 +214,9 @@ static void bounce_end_io_read_isa(struct bio *bio)
__bounce_end_io_read(bio, &isa_page_pool);
}
-static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask,
- struct bio_set *bs)
+static struct bio *bounce_clone_bio(struct bio *bio_src, bool passthrough)
{
+ unsigned int nr_vecs = bio_segments(bio_src);
struct bvec_iter iter;
struct bio_vec bv;
struct bio *bio;
@@ -242,8 +242,10 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask,
* asking for trouble and would force extra work on
* __bio_clone_fast() anyways.
*/
-
- bio = bio_alloc_bioset(gfp_mask, bio_segments(bio_src), bs);
+ if (passthrough)
+ bio = bio_kmalloc(GFP_NOIO, nr_vecs);
+ else
+ bio = bio_alloc_bioset(GFP_NOIO, nr_vecs, &bounce_bio_set);
if (!bio)
return NULL;
bio->bi_bdev = bio_src->bi_bdev;
@@ -269,11 +271,11 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask,
break;
}
- if (bio_crypt_clone(bio, bio_src, gfp_mask) < 0)
+ if (bio_crypt_clone(bio, bio_src, GFP_NOIO) < 0)
goto err_put;
if (bio_integrity(bio_src) &&
- bio_integrity_clone(bio, bio_src, gfp_mask) < 0)
+ bio_integrity_clone(bio, bio_src, GFP_NOIO) < 0)
goto err_put;
bio_clone_blkg_association(bio, bio_src);
@@ -313,8 +315,7 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
submit_bio_noacct(*bio_orig);
*bio_orig = bio;
}
- bio = bounce_clone_bio(*bio_orig, GFP_NOIO, passthrough ? NULL :
- &bounce_bio_set);
+ bio = bounce_clone_bio(*bio_orig, passthrough);
/*
* Bvec table can't be updated by bio_for_each_segment_all(),
next prev parent reply other threads:[~2021-02-23 7:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 3:06 [REGRESSION] "split bio_kmalloc from bio_alloc_bioset" causing crash shortly after bootup John Stultz
2021-02-23 3:39 ` Chaitanya Kulkarni
2021-02-23 4:22 ` John Stultz
2021-02-23 4:58 ` Chaitanya Kulkarni
2021-02-23 7:11 ` Christoph Hellwig
2021-02-23 3:51 ` Chaitanya Kulkarni
2021-02-23 7:10 ` Christoph Hellwig [this message]
2021-02-23 7:21 ` Chaitanya Kulkarni
2021-02-23 7:37 ` Chaitanya Kulkarni
2021-02-23 15:08 ` Christoph Hellwig
2021-02-23 15:12 ` Christoph Hellwig
2021-02-23 20:53 ` Chaitanya Kulkarni
2021-02-23 7:04 ` Christoph Hellwig
2021-02-23 7:22 ` Christoph Hellwig
2021-02-23 22:46 ` John Stultz
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=20210223071040.GB16980@lst.de \
--to=hch@lst.de \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=adelva@google.com \
--cc=amit.pundir@linaro.org \
--cc=axboe@kernel.dk \
--cc=dvander@google.com \
--cc=john.stultz@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tkjos@google.com \
--cc=yongqin.liu@linaro.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