Hi folks,
I'm intermittently seeing the following oops on at least one powerpc box.
The BUG_ON() is from:
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
{
...
count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
BUG_ON(count > sdb->table.nents);
Looking at the dump it looks like count was 2, I can't work out what nents was.
The machine's just a fairly boring bare metal setup, with a single IPR adapter:
0001:08:00.0 RAID bus controller: IBM PCI-E IPR SAS Adapter (ASIC) (rev 02)
Subsystem: IBM PCIe3 x8 SAS RAID Internal Adapter 6Gb (57D7)
Flags: bus master, fast devsel, latency 0
Kernel driver in use: ipr
Anyone seen it before or have any ideas?
Hi Michael,
I'm facing the same panic on my bare metal system.
Sounds to be raised by the latest update to 4.4-rc1
Laurent.
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-11-18 11:10:50
On Wed, 2015-11-18 at 12:06 +0100, Laurent Dufour wrote:
On 18/11/2015 10:18, Michael Ellerman wrote:
quoted
Hi folks,
I'm intermittently seeing the following oops on at least one powerpc box.
The BUG_ON() is from:
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
{
...
count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
BUG_ON(count > sdb->table.nents);
Looking at the dump it looks like count was 2, I can't work out what nents was.
The machine's just a fairly boring bare metal setup, with a single IPR adapter:
0001:08:00.0 RAID bus controller: IBM PCI-E IPR SAS Adapter (ASIC) (rev 02)
Subsystem: IBM PCIe3 x8 SAS RAID Internal Adapter 6Gb (57D7)
Flags: bus master, fast devsel, latency 0
Kernel driver in use: ipr
Anyone seen it before or have any ideas?
Hi Michael,
I'm facing the same panic on my bare metal system.
Sounds to be raised by the latest update to 4.4-rc1
Yeah I think it's new since 4.3.
Do you see it regularly, or just every now and then?
cheers
On Wed, 2015-11-18 at 12:06 +0100, Laurent Dufour wrote:
quoted
On 18/11/2015 10:18, Michael Ellerman wrote:
quoted
Hi folks,
I'm intermittently seeing the following oops on at least one powerpc box.
The BUG_ON() is from:
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
{
...
count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
BUG_ON(count > sdb->table.nents);
Looking at the dump it looks like count was 2, I can't work out what nents was.
The machine's just a fairly boring bare metal setup, with a single IPR adapter:
0001:08:00.0 RAID bus controller: IBM PCI-E IPR SAS Adapter (ASIC) (rev 02)
Subsystem: IBM PCIe3 x8 SAS RAID Internal Adapter 6Gb (57D7)
Flags: bus master, fast devsel, latency 0
Kernel driver in use: ipr
Anyone seen it before or have any ideas?
Hi Michael,
I'm facing the same panic on my bare metal system.
Sounds to be raised by the latest update to 4.4-rc1
Yeah I think it's new since 4.3.
Do you see it regularly, or just every now and then?
I got it almost every time I'm stressing the system's memory, but I
can't state if it's tied or not.
I can't remember having seeing it with 4.3, I'll double check that and
getting back to you.
Laurent.
From: Mark Salter <hidden> Date: 2015-11-18 14:03:25
On Wed, 2015-11-18 at 20:18 +1100, Michael Ellerman wrote:
Hi folks,
I'm intermittently seeing the following oops on at least one powerpc box.
The BUG_ON() is from:
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
{
...
count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
BUG_ON(count > sdb->table.nents);
Looking at the dump it looks like count was 2, I can't work out what nents was.
The machine's just a fairly boring bare metal setup, with a single IPR adapter:
0001:08:00.0 RAID bus controller: IBM PCI-E IPR SAS Adapter (ASIC) (rev 02)
Subsystem: IBM PCIe3 x8 SAS RAID Internal Adapter 6Gb (57D7)
Flags: bus master, fast devsel, latency 0
Kernel driver in use: ipr
Anyone seen it before or have any ideas?
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-11-19 01:02:48
On Wed, 2015-11-18 at 09:03 -0500, Mark Salter wrote:
On Wed, 2015-11-18 at 20:18 +1100, Michael Ellerman wrote:
quoted
Hi folks,
I'm intermittently seeing the following oops on at least one powerpc box.
The BUG_ON() is from:
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
{
...
count = blk_rq_map_sg(req->q, req, sdb->table.sgl);
BUG_ON(count > sdb->table.nents);
Looking at the dump it looks like count was 2, I can't work out what nents was.
The machine's just a fairly boring bare metal setup, with a single IPR adapter:
0001:08:00.0 RAID bus controller: IBM PCI-E IPR SAS Adapter (ASIC) (rev 02)
Subsystem: IBM PCIe3 x8 SAS RAID Internal Adapter 6Gb (57D7)
Flags: bus master, fast devsel, latency 0
Kernel driver in use: ipr
Anyone seen it before or have any ideas?
I'm also seeing it on arm64 in 4.4-rc1
Ah thanks, that's a good data point. I was assuming it was a driver bug, but I
assume you're not using IPR :)
From: Christoph Hellwig <hch@infradead.org> Date: 2015-11-19 08:23:30
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
From: Hannes Reinecke <hare@suse.de> Date: 2015-11-19 15:35:36
On 11/19/2015 09:23 AM, Christoph Hellwig wrote:
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Well, I have been fighting a similar issue for several months now,
albeit with multipath enabled. Haven't had much progress with this,
sadly.
Seeing that this is our distro kernel it might or might not be
related; however, as the symptoms are identical there still is a
chance that this is actually a generic block-layer problem.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-11-20 12:10:52
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
cheers
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
I'm trying bisect it but it's very time consuming, and I think I missed
some bad kernel because I didn't let enough time to the system to panic.
But I'm still on...
Cheers
From: Mark Salter <hidden> Date: 2015-11-20 13:37:06
On Fri, 2015-11-20 at 13:56 +0100, Laurent Dufour wrote:
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
I'm trying bisect it but it's very time consuming, and I think I missed
some bad kernel because I didn't let enough time to the system to panic.
But I'm still on...
I usually hit it at boot time. Maybe one out of five times. I'll take a stab
at bisecting today...
On Thu, 2015-11-19 at 16:35 +0100, Hannes Reinecke wrote:
On 11/19/2015 09:23 AM, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Well, I have been fighting a similar issue for several months now,
albeit with multipath enabled. Haven't had much progress with this,
sadly.
Seeing that this is our distro kernel it might or might not be
related; however, as the symptoms are identical there still is a
chance that this is actually a generic block-layer problem.
Cheers,
Hannes
We have seen this also. (e.g. req->nr_phys_segments was 3, but
blk_rq_map_sg() returned 4.) I was suspicious of the patch:
bio: modify __bio_add_page() to accept pages that don't start a new segment
But we put some debugging code in and didn't hit it. We haven't
found the problem yet, either, though. We're still looking.
As Christoph said, it would seem to be a problem with the block layer
merging.
The API for this seems defective, in that blk_rq_map_sg() should
never be returning a value indicating that it overwrote past the
end of the supplied SG array and depend on the caller to check it.
(We could get data corruption on another I/O if it used adjacent
memory for a different SG list, for example.)
-Ewan
From: Hannes Reinecke <hare@suse.de> Date: 2015-11-20 14:55:25
On 11/20/2015 03:38 PM, Ewan Milne wrote:
On Thu, 2015-11-19 at 16:35 +0100, Hannes Reinecke wrote:
quoted
On 11/19/2015 09:23 AM, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Well, I have been fighting a similar issue for several months now,
albeit with multipath enabled. Haven't had much progress with this,
sadly.
Seeing that this is our distro kernel it might or might not be
related; however, as the symptoms are identical there still is a
chance that this is actually a generic block-layer problem.
Cheers,
Hannes
We have seen this also. (e.g. req->nr_phys_segments was 3, but
blk_rq_map_sg() returned 4.) I was suspicious of the patch:
bio: modify __bio_add_page() to accept pages that don't start a new segment
But we put some debugging code in and didn't hit it. We haven't
found the problem yet, either, though. We're still looking.
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
As Christoph said, it would seem to be a problem with the block layer
merging.
The API for this seems defective, in that blk_rq_map_sg() should
never be returning a value indicating that it overwrote past the
end of the supplied SG array and depend on the caller to check it.
(We could get data corruption on another I/O if it used adjacent
memory for a different SG list, for example.)
Yeah, the API is bloody useless.
By the time you hit the BUG_ON you've already caused a memory
corruption, so no way you can recover there.
At the very least we should be passing in the sg list count into
blk_map_rq_sg(), but that's a core blocklayer API and changes here
would require changes by quite a set of drivers. Plus it wouldn't
help me for a distribution kernel ...
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Cheers
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
=20
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
=20
Not me, I've only hit it one or two times. All I can say is I have hit =
it in
quoted
4.4-rc1.
=20
Laurent, can you narrow it down at all?
=20
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
=20
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
=20
This being said, I can't explain what's going wrong.
=20
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
=46rom 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Mark Salter <hidden> Date: 2015-11-22 23:20:15
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted hunk
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
On Mon, Nov 23, 2015 at 7:20 AM, Mark Salter [off-list ref] wrote:
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Mark Salter <hidden> Date: 2015-11-23 01:50:15
On Mon, 2015-11-23 at 08:36 +0800, Ming Lei wrote:
On Mon, Nov 23, 2015 at 7:20 AM, Mark Salter [off-list ref] wrote:
quoted
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I'm still hitting the BUG even with this patch applied on top of 4.4-rc1.
OK, looks there are still other bugs, care to share us how to reproduce
it on arm64?
thanks,
Ming
Unfortunately, the best reproducer I have is to boot the platform. I have seen the
BUG a few times post-boot, but I don't have a consistant reproducer. I am using
upstream 4.4-rc1 with this config:
http://people.redhat.com/msalter/fh_defconfig
With 4.4-rc1 on an APM Mustang platform, I see the BUG about once every 6-7 boots.
On an AMD Seattle platform, about every 9 boots.
I have a script that loops through an ssh command to reboot the platform under test.
I manually install test kernels and then run the script and wait for failure. While
debugging, I have tried more minimal configs with which I have been unable to
reproduce the problem even after several hours of reboots. With the above mentioned
fh_defconfig, I have been able to get a failure within 20 or so boots with most
kernel builds but at certain kernel commits, the failure has taken a longer time to
reproduce.
From my POV, I can't say which commit causes the problem. So far, I have not been
able to reproduce at all before commit d9734e0d1ccf but I am currently trying to
reproduce with commit 0d51ce9ca1116 (one merge earlier than d9734e0d1ccf).
Hi Mark,
On Mon, Nov 23, 2015 at 9:50 AM, Mark Salter [off-list ref] wrote:
On Mon, 2015-11-23 at 08:36 +0800, Ming Lei wrote:
quoted
On Mon, Nov 23, 2015 at 7:20 AM, Mark Salter [off-list ref] wrote:
quoted
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I'm still hitting the BUG even with this patch applied on top of 4.4-rc1.
OK, looks there are still other bugs, care to share us how to reproduce
it on arm64?
thanks,
Ming
Unfortunately, the best reproducer I have is to boot the platform. I have seen the
BUG a few times post-boot, but I don't have a consistant reproducer. I am using
upstream 4.4-rc1 with this config:
http://people.redhat.com/msalter/fh_defconfig
With 4.4-rc1 on an APM Mustang platform, I see the BUG about once every 6-7 boots.
On an AMD Seattle platform, about every 9 boots.
Thanks for the input, and I will try to reproduce the issue on mustang with
your kernel config.
I have a script that loops through an ssh command to reboot the platform under test.
I manually install test kernels and then run the script and wait for failure. While
debugging, I have tried more minimal configs with which I have been unable to
reproduce the problem even after several hours of reboots. With the above mentioned
fh_defconfig, I have been able to get a failure within 20 or so boots with most
kernel builds but at certain kernel commits, the failure has taken a longer time to
reproduce.
From my POV, I can't say which commit causes the problem. So far, I have not been
able to reproduce at all before commit d9734e0d1ccf but I am currently trying to
reproduce with commit 0d51ce9ca1116 (one merge earlier than d9734e0d1ccf).
The patch for fixing 'bvprvp' is better to be included for test,
because that issue
may have a big effect on computing physical seg count.
Also I appreciate if you, Laurent or anyone may provide debug log which
can be captured with the attached debug patch when this issue is trigered .
Thanks,
From: Hannes Reinecke <hare@suse.de> Date: 2015-11-23 06:55:52
On 11/20/2015 04:28 PM, Ewan Milne wrote:
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
Oh, I got plenty of them :-(
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
Of course not. But it'll be a band-aid to keep the customer happy.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I'm still hitting the BUG even with this patch applied on top of 4.4-rc1.
On my side, with the patch applied on top of 4.4-rc1, I can't get the
panic anymore.
git bisect shows:
bdced438acd83ad83a6c6fc7f50099b820245ddb is the first bad commit
commit bdced438acd83ad83a6c6fc7f50099b820245ddb
Author: Ming Lei [off-list ref]
Date: Tue Oct 20 23:13:52 2015 +0800
block: setup bi_phys_segments after splitting
Reverting above commit on top if 4.4-rc1 seems to fix the problem for me.
~Pratyush
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'b
~Pratyush
vprv'.
quoted
quoted
quoted
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I'm still hitting the BUG even with this patch applied on top of 4.4-rc1.
On my side, with the patch applied on top of 4.4-rc1, I can't get the
panic anymore.
git bisect shows:
bdced438acd83ad83a6c6fc7f50099b820245ddb is the first bad commit
commit bdced438acd83ad83a6c6fc7f50099b820245ddb
Author: Ming Lei [off-list ref]
Date: Tue Oct 20 23:13:52 2015 +0800
block: setup bi_phys_segments after splitting
Reverting above commit on top if 4.4-rc1 seems to fix the problem for me.
That's what I mentioned earlier ;)
Now Ming send an additional patch with seems to fix the bug introduced
through the commit bdced438acd8. When testing with this new patch I
can't get the panic anymore, but Mark reported he is still hitting it.
From: Ming Lei <tom.leiming@gmail.com> Date: 2015-11-23 15:21:53
On Mon, 23 Nov 2015 10:46:20 +0800
Ming Lei [off-list ref] wrote:
Hi Mark,
=20
On Mon, Nov 23, 2015 at 9:50 AM, Mark Salter [off-list ref] wrote:
quoted
On Mon, 2015-11-23 at 08:36 +0800, Ming Lei wrote:
quoted
On Mon, Nov 23, 2015 at 7:20 AM, Mark Salter [off-list ref] wrot=
e:
quoted
quoted
quoted
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely i=
n the
quoted
quoted
quoted
quoted
quoted
quoted
quoted
merge bios to request infrastucture where we don't obey the =
merging
quoted
quoted
quoted
quoted
quoted
quoted
quoted
limits properly.
Does either of you have a known good and first known bad ker=
nel?
quoted
quoted
quoted
quoted
quoted
quoted
Not me, I've only hit it one or two times. All I can say is I =
have hit it in
quoted
quoted
quoted
quoted
quoted
quoted
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 =
("block:
quoted
quoted
quoted
quoted
quoted
setup bi_phys_segments after splitting") which has been pulled b=
y the
quoted
quoted
quoted
quoted
quoted
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can ru=
n hours
quoted
quoted
quoted
quoted
quoted
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would =
you
quoted
quoted
quoted
quoted
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 =
2001
quoted
quoted
quoted
quoted
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
=20
Thanks for the input, and I will try to reproduce the issue on mustang wi=
th
your kernel config.
I can reproduce the issue on mustang, and looks I may understand the story =
now.
When 64K page size is used on arm64, and the default segment size of block
is 65536, then one segment should only include one page at most.
Commit bdced438acd83a(block: setup bi_phys_segments after splitting) does n=
ot
compute bio->bi_seg_front_size and bio->bi_seg_back_size, then one less seg=
ment
may be obtained because blk_phys_contig_segment() thought the last bvec in =
1st
bio and the 1st bvec in the 2nd bio is in one physical segment, so cause the
regression.
Looks the following patch can fix the issue by figuring bio->bi_seg_front_s=
ize
and bio->bi_seg_back_size in blk_bio_segment_split().
Mark, thanks again for providing the reproduction steps, and could you run =
your
test to see if it can fix your issue?
---
=46rom 86b5f33d48715c1150fdcfd9a76e495e7aa913aa Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Mon, 23 Nov 2015 20:27:23 +0800
Subject: [PATCH 2/2] blk-merge: fix blk_bio_segment_split
Commit bdced438acd83a(block: setup bi_phys_segments after
splitting) introduces function of computing bio->bi_phys_segments
during bio splitting.
Unfortunately both bio->bi_seg_front_size and bio->bi_seg_back_size
arn't computed, so too many physical segments may be obtained
for one request since both the two are used to check if one segment
across two bios can be possible.
This patch fixes the issue by computing the two variables in
blk_bio_segment_split().
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Reported-by: Mark Salter <redacted>
Fixes: bdced438acd83a(block: setup bi_phys_segments after splitting)
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
On Mon, Nov 23, 2015 at 11:20 PM, Laurent Dufour
[off-list ref] wrote:
quoted
Reverting above commit on top if 4.4-rc1 seems to fix the problem for me.
That's what I mentioned earlier ;)
Now Ming send an additional patch with seems to fix the bug introduced
through the commit bdced438acd8. When testing with this new patch I
can't get the panic anymore, but Mark reported he is still hitting it.
Laurent, thanks for your test on the 1st patch, and looks there are at
least two problems, and my 2nd patch sent just now should address
Mark's issue which is caused by bdced438acd83a.
Once the 2nd one is tested OK, I will send out the two together.
Thanks,
Ming
On Mon, Nov 23, 2015 at 11:20 PM, Laurent Dufour
[off-list ref] wrote:
quoted
quoted
Reverting above commit on top if 4.4-rc1 seems to fix the problem for me.
That's what I mentioned earlier ;)
Now Ming send an additional patch with seems to fix the bug introduced
through the commit bdced438acd8. When testing with this new patch I
can't get the panic anymore, but Mark reported he is still hitting it.
Laurent, thanks for your test on the 1st patch, and looks there are at
least two problems, and my 2nd patch sent just now should address
Mark's issue which is caused by bdced438acd83a.
Once the 2nd one is tested OK, I will send out the two together.
FWIW, I applied the 2nd patch, and my system is still running like a charm.
Cheers,
Laurent.
From: Mark Salter <hidden> Date: 2015-11-24 01:30:18
On Mon, 2015-11-23 at 23:27 +0800, Ming Lei wrote:
On Mon, Nov 23, 2015 at 11:20 PM, Laurent Dufour
[off-list ref] wrote:
quoted
quoted
Reverting above commit on top if 4.4-rc1 seems to fix the problem for me.
That's what I mentioned earlier ;)
Now Ming send an additional patch with seems to fix the bug introduced
through the commit bdced438acd8. When testing with this new patch I
can't get the panic anymore, but Mark reported he is still hitting it.
Laurent, thanks for your test on the 1st patch, and looks there are at
least two problems, and my 2nd patch sent just now should address
Mark's issue which is caused by bdced438acd83a.
Once the 2nd one is tested OK, I will send out the two together.
Thanks,
Ming
Thanks Ming.
With both patches applied, I have been unable to reproduce the problem.
On Mon, 23 Nov 2015 10:46:20 +0800
Ming Lei [off-list ref] wrote:
quoted
Hi Mark,
On Mon, Nov 23, 2015 at 9:50 AM, Mark Salter [off-list ref] wrote:
quoted
On Mon, 2015-11-23 at 08:36 +0800, Ming Lei wrote:
quoted
On Mon, Nov 23, 2015 at 7:20 AM, Mark Salter [off-list ref] wrote:
quoted
On Sun, 2015-11-22 at 00:56 +0800, Ming Lei wrote:
quoted
On Sat, 21 Nov 2015 12:30:14 +0100
Laurent Dufour [off-list ref] wrote:
quoted
On 20/11/2015 13:10, Michael Ellerman wrote:
quoted
On Thu, 2015-11-19 at 00:23 -0800, Christoph Hellwig wrote:
quoted
It's pretty much guaranteed a block layer bug, most likely in the
merge bios to request infrastucture where we don't obey the merging
limits properly.
Does either of you have a known good and first known bad kernel?
Not me, I've only hit it one or two times. All I can say is I have hit it in
4.4-rc1.
Laurent, can you narrow it down at all?
It seems that the panic is triggered by the commit bdced438acd8 ("block:
setup bi_phys_segments after splitting") which has been pulled by the
merge d9734e0d1ccf ("Merge branch 'for-4.4/core' of
git://git.kernel.dk/linux-block").
My system is panicing promptly when running a kernel built at
d9734e0d1ccf, while reverting the commit bdced438acd8, it can run hours
without panicing.
This being said, I can't explain what's going wrong.
May Ming shed some light here ?
Laurent, looks there is one bug in blk_bio_segment_split(), would you
mind testing the following patch to see if it fixes your issue?
---
From 6fc701231dcc000bc8bc4b9105583380d9aa31f4 Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Sun, 22 Nov 2015 00:47:13 +0800
Subject: [PATCH] block: fix segment split
Inside blk_bio_segment_split(), previous bvec pointer('bvprvp')
always points to the iterator local variable, which is obviously
wrong, so fix it by pointing to the local variable of 'bvprv'.
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
I'm still hitting the BUG even with this patch applied on top of 4.4-rc1.
OK, looks there are still other bugs, care to share us how to reproduce
it on arm64?
thanks,
Ming
Unfortunately, the best reproducer I have is to boot the platform. I have seen the
BUG a few times post-boot, but I don't have a consistant reproducer. I am using
upstream 4.4-rc1 with this config:
http://people.redhat.com/msalter/fh_defconfig
With 4.4-rc1 on an APM Mustang platform, I see the BUG about once every 6-7 boots.
On an AMD Seattle platform, about every 9 boots.
Thanks for the input, and I will try to reproduce the issue on mustang with
your kernel config.
I can reproduce the issue on mustang, and looks I may understand the story now.
When 64K page size is used on arm64, and the default segment size of block
is 65536, then one segment should only include one page at most.
Commit bdced438acd83a(block: setup bi_phys_segments after splitting) does not
compute bio->bi_seg_front_size and bio->bi_seg_back_size, then one less segment
may be obtained because blk_phys_contig_segment() thought the last bvec in 1st
bio and the 1st bvec in the 2nd bio is in one physical segment, so cause the
regression.
Looks the following patch can fix the issue by figuring bio->bi_seg_front_size
and bio->bi_seg_back_size in blk_bio_segment_split().
Mark, thanks again for providing the reproduction steps, and could you run your
test to see if it can fix your issue?
---
From 86b5f33d48715c1150fdcfd9a76e495e7aa913aa Mon Sep 17 00:00:00 2001
From: Ming Lei <redacted>
Date: Mon, 23 Nov 2015 20:27:23 +0800
Subject: [PATCH 2/2] blk-merge: fix blk_bio_segment_split
Commit bdced438acd83a(block: setup bi_phys_segments after
splitting) introduces function of computing bio->bi_phys_segments
during bio splitting.
Unfortunately both bio->bi_seg_front_size and bio->bi_seg_back_size
arn't computed, so too many physical segments may be obtained
for one request since both the two are used to check if one segment
across two bios can be possible.
This patch fixes the issue by computing the two variables in
blk_bio_segment_split().
Reported-by: Michael Ellerman <mpe@ellerman.id.au>
Reported-by: Mark Salter <redacted>
Fixes: bdced438acd83a(block: setup bi_phys_segments after splitting)
Signed-off-by: Ming Lei <redacted>
---
block/blk-merge.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
I applied both your patches and tested on Overdrive 3000. This fixes the
issue for me.
Added linux-arm-kernel, since arm64 triggers this issue.
Thanks Ming and testers for your hard work on this.
Tested-by: Alan Ott <redacted>
From: Hannes Reinecke <hare@suse.de> Date: 2015-11-25 09:04:48
On 11/20/2015 04:28 PM, Ewan Milne wrote:
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag, which is evaluated
via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag, which is evaluated
via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
We only support merging on REQ_TYPE_FS already, so how is the above
making it any different? In general, NOMERGE being set or not should not
make a difference. It's only a hint that we need not check further if we
should be merging on this request, since we already tried it once, found
we'd exceed various limits, then set NOMERGE to reflect that.
--
Jens Axboe
From: Mike Snitzer <hidden> Date: 2015-11-25 18:01:50
On Wed, Nov 25 2015 at 4:04am -0500,
Hannes Reinecke [off-list ref] wrote:
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
How did you arrive at that? Do you have a reproducer now?
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag,
NOMERGE is always set in __blk_rq_prep_clone() for cloned requests.
which is evaluated via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
blk_insert_cloned_request() is the only caller of blk_rq_check_limits();
anyway after reading your mail I'm still left wondering if your proposed
patch is correct.
quoted hunk
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
You're not explaining the actual change in the patch very well; I think
you're correct but you're leaving the justification as an exercise to
the reviewer:
blk_rq_check_limits() will call blk_recalc_rq_segments() after the
!rq_mergeable() check but you're saying for this case in question we
never get there -- due to the cloned request having NOMERGE set.
So in blk_rq_check_limits() you've unrolled rq_mergeable() and
open-coded the lone remaining check (rq->cmd_type != REQ_TYPE_FS)
I agree that the (rq->cmd_flags & REQ_NOMERGE_FLAGS) check in
the blk_insert_cloned_request() call-chain (via rq_mergeable()) makes no
sense for cloned requests that always have NOMERGE set.
So you're saying that by having blk_rq_check_limits() go on to call
blk_recalc_rq_segments() this bug will be fixed?
BTW, I think blk_rq_check_limits()'s export should be removed and the
function made static and renamed to blk_clone_rq_check_limits(), again:
blk_insert_cloned_request() is the only caller of blk_rq_check_limits()
Seems prudent to make that change now to be clear that this code is only
used by cloned requests.
Thanks,
Mike
From: Hannes Reinecke <hare@suse.de> Date: 2015-11-25 19:02:04
On 11/25/2015 07:01 PM, Mike Snitzer wrote:
On Wed, Nov 25 2015 at 4:04am -0500,
Hannes Reinecke [off-list ref] wrote:
quoted
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
How did you arrive at that? Do you have a reproducer now?
Not a reproducer, but several dumps for analysis.
quoted
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag,
NOMERGE is always set in __blk_rq_prep_clone() for cloned requests.
Yes.
quoted
which is evaluated via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
blk_insert_cloned_request() is the only caller of blk_rq_check_limits();
anyway after reading your mail I'm still left wondering if your proposed
patch is correct.
quoted
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
You're not explaining the actual change in the patch very well; I think
you're correct but you're leaving the justification as an exercise to
the reviewer:
blk_rq_check_limits() will call blk_recalc_rq_segments() after the
!rq_mergeable() check but you're saying for this case in question we
never get there -- due to the cloned request having NOMERGE set.
So in blk_rq_check_limits() you've unrolled rq_mergeable() and
open-coded the lone remaining check (rq->cmd_type != REQ_TYPE_FS)
I agree that the (rq->cmd_flags & REQ_NOMERGE_FLAGS) check in
the blk_insert_cloned_request() call-chain (via rq_mergeable()) makes no
sense for cloned requests that always have NOMERGE set.
So you're saying that by having blk_rq_check_limits() go on to call
blk_recalc_rq_segments() this bug will be fixed?
That is the idea.
I've already established that in all instances I have seen so far
req->nr_phys_segments is _less_ than req->bio->bi_phys_segments.
As it turns out, req->nr_phys_segemnts _would_ have been updated in
blk_rq_check_limits(), but isn't due to the NOMERGE flag being set
for the cloned request.
So each cloned request inherits the values from the original request,
despite the fact that req->nr_phys_segments _has_ to be evaluated in
the final request_queue context, as the queue limits _might_ be
different from the original (merged) queue limits of the multipath
request queue.
BTW, I think blk_rq_check_limits()'s export should be removed and the
function made static and renamed to blk_clone_rq_check_limits(), again:
blk_insert_cloned_request() is the only caller of blk_rq_check_limits()
Actually, seeing Jens' last comment the check for REQ_TYPE_FS is
pointless, too, so we might as well remove the entire if-clause.
Seems prudent to make that change now to be clear that this code is only
used by cloned requests.
Yeah, that would make sense. I'll be preparing a patch.
With a more detailed description :-)
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
From: Hannes Reinecke <hare@suse.de> Date: 2015-11-25 19:10:31
On 11/25/2015 06:56 PM, Jens Axboe wrote:
On 11/25/2015 02:04 AM, Hannes Reinecke wrote:
quoted
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag, which is evaluated
via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
We only support merging on REQ_TYPE_FS already, so how is the above
making it any different? In general, NOMERGE being set or not should not
make a difference. It's only a hint that we need not check further if we
should be merging on this request, since we already tried it once, found
we'd exceed various limits, then set NOMERGE to reflect that.
The problem is that NOMERGE does too much, as it inhibits _any_ merging.
Unfortunately, the req->nr_phys_segments value is evaluated in the final
_driver_ context _after_ the merging happend; cf
scsi_lib.c:scsi_init_sgtable().
As nr_phys_segments is inherited from the original request (and never
recalculated with the new request queue limits) the following
blk_rq_map_sg() call might end up at a different calculation, especially
after retrying a request on another path.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag, which is evaluated
via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
We only support merging on REQ_TYPE_FS already, so how is the above
making it any different? In general, NOMERGE being set or not should not
make a difference. It's only a hint that we need not check further if we
should be merging on this request, since we already tried it once, found
we'd exceed various limits, then set NOMERGE to reflect that.
The problem is that NOMERGE does too much, as it inhibits _any_ merging.
Right, that is the point of the flag from the block layer view, where it
was originally added for the case mentioned.
Unfortunately, the req->nr_phys_segments value is evaluated in the final
_driver_ context _after_ the merging happend; cf
scsi_lib.c:scsi_init_sgtable().
As nr_phys_segments is inherited from the original request (and never
recalculated with the new request queue limits) the following
blk_rq_map_sg() call might end up at a different calculation, especially
after retrying a request on another path.
That all sounds pretty horrible. Why is blk_rq_check_limits() checking
for mergeable at all? If merging is disabled on the request, I'm
assuming that's an attempt at an optimization since we know it won't
change. But that should be tracked separately, like how it's done on the
bio.
--
Jens Axboe
From: Mike Snitzer <hidden> Date: 2015-11-25 20:23:21
On Wed, Nov 25 2015 at 2:24pm -0500,
Jens Axboe [off-list ref] wrote:
On 11/25/2015 12:10 PM, Hannes Reinecke wrote:
quoted
On 11/25/2015 06:56 PM, Jens Axboe wrote:
quoted
On 11/25/2015 02:04 AM, Hannes Reinecke wrote:
quoted
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag, which is evaluated
via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
We only support merging on REQ_TYPE_FS already, so how is the above
making it any different? In general, NOMERGE being set or not should not
make a difference. It's only a hint that we need not check further if we
should be merging on this request, since we already tried it once, found
we'd exceed various limits, then set NOMERGE to reflect that.
The problem is that NOMERGE does too much, as it inhibits _any_ merging.
Right, that is the point of the flag from the block layer view,
where it was originally added for the case mentioned.
And we really don't want _any_ merging. The merging, if any, will have
already happened in upper DM-multipath's elevator. So there should be
no need to have the underlying SCSI paths do any merging.
quoted
Unfortunately, the req->nr_phys_segments value is evaluated in the final
_driver_ context _after_ the merging happend; cf
scsi_lib.c:scsi_init_sgtable().
As nr_phys_segments is inherited from the original request (and never
recalculated with the new request queue limits) the following
blk_rq_map_sg() call might end up at a different calculation, especially
after retrying a request on another path.
That all sounds pretty horrible. Why is blk_rq_check_limits()
checking for mergeable at all? If merging is disabled on the
request, I'm assuming that's an attempt at an optimization since we
know it won't change. But that should be tracked separately, like
how it's done on the bio.
Not clear to me why it was checking for merging...
From: Mike Snitzer <hidden> Date: 2015-11-25 21:20:32
On Wed, Nov 25 2015 at 3:23pm -0500,
Mike Snitzer [off-list ref] wrote:
On Wed, Nov 25 2015 at 2:24pm -0500,
Jens Axboe [off-list ref] wrote:
quoted
On 11/25/2015 12:10 PM, Hannes Reinecke wrote:
quoted
The problem is that NOMERGE does too much, as it inhibits _any_ merging.
Right, that is the point of the flag from the block layer view,
where it was originally added for the case mentioned.
And we really don't want _any_ merging. The merging, if any, will have
already happened in upper DM-multipath's elevator. So there should be
no need to have the underlying SCSI paths do any merging.
quoted
quoted
Unfortunately, the req->nr_phys_segments value is evaluated in the final
_driver_ context _after_ the merging happend; cf
scsi_lib.c:scsi_init_sgtable().
As nr_phys_segments is inherited from the original request (and never
recalculated with the new request queue limits) the following
blk_rq_map_sg() call might end up at a different calculation, especially
after retrying a request on another path.
That all sounds pretty horrible. Why is blk_rq_check_limits()
checking for mergeable at all? If merging is disabled on the
request, I'm assuming that's an attempt at an optimization since we
know it won't change. But that should be tracked separately, like
how it's done on the bio.
Not clear to me why it was checking for merging...
Ewan pointed out that blk_rq_check_limits()'s call to rq_mergable() was
introduced as part of Martin's DISCARD cleanup that prepared for
WRITE_SAME, see: commit e2a60da74 ("block: Clean up special command handling logic")
And prior to that, blk_rq_check_limits()'s (rq->cmd_flags & REQ_DISCARD)
check was introduced by some guy crazy doppelganger name "Ike Snitzer",
see commit: 3383977f ("block: update request stacking methods to support discards")
So basically we probably never needed the extra check in
blk_rq_check_limits() to begin with.. Ike was probably paranoid. ;)
On Wed, 25 Nov 2015 20:01:47 +0100,
Hannes Reinecke wrote:
On 11/25/2015 07:01 PM, Mike Snitzer wrote:
quoted
On Wed, Nov 25 2015 at 4:04am -0500,
Hannes Reinecke [off-list ref] wrote:
quoted
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
How did you arrive at that? Do you have a reproducer now?
Not a reproducer, but several dumps for analysis.
quoted
quoted
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag,
NOMERGE is always set in __blk_rq_prep_clone() for cloned requests.
Yes.
quoted
quoted
which is evaluated via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
blk_insert_cloned_request() is the only caller of blk_rq_check_limits();
anyway after reading your mail I'm still left wondering if your proposed
patch is correct.
quoted
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
You're not explaining the actual change in the patch very well; I think
you're correct but you're leaving the justification as an exercise to
the reviewer:
blk_rq_check_limits() will call blk_recalc_rq_segments() after the
!rq_mergeable() check but you're saying for this case in question we
never get there -- due to the cloned request having NOMERGE set.
So in blk_rq_check_limits() you've unrolled rq_mergeable() and
open-coded the lone remaining check (rq->cmd_type != REQ_TYPE_FS)
I agree that the (rq->cmd_flags & REQ_NOMERGE_FLAGS) check in
the blk_insert_cloned_request() call-chain (via rq_mergeable()) makes no
sense for cloned requests that always have NOMERGE set.
So you're saying that by having blk_rq_check_limits() go on to call
blk_recalc_rq_segments() this bug will be fixed?
That is the idea.
I've already established that in all instances I have seen so far
req->nr_phys_segments is _less_ than req->bio->bi_phys_segments.
As it turns out, req->nr_phys_segemnts _would_ have been updated in
blk_rq_check_limits(), but isn't due to the NOMERGE flag being set
for the cloned request.
So each cloned request inherits the values from the original request,
despite the fact that req->nr_phys_segments _has_ to be evaluated in
the final request_queue context, as the queue limits _might_ be
different from the original (merged) queue limits of the multipath
request queue.
quoted
BTW, I think blk_rq_check_limits()'s export should be removed and the
function made static and renamed to blk_clone_rq_check_limits(), again:
blk_insert_cloned_request() is the only caller of blk_rq_check_limits()
Actually, seeing Jens' last comment the check for REQ_TYPE_FS is
pointless, too, so we might as well remove the entire if-clause.
quoted
Seems prudent to make that change now to be clear that this code is only
used by cloned requests.
Yeah, that would make sense. I'll be preparing a patch.
With a more detailed description :-)
On Wed, 25 Nov 2015 20:01:47 +0100,
Hannes Reinecke wrote:
quoted
On 11/25/2015 07:01 PM, Mike Snitzer wrote:
quoted
On Wed, Nov 25 2015 at 4:04am -0500,
Hannes Reinecke [off-list ref] wrote:
quoted
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
How did you arrive at that? Do you have a reproducer now?
Not a reproducer, but several dumps for analysis.
quoted
quoted
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag,
NOMERGE is always set in __blk_rq_prep_clone() for cloned requests.
Yes.
quoted
quoted
which is evaluated via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
blk_insert_cloned_request() is the only caller of blk_rq_check_limits();
anyway after reading your mail I'm still left wondering if your proposed
patch is correct.
quoted
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
You're not explaining the actual change in the patch very well; I think
you're correct but you're leaving the justification as an exercise to
the reviewer:
blk_rq_check_limits() will call blk_recalc_rq_segments() after the
!rq_mergeable() check but you're saying for this case in question we
never get there -- due to the cloned request having NOMERGE set.
So in blk_rq_check_limits() you've unrolled rq_mergeable() and
open-coded the lone remaining check (rq->cmd_type != REQ_TYPE_FS)
I agree that the (rq->cmd_flags & REQ_NOMERGE_FLAGS) check in
the blk_insert_cloned_request() call-chain (via rq_mergeable()) makes no
sense for cloned requests that always have NOMERGE set.
So you're saying that by having blk_rq_check_limits() go on to call
blk_recalc_rq_segments() this bug will be fixed?
That is the idea.
I've already established that in all instances I have seen so far
req->nr_phys_segments is _less_ than req->bio->bi_phys_segments.
As it turns out, req->nr_phys_segemnts _would_ have been updated in
blk_rq_check_limits(), but isn't due to the NOMERGE flag being set
for the cloned request.
So each cloned request inherits the values from the original request,
despite the fact that req->nr_phys_segments _has_ to be evaluated in
the final request_queue context, as the queue limits _might_ be
different from the original (merged) queue limits of the multipath
request queue.
quoted
BTW, I think blk_rq_check_limits()'s export should be removed and the
function made static and renamed to blk_clone_rq_check_limits(), again:
blk_insert_cloned_request() is the only caller of blk_rq_check_limits()
Actually, seeing Jens' last comment the check for REQ_TYPE_FS is
pointless, too, so we might as well remove the entire if-clause.
quoted
Seems prudent to make that change now to be clear that this code is only
used by cloned requests.
Yeah, that would make sense. I'll be preparing a patch.
With a more detailed description :-)
Do we have already a fix? Right now I got (likely) this kernel BUG()
on the almost latest Linus tree (commit 25364a9e54fb8296). It
happened while I started a KVM right after a fresh boot. The machine
paniced even before that, so I hit this twice today.
Update to the tree as-of yesterday (or today) and it should work.
25364a9e54fb8296 doesn't include the latest block fixes that were sent
in yesterday, that should fix it. You need commit a88d32af18b8 or newer.
--
Jens Axboe
On Fri, 04 Dec 2015 18:02:58 +0100,
Jens Axboe wrote:
On 12/04/2015 09:59 AM, Takashi Iwai wrote:
quoted
On Wed, 25 Nov 2015 20:01:47 +0100,
Hannes Reinecke wrote:
quoted
On 11/25/2015 07:01 PM, Mike Snitzer wrote:
quoted
On Wed, Nov 25 2015 at 4:04am -0500,
Hannes Reinecke [off-list ref] wrote:
quoted
On 11/20/2015 04:28 PM, Ewan Milne wrote:
quoted
On Fri, 2015-11-20 at 15:55 +0100, Hannes Reinecke wrote:
quoted
Can't we have a joint effort here?
I've been spending a _LOT_ of time trying to debug things here, but
none of the ideas I've come up with have been able to fix anything.
Yes. I'm not the one primarily looking at it, and we don't have a
reproducer in-house. We just have the one dump right now.
quoted
I'm almost tempted to increase the count from scsi_alloc_sgtable()
by one and be done with ...
That might not fix it if it is a problem with the merge code, though.
And indeed, it doesn't.
How did you arrive at that? Do you have a reproducer now?
Not a reproducer, but several dumps for analysis.
quoted
quoted
Seems I finally found the culprit.
What happens is this:
We have two paths, with these seg_boundary_masks:
path-1: seg_boundary_mask = 65535,
path-2: seg_boundary_mask = 4294967295,
consequently the DM request queue has this:
md-1: seg_boundary_mask = 65535,
What happens now is that a request is being formatted, and sent
to path 2. During submission req->nr_phys_segments is formatted
with the limits of path 2, arriving at a count of 3.
Now the request gets retried on path 1, but as the NOMERGE request
flag is set req->nr_phys_segments is never updated.
But blk_rq_map_sg() ignores all counters, and just uses the
bi_vec directly, resulting in a count of 4 -> boom.
So the culprit here is the NOMERGE flag,
NOMERGE is always set in __blk_rq_prep_clone() for cloned requests.
Yes.
quoted
quoted
which is evaluated via
->dm_dispatch_request()
->blk_insert_cloned_request()
->blk_rq_check_limits()
blk_insert_cloned_request() is the only caller of blk_rq_check_limits();
anyway after reading your mail I'm still left wondering if your proposed
patch is correct.
quoted
If the above assessment is correct, the following patch should
fix it:
rq->cmd_flags)) {
Mike? Jens?
Can you comment on it?
You're not explaining the actual change in the patch very well; I think
you're correct but you're leaving the justification as an exercise to
the reviewer:
blk_rq_check_limits() will call blk_recalc_rq_segments() after the
!rq_mergeable() check but you're saying for this case in question we
never get there -- due to the cloned request having NOMERGE set.
So in blk_rq_check_limits() you've unrolled rq_mergeable() and
open-coded the lone remaining check (rq->cmd_type != REQ_TYPE_FS)
I agree that the (rq->cmd_flags & REQ_NOMERGE_FLAGS) check in
the blk_insert_cloned_request() call-chain (via rq_mergeable()) makes no
sense for cloned requests that always have NOMERGE set.
So you're saying that by having blk_rq_check_limits() go on to call
blk_recalc_rq_segments() this bug will be fixed?
That is the idea.
I've already established that in all instances I have seen so far
req->nr_phys_segments is _less_ than req->bio->bi_phys_segments.
As it turns out, req->nr_phys_segemnts _would_ have been updated in
blk_rq_check_limits(), but isn't due to the NOMERGE flag being set
for the cloned request.
So each cloned request inherits the values from the original request,
despite the fact that req->nr_phys_segments _has_ to be evaluated in
the final request_queue context, as the queue limits _might_ be
different from the original (merged) queue limits of the multipath
request queue.
quoted
BTW, I think blk_rq_check_limits()'s export should be removed and the
function made static and renamed to blk_clone_rq_check_limits(), again:
blk_insert_cloned_request() is the only caller of blk_rq_check_limits()
Actually, seeing Jens' last comment the check for REQ_TYPE_FS is
pointless, too, so we might as well remove the entire if-clause.
quoted
Seems prudent to make that change now to be clear that this code is only
used by cloned requests.
Yeah, that would make sense. I'll be preparing a patch.
With a more detailed description :-)
Do we have already a fix? Right now I got (likely) this kernel BUG()
on the almost latest Linus tree (commit 25364a9e54fb8296). It
happened while I started a KVM right after a fresh boot. The machine
paniced even before that, so I hit this twice today.
Update to the tree as-of yesterday (or today) and it should work.
25364a9e54fb8296 doesn't include the latest block fixes that were sent
in yesterday, that should fix it. You need commit a88d32af18b8 or newer.
Alright, I'll give it a try. Thanks for information!
Takashi