From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Christoph Hellwig <hch@infradead.org>,
linux-block@vger.kernel.org,
linux-m68k <linux-m68k@lists.linux-m68k.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/5] block: move queue enter logic into blk_mq_submit_bio()
Date: Fri, 12 Nov 2021 08:44:25 +0800 [thread overview]
Message-ID: <YY246bCP+wKw0Z2c@T590> (raw)
In-Reply-To: <17ce59ff-bc8c-e8c8-22e1-96605440629a@kernel.dk>
On Thu, Nov 11, 2021 at 03:17:27PM -0700, Jens Axboe wrote:
> On 11/11/21 8:23 AM, Ming Lei wrote:
> > Hi Geert,
> >
> > On Thu, Nov 11, 2021 at 03:51:28PM +0100, Geert Uytterhoeven wrote:
> >> Hi Ming,
> >>
> >> On Thu, Nov 11, 2021 at 2:45 PM Ming Lei <ming.lei@redhat.com> wrote:
> >>> On Thu, Nov 11, 2021 at 01:58:38PM +0100, Geert Uytterhoeven wrote:
> >>>> On Thu, 4 Nov 2021, Jens Axboe wrote:
> >>>>> On 11/4/21 1:04 PM, Christoph Hellwig wrote:
> >>>>>> On Thu, Nov 04, 2021 at 01:02:54PM -0600, Jens Axboe wrote:
> >>>>>>> On 11/4/21 12:52 PM, Christoph Hellwig wrote:
> >>>>>>>> Looks good:
> >>>>>>>>
> >>>>>>>> Reviewed-by: Christoph Hellwig <hch@lst.de>
> >>>>>>>
> >>>>>>> So these two are now:
> >>>>>>>
> >>>>>>> https://git.kernel.dk/cgit/linux-block/commit/?h=for-5.16/block&id=c98cb5bbdab10d187aff9b4e386210eb2332af96
> >>>>>>>
> >>>>>>> which is the one I sent here, and then the next one gets cleaned up to
> >>>>>>> remove that queue enter helper:
> >>>>>>>
> >>>>>>> https://git.kernel.dk/cgit/linux-block/commit/?h=for-5.16/block&id=7f930eb31eeb07f1b606b3316d8ad3ab6a92905b
> >>>>>>>
> >>>>>>> Can I add your reviewed-by to this last one as well? Only change is the
> >>>>>>> removal of blk_mq_enter_queue() and the weird construct there, it's just
> >>>>>>> bio_queue_enter() now.
> >>>>>>
> >>>>>> Sure.
> >>>>>
> >>>>> Thanks, prematurely already done, as you could tell :-)
> >>>>
> >>>> The updated version is now commit 900e080752025f00 ("block: move queue
> >>>> enter logic into blk_mq_submit_bio()") in Linus' tree.
> >>>>
> >>>> I have bisected failures on m68k/atari (on ARAnyM, using nfhd as the
> >>>> root device) to this commit, e.g.:
> >>>>
> >>>> sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
> >>>> sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current]
> >>>> sd 0:0:0:0: [sda] tag#0 Add. Sense: Invalid field in cdb
> >>>> sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 08 00 00 00 01 00 00 08 00
> >>>> critical target error, dev sda, sector 1 op 0x1:(WRITE) flags 0x20800 phys_seg 1 prio class 0
> >>>> Buffer I/O error on dev sda1, logical block 0, lost sync page write
> >>>>
> >>>> EXT4-fs (sda1): I/O error while writing superblock
> >>>> sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
> >>>> sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current]
> >>>> sd 0:0:0:0: [sda] tag#0 Add. Sense: Invalid field in cdb
> >>>> sd 0:0:0:0: [sda] tag#0 CDB: Write(10) 2a 08 00 00 00 01 00 00 08 00
> >>>> critical target error, dev sda, sector 1 op 0x1:(WRITE) flags 0x20800 phys_seg 1 prio class 0
> >>>> Buffer I/O error on dev sda1, logical block 0, lost sync page write
> >>>> EXT4-fs (sda1): I/O error while writing superblock
> >>>>
> >>>> This may happen either when mounting the root file system (leading to an
> >>>> unable to mount root fs panic), or later (leading to a read-only
> >>>> rootfs).
> >>>
> >>> BTW, today I just found that hang in blk_mq_freeze_queue_wait() is
> >>> caused by commit 900e080752025f00, and the following patch can fix it:
> >>>
> >>> - blk-mq: don't grab ->q_usage_counter in blk_mq_sched_bio_merge
> >>>
> >>> https://lore.kernel.org/linux-block/20211111085650.GA476@lst.de/T/#m759b88fda094a65ebf29bc81b780967cdaf9cf28
> >>>
> >>> Maybe you can try the above patch.
> >>
> >> Thanks! I have applied both patches, but it doesn't make a difference.
> >
> > Thanks for your test!
> >
> > Can you try the following patch?
> >
> >
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index f511db395c7f..a5ab2f2e9f67 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -2517,7 +2517,6 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
> > struct blk_mq_alloc_data data = {
> > .q = q,
> > .nr_tags = 1,
> > - .cmd_flags = bio->bi_opf,
> > };
> > struct request *rq;
> >
> > @@ -2525,6 +2524,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
> > return NULL;
> > if (unlikely(!submit_bio_checks(bio)))
> > goto put_exit;
> > + data.cmd_flags = bio->bi_opf;
> > if (blk_mq_attempt_bio_merge(q, bio, nsegs, same_queue_rq))
> > goto put_exit;
>
> That's definitely a real fix, akin to the other pre-enter variants, this
> one just post checks. Geert, can you give this a whirl?
>
> Ming, would you mind sending this as a real patch?
Hi Jens,
The above patch may not be enough, since submit_bio_checks() is done in
case of using cached request, so how about the following patch(un-tested)?
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f511db395c7f..f84044c8de3f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2517,7 +2517,6 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
struct blk_mq_alloc_data data = {
.q = q,
.nr_tags = 1,
- .cmd_flags = bio->bi_opf,
};
struct request *rq;
@@ -2525,6 +2524,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
return NULL;
if (unlikely(!submit_bio_checks(bio)))
goto put_exit;
+ data.cmd_flags = bio->bi_opf;
if (blk_mq_attempt_bio_merge(q, bio, nsegs, same_queue_rq))
goto put_exit;
@@ -2564,13 +2564,15 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
if (blk_mq_attempt_bio_merge(q, bio, nsegs,
same_queue_rq))
return NULL;
+ if (bio->bi_opf != rq->cmd_flags)
+ goto fallback;
plug->cached_rq = rq_list_next(rq);
INIT_LIST_HEAD(&rq->queuelist);
rq_qos_throttle(q, bio);
return rq;
}
}
-
+fallback:
return blk_mq_get_new_requests(q, plug, bio, nsegs, same_queue_rq);
}
--
Ming
next prev parent reply other threads:[~2021-11-12 0:44 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 18:21 [PATCHSET v3 0/5] Alloc batch fixes Jens Axboe
2021-11-04 18:21 ` [PATCH 1/5] block: have plug stored requests hold references to the queue Jens Axboe
2021-11-04 18:34 ` Christoph Hellwig
2021-11-04 18:35 ` Jens Axboe
2021-11-04 18:21 ` [PATCH 2/5] block: split request allocation components into helpers Jens Axboe
2021-11-04 18:35 ` Christoph Hellwig
2021-11-04 18:21 ` [PATCH 3/5] block: make blk_try_enter_queue() available for blk-mq Jens Axboe
2021-11-04 18:22 ` [PATCH 4/5] block: move queue enter logic into blk_mq_submit_bio() Jens Axboe
2021-11-04 18:36 ` Christoph Hellwig
2021-11-04 18:37 ` Jens Axboe
2021-11-04 18:39 ` Christoph Hellwig
2021-11-04 18:40 ` Jens Axboe
2021-11-04 18:45 ` Jens Axboe
2021-11-04 18:52 ` Christoph Hellwig
2021-11-04 19:02 ` Jens Axboe
2021-11-04 19:04 ` Christoph Hellwig
2021-11-04 19:15 ` Jens Axboe
2021-11-11 12:58 ` Geert Uytterhoeven
2021-11-11 13:19 ` Martin K. Petersen
2021-11-11 14:48 ` Geert Uytterhoeven
2021-11-11 15:36 ` Martin K. Petersen
2021-11-11 21:35 ` Michael Schmitz
2021-11-12 7:37 ` Geert Uytterhoeven
2021-11-12 22:34 ` Michael Schmitz
2021-11-13 7:02 ` Michael Schmitz
2021-11-13 10:06 ` Geert Uytterhoeven
2021-11-13 22:11 ` Michael Schmitz
2021-11-11 13:44 ` Ming Lei
2021-11-11 14:51 ` Geert Uytterhoeven
2021-11-11 15:23 ` Ming Lei
2021-11-11 22:17 ` Jens Axboe
2021-11-12 0:44 ` Ming Lei [this message]
2021-11-12 7:51 ` Geert Uytterhoeven
2021-11-15 19:23 ` Michael Schmitz
2021-11-04 18:22 ` [PATCH 5/5] block: ensure cached plug request matches the current queue Jens Axboe
2021-11-04 18:36 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2021-11-04 15:21 [PATCHSET v2 0/5] Alloc batch fixes Jens Axboe
2021-11-04 15:22 ` [PATCH 4/5] block: move queue enter logic into blk_mq_submit_bio() Jens Axboe
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=YY246bCP+wKw0Z2c@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=geert@linux-m68k.org \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.