From: Sagi Grimberg <sagi@grimberg.me>
To: Ming Lei <ming.lei@redhat.com>
Cc: axboe@kernel.dk, Rachel Sibley <rasibley@redhat.com>,
Yi Zhang <yi.zhang@redhat.com>,
Chaitanya.Kulkarni@wdc.com, linux-nvme@lists.infradead.org,
linux-block <linux-block@vger.kernel.org>,
CKI Project <cki-project@redhat.com>
Subject: Re: kernel null pointer at nvme_tcp_init_iter+0x7d/0xd0 [nvme_tcp]
Date: Tue, 9 Feb 2021 02:36:41 -0800 [thread overview]
Message-ID: <7caeb8fa-94cc-89aa-94ec-da084491cc04@grimberg.me> (raw)
In-Reply-To: <20210209103300.GA101814@T590>
On 2/9/21 2:33 AM, Ming Lei wrote:
> On Tue, Feb 09, 2021 at 02:07:15AM -0800, Sagi Grimberg wrote:
>>
>>>>>
>>>>> One obvious error is that nr_segments is computed wrong.
>>>>>
>>>>> Yi, can you try the following patch?
>>>>>
>>>>> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
>>>>> index 881d28eb15e9..a393d99b74e1 100644
>>>>> --- a/drivers/nvme/host/tcp.c
>>>>> +++ b/drivers/nvme/host/tcp.c
>>>>> @@ -239,9 +239,14 @@ static void nvme_tcp_init_iter(struct nvme_tcp_request *req,
>>>>> offset = 0;
>>>>> } else {
>>>>> struct bio *bio = req->curr_bio;
>>>>> + struct bio_vec bv;
>>>>> + struct bvec_iter iter;
>>>>> +
>>>>> + nsegs = 0;
>>>>> + bio_for_each_bvec(bv, bio, iter)
>>>>> + nsegs++;
>>>>> vec = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter);
>>>>> - nsegs = bio_segments(bio);
>>>>
>>>> This was exactly the patch that caused the issue.
>>>
>>> What was the issue you are talking about? Any link or commit hash?
>>
>> The commit that caused the crash is:
>> 0dc9edaf80ea nvme-tcp: pass multipage bvec to request iov_iter
>
> Not found this commit in linus tree, :-(
The original report is on:
Kernel repo:
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
Commit: 11f8b6fd0db9 - Merge branch 'for-5.12/io_uring' into for-next
>>> nvme-tcp builds iov_iter(BVEC) from __bvec_iter_bvec(), the segment
>>> number has to be the actual bvec number. But bio_segment() just returns
>>> number of the single-page segment, which is wrong for iov_iter.
>>
>> That is what I thought, but its causing a crash, and was fine with
>> bio_segments. So I'm trying to understand why is that.
>
> I tested this patch, and it works just fine.
Me too, but Yi hits this crash, I even recompiled with his
config, but still no luck.
>>> Please see the same usage in lo_rw_aio().
>>
>> nvme-tcp works on the bio basis to avoid bvec allocation
>> in the data path. Hence the iterator is fed directly by
>> the bio bvec and will re-initialize on every bio that
>> is spanned by the request.
>
> Yeah, I know that. What I meant is that rq_for_each_bvec() is used
> to figure out bvec number in loop, which may feed the bio bvec
> directly to fs via iov_iter too, just similar with nvme-tcp.
>
> The difference is that loop will switch to allocate a new bvec
> table and copy bios's bvec to the new table in case of bios merge.
So in nvme-tcp used bio_for_each_bvec which seems appropriate, just
need to understand what is causing this.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-02-09 10:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cki.F3E139361A.EN5MUSJKK9@redhat.com>
[not found] ` <630237787.11660686.1612580898410.JavaMail.zimbra@redhat.com>
2021-02-07 4:50 ` kernel null pointer at nvme_tcp_init_iter[nvme_tcp] with blktests nvme-tcp/012 Yi Zhang
2021-02-07 5:25 ` Chaitanya Kulkarni
2021-02-08 6:48 ` Yi Zhang
2021-02-07 5:48 ` Chaitanya Kulkarni
2021-02-07 5:58 ` Chaitanya Kulkarni
2021-02-07 7:14 ` kernel null pointer at nvme_tcp_init_iter+0x7d/0xd0 [nvme_tcp] Chaitanya Kulkarni
2021-02-08 9:53 ` Sagi Grimberg
2021-02-08 9:46 ` Sagi Grimberg
2021-02-08 13:28 ` Yi Zhang
2021-02-08 17:54 ` Sagi Grimberg
2021-02-08 18:42 ` Sagi Grimberg
2021-02-09 4:21 ` Ming Lei
2021-02-09 7:21 ` Sagi Grimberg
2021-02-09 7:50 ` Ming Lei
2021-02-09 8:34 ` Chaitanya Kulkarni
2021-02-09 10:09 ` Sagi Grimberg
2021-02-09 10:07 ` Sagi Grimberg
2021-02-09 10:33 ` Ming Lei
2021-02-09 10:36 ` Sagi Grimberg [this message]
2021-02-09 10:25 ` Sagi Grimberg
2021-02-09 12:57 ` Yi Zhang
2021-02-09 18:01 ` Sagi Grimberg
2021-02-10 2:51 ` Yi Zhang
2021-02-10 3:38 ` Keith Busch
2021-02-10 5:03 ` Chaitanya Kulkarni
2021-02-10 22:06 ` Sagi Grimberg
2021-02-10 22:15 ` Chaitanya Kulkarni
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=7caeb8fa-94cc-89aa-94ec-da084491cc04@grimberg.me \
--to=sagi@grimberg.me \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=axboe@kernel.dk \
--cc=cki-project@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
--cc=rasibley@redhat.com \
--cc=yi.zhang@redhat.com \
/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