Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } We may do this way for the special case, but it is ugly, IMO. Christoph?
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On Mon, Apr 09, 2018 at 11:31:37AM +0300, Sagi Grimberg wrote: > > > > My device exposes nr_hw_queues which is not higher than num_online_cpus > > > so I want to connect all hctxs with hope that they will be used. > > > > The issue is that CPU online & offline can happen any time, and after > > blk-mq removes CPU hotplug handler, there is no way to remap queue > > when CPU topo is changed. > > > > For example: > > > > 1) after nr_hw_queues is set as num_online_cpus() and hw queues > > are initialized, then some of CPUs become offline, and the issue > > reported by Zhang Yi is triggered, but in this case, we should fail > > the allocation since 1:1 mapping doesn't need to use this inactive > > hw queue. > > Normal cpu offlining is fine, as the hctxs are already connected. When > we reset the controller and re-establish the queues, the issue triggers > because we call blk_mq_alloc_request_hctx. That is right, blk_mq_alloc_request_hctx() is one insane interface. Also could you share a bit why the request has to be allocated in this way? I may have to read the NVMe connect protocol and related code for understanding this mechanism. > > The question is, for this particular issue, given that the request > execution is guaranteed to run from an online cpu, will the below work? > -- > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 75336848f7a7..81ced3096433 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct > request_queue *q, > return ERR_PTR(-EXDEV); > } > cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); > + if (cpu >= nr_cpu_ids) { > + pr_warn("no online cpu for hctx %d\n", hctx_idx); > + cpu = cpumask_first(alloc_data.hctx->cpumask); > + } We may do this way for the special case, but it is ugly, IMO. > alloc_data.ctx = __blk_mq_get_ctx(q, cpu); > > rq = blk_mq_get_request(q, NULL, op, _data); > -- > > > 2) when nr_hw_queues is set as num_online_cpus(), there may be > > much less online CPUs, so the hw queue number can be initialized as > > much smaller, then performance is degraded much even if some CPUs > > become online later. > > That is correct, when the controller will be reset though, more queues > will be added to the system. I agree it would be good if we can change > stuff dynamically. > > > So the current policy is to map all possible CPUs for handing CPU > > hotplug, and if you want to get 1:1 mapping between hw queue and > > online CPU, the nr_hw_queues can be set as num_possible_cpus. > > Having nr_hw_queues == num_possible_cpus cannot work as it requires > establishing an RDMA queue-pair with a set of HW resources both on > the host side _and_ on the controller side, which are idle. OK, can I understand it just because there isn't so many hw resources? > > > Please see commit 16ccfff28976130 (nvme: pci: pass max vectors as > > num_possible_cpus() to pci_alloc_irq_vectors). > > Yes, I am aware of this patch, however I not sure it'll be a good idea > for nvmf as it takes resources from both the host and the target for > for cpus that may never come online... > > > It will waste some memory resource just like percpu variable, but it > > simplifies the queue mapping logic a lot, and can support both hard > > and soft CPU online/offline without CPU hotplug handler, which may > > cause very complicated queue dependency issue. > > Yes, but these some memory resources are becoming an issue when it > takes HW (RDMA) resources on the local device and on the target device. Maybe both host & target resource can be allocated until there is any CPU coming for this hctx in host side. But CPU hotplug handler has to be re-introduced, maybe callback of .hctx_activate or .hctx_deactivate can be added for allocating/releasing these resources in CPU hotplug path. Since queue mapping won't be changed, and queue freezing may be avoided, it should be fine. > > > > I agree we don't want to connect hctx which doesn't have an online > > > cpu, that's redundant, but this is not the case here. > > > > OK, I will explain below, and it can be fixed by the following patch too: > > > > https://marc.info/?l=linux-block=152318093725257=2 > > > > I agree this patch is good! > > > > > > > Or I may understand you wrong, :-) > > > > > > > > > > In the report we connected 40 hctxs (which was exactly the number of > > > > > online cpus), after Yi removed 3 cpus, we tried to connect 37 hctxs. > > > > > I'm not sure why some hctxs are left without any online cpus. > > > > > > > > That is possible after the following two commits: > > > > > > > > 4b855ad37194 ("blk-mq: Create hctx for each present CPU) > > > > 20e4d8139319 (blk-mq: simplify queue mapping & schedule with each > > > > possisble CPU) > > > > > > > > And this can be triggered even without putting down any CPUs. > > > > > > > > The blk-mq CPU hotplug handler
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
Hi Sagi Sorry for the late response, bellow patch works, here is the full log: Thanks for testing! Now that we isolated the issue, the question is if this fix is correct given that we are guaranteed that the connect context will run on an online cpu? another reference to the patch (we can make the pr_warn a pr_debug): -- diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } alloc_data.ctx = __blk_mq_get_ctx(q, cpu); rq = blk_mq_get_request(q, NULL, op, _data); --
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On 04/09/2018 04:54 PM, Yi Zhang wrote: On 04/09/2018 04:31 PM, Sagi Grimberg wrote: My device exposes nr_hw_queues which is not higher than num_online_cpus so I want to connect all hctxs with hope that they will be used. The issue is that CPU online & offline can happen any time, and after blk-mq removes CPU hotplug handler, there is no way to remap queue when CPU topo is changed. For example: 1) after nr_hw_queues is set as num_online_cpus() and hw queues are initialized, then some of CPUs become offline, and the issue reported by Zhang Yi is triggered, but in this case, we should fail the allocation since 1:1 mapping doesn't need to use this inactive hw queue. Normal cpu offlining is fine, as the hctxs are already connected. When we reset the controller and re-establish the queues, the issue triggers because we call blk_mq_alloc_request_hctx. The question is, for this particular issue, given that the request execution is guaranteed to run from an online cpu, will the below work? Hi Sagi Sorry for the late response, bellow patch works, here is the full log: And this issue cannot be reproduced on 4.15. So I did bisect testing today, found it was introduced from bellow commit: bf9ae8c blk-mq: fix bad clear of RQF_MQ_INFLIGHT in blk_mq_ct_ctx_init() [ 117.370832] nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 172.31.0.90:4420 [ 117.427385] nvme nvme0: creating 40 I/O queues. [ 117.736806] nvme nvme0: new ctrl: NQN "testnqn", addr 172.31.0.90:4420 [ 122.531891] smpboot: CPU 1 is now offline [ 122.573007] IRQ 37: no longer affine to CPU2 [ 122.55] IRQ 54: no longer affine to CPU2 [ 122.582532] IRQ 70: no longer affine to CPU2 [ 122.587300] IRQ 98: no longer affine to CPU2 [ 122.592069] IRQ 140: no longer affine to CPU2 [ 122.596930] IRQ 141: no longer affine to CPU2 [ 122.603166] smpboot: CPU 2 is now offline [ 122.840577] smpboot: CPU 3 is now offline [ 125.204901] print_req_error: operation not supported error, dev nvme0n1, sector 143212504 [ 125.204907] print_req_error: operation not supported error, dev nvme0n1, sector 481004984 [ 125.204922] print_req_error: operation not supported error, dev nvme0n1, sector 436594584 [ 125.204924] print_req_error: operation not supported error, dev nvme0n1, sector 461363784 [ 125.204945] print_req_error: operation not supported error, dev nvme0n1, sector 308124792 [ 125.204957] print_req_error: operation not supported error, dev nvme0n1, sector 513395784 [ 125.204959] print_req_error: operation not supported error, dev nvme0n1, sector 432260176 [ 125.204961] print_req_error: operation not supported error, dev nvme0n1, sector 251704096 [ 125.204963] print_req_error: operation not supported error, dev nvme0n1, sector 234819336 [ 125.204966] print_req_error: operation not supported error, dev nvme0n1, sector 181874128 [ 125.938858] nvme nvme0: Reconnecting in 10 seconds... [ 125.938862] Buffer I/O error on dev nvme0n1, logical block 367355, lost async page write [ 125.942587] Buffer I/O error on dev nvme0n1, logical block 586, lost async page write [ 125.942589] Buffer I/O error on dev nvme0n1, logical block 375453, lost async page write [ 125.942591] Buffer I/O error on dev nvme0n1, logical block 587, lost async page write [ 125.942592] Buffer I/O error on dev nvme0n1, logical block 588, lost async page write [ 125.942593] Buffer I/O error on dev nvme0n1, logical block 375454, lost async page write [ 125.942594] Buffer I/O error on dev nvme0n1, logical block 589, lost async page write [ 125.942595] Buffer I/O error on dev nvme0n1, logical block 590, lost async page write [ 125.942596] Buffer I/O error on dev nvme0n1, logical block 591, lost async page write [ 125.942597] Buffer I/O error on dev nvme0n1, logical block 592, lost async page write [ 130.205584] print_req_error: 537000 callbacks suppressed [ 130.205586] print_req_error: I/O error, dev nvme0n1, sector 471135288 [ 130.218763] print_req_error: I/O error, dev nvme0n1, sector 471137240 [ 130.225985] print_req_error: I/O error, dev nvme0n1, sector 471138328 [ 130.233206] print_req_error: I/O error, dev nvme0n1, sector 471140096 [ 130.240433] print_req_error: I/O error, dev nvme0n1, sector 471140184 [ 130.247659] print_req_error: I/O error, dev nvme0n1, sector 471140960 [ 130.254874] print_req_error: I/O error, dev nvme0n1, sector 471141864 [ 130.262095] print_req_error: I/O error, dev nvme0n1, sector 471143296 [ 130.269317] print_req_error: I/O error, dev nvme0n1, sector 471143776 [ 130.276537] print_req_error: I/O error, dev nvme0n1, sector 471144224 [ 132.954315] nvme nvme0: Identify namespace failed [ 132.959698] buffer_io_error: 3801549 callbacks suppressed [ 132.959699] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 132.974669] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 132.983078] Buffer I/O error on dev nvme0n1, logical block 0, async
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On 04/09/2018 04:31 PM, Sagi Grimberg wrote: My device exposes nr_hw_queues which is not higher than num_online_cpus so I want to connect all hctxs with hope that they will be used. The issue is that CPU online & offline can happen any time, and after blk-mq removes CPU hotplug handler, there is no way to remap queue when CPU topo is changed. For example: 1) after nr_hw_queues is set as num_online_cpus() and hw queues are initialized, then some of CPUs become offline, and the issue reported by Zhang Yi is triggered, but in this case, we should fail the allocation since 1:1 mapping doesn't need to use this inactive hw queue. Normal cpu offlining is fine, as the hctxs are already connected. When we reset the controller and re-establish the queues, the issue triggers because we call blk_mq_alloc_request_hctx. The question is, for this particular issue, given that the request execution is guaranteed to run from an online cpu, will the below work? Hi Sagi Sorry for the late response, bellow patch works, here is the full log: [ 117.370832] nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 172.31.0.90:4420 [ 117.427385] nvme nvme0: creating 40 I/O queues. [ 117.736806] nvme nvme0: new ctrl: NQN "testnqn", addr 172.31.0.90:4420 [ 122.531891] smpboot: CPU 1 is now offline [ 122.573007] IRQ 37: no longer affine to CPU2 [ 122.55] IRQ 54: no longer affine to CPU2 [ 122.582532] IRQ 70: no longer affine to CPU2 [ 122.587300] IRQ 98: no longer affine to CPU2 [ 122.592069] IRQ 140: no longer affine to CPU2 [ 122.596930] IRQ 141: no longer affine to CPU2 [ 122.603166] smpboot: CPU 2 is now offline [ 122.840577] smpboot: CPU 3 is now offline [ 125.204901] print_req_error: operation not supported error, dev nvme0n1, sector 143212504 [ 125.204907] print_req_error: operation not supported error, dev nvme0n1, sector 481004984 [ 125.204922] print_req_error: operation not supported error, dev nvme0n1, sector 436594584 [ 125.204924] print_req_error: operation not supported error, dev nvme0n1, sector 461363784 [ 125.204945] print_req_error: operation not supported error, dev nvme0n1, sector 308124792 [ 125.204957] print_req_error: operation not supported error, dev nvme0n1, sector 513395784 [ 125.204959] print_req_error: operation not supported error, dev nvme0n1, sector 432260176 [ 125.204961] print_req_error: operation not supported error, dev nvme0n1, sector 251704096 [ 125.204963] print_req_error: operation not supported error, dev nvme0n1, sector 234819336 [ 125.204966] print_req_error: operation not supported error, dev nvme0n1, sector 181874128 [ 125.938858] nvme nvme0: Reconnecting in 10 seconds... [ 125.938862] Buffer I/O error on dev nvme0n1, logical block 367355, lost async page write [ 125.942587] Buffer I/O error on dev nvme0n1, logical block 586, lost async page write [ 125.942589] Buffer I/O error on dev nvme0n1, logical block 375453, lost async page write [ 125.942591] Buffer I/O error on dev nvme0n1, logical block 587, lost async page write [ 125.942592] Buffer I/O error on dev nvme0n1, logical block 588, lost async page write [ 125.942593] Buffer I/O error on dev nvme0n1, logical block 375454, lost async page write [ 125.942594] Buffer I/O error on dev nvme0n1, logical block 589, lost async page write [ 125.942595] Buffer I/O error on dev nvme0n1, logical block 590, lost async page write [ 125.942596] Buffer I/O error on dev nvme0n1, logical block 591, lost async page write [ 125.942597] Buffer I/O error on dev nvme0n1, logical block 592, lost async page write [ 130.205584] print_req_error: 537000 callbacks suppressed [ 130.205586] print_req_error: I/O error, dev nvme0n1, sector 471135288 [ 130.218763] print_req_error: I/O error, dev nvme0n1, sector 471137240 [ 130.225985] print_req_error: I/O error, dev nvme0n1, sector 471138328 [ 130.233206] print_req_error: I/O error, dev nvme0n1, sector 471140096 [ 130.240433] print_req_error: I/O error, dev nvme0n1, sector 471140184 [ 130.247659] print_req_error: I/O error, dev nvme0n1, sector 471140960 [ 130.254874] print_req_error: I/O error, dev nvme0n1, sector 471141864 [ 130.262095] print_req_error: I/O error, dev nvme0n1, sector 471143296 [ 130.269317] print_req_error: I/O error, dev nvme0n1, sector 471143776 [ 130.276537] print_req_error: I/O error, dev nvme0n1, sector 471144224 [ 132.954315] nvme nvme0: Identify namespace failed [ 132.959698] buffer_io_error: 3801549 callbacks suppressed [ 132.959699] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 132.974669] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 132.983078] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 132.991476] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 132.999859] Buffer I/O error on dev nvme0n1, logical block 0, async page read [ 133.008217] Buffer I/O error on dev nvme0n1, logical block 0, async
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
My device exposes nr_hw_queues which is not higher than num_online_cpus so I want to connect all hctxs with hope that they will be used. The issue is that CPU online & offline can happen any time, and after blk-mq removes CPU hotplug handler, there is no way to remap queue when CPU topo is changed. For example: 1) after nr_hw_queues is set as num_online_cpus() and hw queues are initialized, then some of CPUs become offline, and the issue reported by Zhang Yi is triggered, but in this case, we should fail the allocation since 1:1 mapping doesn't need to use this inactive hw queue. Normal cpu offlining is fine, as the hctxs are already connected. When we reset the controller and re-establish the queues, the issue triggers because we call blk_mq_alloc_request_hctx. The question is, for this particular issue, given that the request execution is guaranteed to run from an online cpu, will the below work? -- diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } alloc_data.ctx = __blk_mq_get_ctx(q, cpu); rq = blk_mq_get_request(q, NULL, op, _data); -- 2) when nr_hw_queues is set as num_online_cpus(), there may be much less online CPUs, so the hw queue number can be initialized as much smaller, then performance is degraded much even if some CPUs become online later. That is correct, when the controller will be reset though, more queues will be added to the system. I agree it would be good if we can change stuff dynamically. So the current policy is to map all possible CPUs for handing CPU hotplug, and if you want to get 1:1 mapping between hw queue and online CPU, the nr_hw_queues can be set as num_possible_cpus. Having nr_hw_queues == num_possible_cpus cannot work as it requires establishing an RDMA queue-pair with a set of HW resources both on the host side _and_ on the controller side, which are idle. Please see commit 16ccfff28976130 (nvme: pci: pass max vectors as num_possible_cpus() to pci_alloc_irq_vectors). Yes, I am aware of this patch, however I not sure it'll be a good idea for nvmf as it takes resources from both the host and the target for for cpus that may never come online... It will waste some memory resource just like percpu variable, but it simplifies the queue mapping logic a lot, and can support both hard and soft CPU online/offline without CPU hotplug handler, which may cause very complicated queue dependency issue. Yes, but these some memory resources are becoming an issue when it takes HW (RDMA) resources on the local device and on the target device. I agree we don't want to connect hctx which doesn't have an online cpu, that's redundant, but this is not the case here. OK, I will explain below, and it can be fixed by the following patch too: https://marc.info/?l=linux-block=152318093725257=2 I agree this patch is good! Or I may understand you wrong, :-) In the report we connected 40 hctxs (which was exactly the number of online cpus), after Yi removed 3 cpus, we tried to connect 37 hctxs. I'm not sure why some hctxs are left without any online cpus. That is possible after the following two commits: 4b855ad37194 ("blk-mq: Create hctx for each present CPU) 20e4d8139319 (blk-mq: simplify queue mapping & schedule with each possisble CPU) And this can be triggered even without putting down any CPUs. The blk-mq CPU hotplug handler is removed in 4b855ad37194, and we can't remap queue any more when CPU topo is changed, so the static & fixed mapping has to be setup from the beginning. Then if there are less enough online CPUs compared with number of hw queues, some of hctxes can be mapped with all offline CPUs. For example, if one device has 4 hw queues, but there are only 2 online CPUs and 6 offline CPUs, at most 2 hw queues are assigned to online CPUs, and the other two are all with offline CPUs. That is fine, but the problem that I gave in the example below which has nr_hw_queues == num_online_cpus but because of the mapping, we still have unmapped hctxs. For FC's case, there may be some hctxs not 'mapped', which is caused by blk_mq_map_queues(), but that should one bug. So the patch(blk-mq: don't keep offline CPUs mapped to hctx 0)[1] is fixing the issue: [1] https://marc.info/?l=linux-block=152318093725257=2 Once this patch is in, any hctx should be mapped by at least one CPU. I think this will solve the problem Yi is stepping on. Then later, the patch(blk-mq: reimplement blk_mq_hw_queue_mapped)[2] extends the mapping concept, maybe it should have been renamed
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On Sun, Apr 08, 2018 at 04:35:59PM +0300, Sagi Grimberg wrote: > > > On 04/08/2018 03:57 PM, Ming Lei wrote: > > On Sun, Apr 08, 2018 at 02:53:03PM +0300, Sagi Grimberg wrote: > > > > > > > > > > > > Hi Sagi > > > > > > > > > > > > > > > > > > Still can reproduce this issue with the change: > > > > > > > > > > > > > > > > Thanks for validating Yi, > > > > > > > > > > > > > > > > Would it be possible to test the following: > > > > > > > > -- > > > > > > > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > > > > > > > index 75336848f7a7..81ced3096433 100644 > > > > > > > > --- a/block/blk-mq.c > > > > > > > > +++ b/block/blk-mq.c > > > > > > > > @@ -444,6 +444,10 @@ struct request > > > > > > > > *blk_mq_alloc_request_hctx(struct > > > > > > > > request_queue *q, > > > > > > > >return ERR_PTR(-EXDEV); > > > > > > > >} > > > > > > > >cpu = cpumask_first_and(alloc_data.hctx->cpumask, > > > > > > > > cpu_online_mask); > > > > > > > > + if (cpu >= nr_cpu_ids) { > > > > > > > > + pr_warn("no online cpu for hctx %d\n", > > > > > > > > hctx_idx); > > > > > > > > + cpu = cpumask_first(alloc_data.hctx->cpumask); > > > > > > > > + } > > > > > > > >alloc_data.ctx = __blk_mq_get_ctx(q, cpu); > > > > > > > > > > > > > > > >rq = blk_mq_get_request(q, NULL, op, _data); > > > > > > > > -- > > > > > > > > ... > > > > > > > > > > > > > > > > > > > > > > > > > [ 153.384977] BUG: unable to handle kernel paging request at > > > > > > > > > 3a9ed053bd48 > > > > > > > > > [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 > > > > > > > > > > > > > > > > Also would it be possible to provide gdb output of: > > > > > > > > > > > > > > > > l *(blk_mq_get_request+0x23e) > > > > > > > > > > > > > > nvmf_connect_io_queue() is used in this way by asking blk-mq to > > > > > > > allocate > > > > > > > request from one specific hw queue, but there may not be all > > > > > > > online CPUs > > > > > > > mapped to this hw queue. > > > > > > > > > > Yes, this is what I suspect.. > > > > > > > > > > > And the following patchset may fail this kind of allocation and > > > > > > avoid > > > > > > the kernel oops. > > > > > > > > > > > > https://marc.info/?l=linux-block=152318091025252=2 > > > > > > > > > > Thanks Ming, > > > > > > > > > > But I don't want to fail the allocation, nvmf_connect_io_queue simply > > > > > needs a tag to issue the connect request, I much rather to take this > > > > > tag from an online cpu than failing it... We use this because we > > > > > reserve > > > > > > > > The failure is only triggered when there isn't any online CPU mapped to > > > > this hctx, so do you want to wait for CPUs for this hctx becoming > > > > online? > > > > > > I was thinking of allocating a tag from that hctx even if it had no > > > online cpu, the execution is done on an online cpu (hence the call > > > to blk_mq_alloc_request_hctx). > > > > That can be done, but not following the current blk-mq's rule, because > > blk-mq requires to dispatch the request on CPUs mapping to this hctx. > > > > Could you explain a bit why you want to do in this way? > > My device exposes nr_hw_queues which is not higher than num_online_cpus > so I want to connect all hctxs with hope that they will be used. The issue is that CPU online & offline can happen any time, and after blk-mq removes CPU hotplug handler, there is no way to remap queue when CPU topo is changed. For example: 1) after nr_hw_queues is set as num_online_cpus() and hw queues are initialized, then some of CPUs become offline, and the issue reported by Zhang Yi is triggered, but in this case, we should fail the allocation since 1:1 mapping doesn't need to use this inactive hw queue. 2) when nr_hw_queues is set as num_online_cpus(), there may be much less online CPUs, so the hw queue number can be initialized as much smaller, then performance is degraded much even if some CPUs become online later. So the current policy is to map all possible CPUs for handing CPU hotplug, and if you want to get 1:1 mapping between hw queue and online CPU, the nr_hw_queues can be set as num_possible_cpus. Please see commit 16ccfff28976130 (nvme: pci: pass max vectors as num_possible_cpus() to pci_alloc_irq_vectors). It will waste some memory resource just like percpu variable, but it simplifies the queue mapping logic a lot, and can support both hard and soft CPU online/offline without CPU hotplug handler, which may cause very complicated queue dependency issue. > > I agree we don't want to connect hctx which doesn't have an online > cpu, that's redundant, but this is not the case here. OK, I will explain below, and it can be fixed by the following patch too: https://marc.info/?l=linux-block=152318093725257=2 > > > > > Or I may understand you wrong, :-) > > > > > > In the report we connected 40 hctxs (which was exactly the number of > > > online cpus), after Yi
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On 04/08/2018 03:57 PM, Ming Lei wrote: On Sun, Apr 08, 2018 at 02:53:03PM +0300, Sagi Grimberg wrote: Hi Sagi Still can reproduce this issue with the change: Thanks for validating Yi, Would it be possible to test the following: -- diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } alloc_data.ctx = __blk_mq_get_ctx(q, cpu); rq = blk_mq_get_request(q, NULL, op, _data); -- ... [ 153.384977] BUG: unable to handle kernel paging request at 3a9ed053bd48 [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 Also would it be possible to provide gdb output of: l *(blk_mq_get_request+0x23e) nvmf_connect_io_queue() is used in this way by asking blk-mq to allocate request from one specific hw queue, but there may not be all online CPUs mapped to this hw queue. Yes, this is what I suspect.. And the following patchset may fail this kind of allocation and avoid the kernel oops. https://marc.info/?l=linux-block=152318091025252=2 Thanks Ming, But I don't want to fail the allocation, nvmf_connect_io_queue simply needs a tag to issue the connect request, I much rather to take this tag from an online cpu than failing it... We use this because we reserve The failure is only triggered when there isn't any online CPU mapped to this hctx, so do you want to wait for CPUs for this hctx becoming online? I was thinking of allocating a tag from that hctx even if it had no online cpu, the execution is done on an online cpu (hence the call to blk_mq_alloc_request_hctx). That can be done, but not following the current blk-mq's rule, because blk-mq requires to dispatch the request on CPUs mapping to this hctx. Could you explain a bit why you want to do in this way? My device exposes nr_hw_queues which is not higher than num_online_cpus so I want to connect all hctxs with hope that they will be used. I agree we don't want to connect hctx which doesn't have an online cpu, that's redundant, but this is not the case here. Or I may understand you wrong, :-) In the report we connected 40 hctxs (which was exactly the number of online cpus), after Yi removed 3 cpus, we tried to connect 37 hctxs. I'm not sure why some hctxs are left without any online cpus. That is possible after the following two commits: 4b855ad37194 ("blk-mq: Create hctx for each present CPU) 20e4d8139319 (blk-mq: simplify queue mapping & schedule with each possisble CPU) And this can be triggered even without putting down any CPUs. The blk-mq CPU hotplug handler is removed in 4b855ad37194, and we can't remap queue any more when CPU topo is changed, so the static & fixed mapping has to be setup from the beginning. Then if there are less enough online CPUs compared with number of hw queues, some of hctxes can be mapped with all offline CPUs. For example, if one device has 4 hw queues, but there are only 2 online CPUs and 6 offline CPUs, at most 2 hw queues are assigned to online CPUs, and the other two are all with offline CPUs. That is fine, but the problem that I gave in the example below which has nr_hw_queues == num_online_cpus but because of the mapping, we still have unmapped hctxs. Lets say I have 4-cpu system and my device always allocates num_online_cpus() hctxs. at first I get: cpu0 -> hctx0 cpu1 -> hctx1 cpu2 -> hctx2 cpu3 -> hctx3 When cpu1 goes offline I think the new mapping will be: cpu0 -> hctx0 cpu1 -> hctx0 (from cpu_to_queue_index) // offline cpu2 -> hctx2 cpu3 -> hctx0 (from cpu_to_queue_index) This means that now hctx1 is unmapped. I guess we can fix nvmf code to not connect it. But we end up with less queues than cpus without any good reason. I would have optimally want a different mapping that will use all the queues: cpu0 -> hctx0 cpu2 -> hctx1 cpu3 -> hctx2 * cpu1 -> hctx1 (doesn't matter, offline) Something looks broken... No, it isn't broken. maybe broken is the wrong phrase, but its suboptimal... Storage is client/server model, the hw queue should be only active if there is request coming from client(CPU), Correct. and the hw queue becomes inactive if no online CPU is mapped to it. But when we reset the controller, we call blk_mq_update_nr_hw_queues() with the current number of nr_hw_queues which never exceeds num_online_cpus. This in turn, remaps the mq_map which results in unmapped queues because of the mapping function, not because we have more hctx than online cpus... An easy fix, is to allocate num_present_cpus queues, and only connect the oneline ones, but as you said, we have
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On Sun, Apr 08, 2018 at 02:53:03PM +0300, Sagi Grimberg wrote: > > > > > > > > Hi Sagi > > > > > > > > > > > > > > Still can reproduce this issue with the change: > > > > > > > > > > > > Thanks for validating Yi, > > > > > > > > > > > > Would it be possible to test the following: > > > > > > -- > > > > > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > > > > > index 75336848f7a7..81ced3096433 100644 > > > > > > --- a/block/blk-mq.c > > > > > > +++ b/block/blk-mq.c > > > > > > @@ -444,6 +444,10 @@ struct request > > > > > > *blk_mq_alloc_request_hctx(struct > > > > > > request_queue *q, > > > > > > return ERR_PTR(-EXDEV); > > > > > > } > > > > > > cpu = cpumask_first_and(alloc_data.hctx->cpumask, > > > > > > cpu_online_mask); > > > > > > + if (cpu >= nr_cpu_ids) { > > > > > > + pr_warn("no online cpu for hctx %d\n", hctx_idx); > > > > > > + cpu = cpumask_first(alloc_data.hctx->cpumask); > > > > > > + } > > > > > > alloc_data.ctx = __blk_mq_get_ctx(q, cpu); > > > > > > > > > > > > rq = blk_mq_get_request(q, NULL, op, _data); > > > > > > -- > > > > > > ... > > > > > > > > > > > > > > > > > > > [ 153.384977] BUG: unable to handle kernel paging request at > > > > > > > 3a9ed053bd48 > > > > > > > [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 > > > > > > > > > > > > Also would it be possible to provide gdb output of: > > > > > > > > > > > > l *(blk_mq_get_request+0x23e) > > > > > > > > > > nvmf_connect_io_queue() is used in this way by asking blk-mq to > > > > > allocate > > > > > request from one specific hw queue, but there may not be all online > > > > > CPUs > > > > > mapped to this hw queue. > > > > > > Yes, this is what I suspect.. > > > > > > > And the following patchset may fail this kind of allocation and avoid > > > > the kernel oops. > > > > > > > > https://marc.info/?l=linux-block=152318091025252=2 > > > > > > Thanks Ming, > > > > > > But I don't want to fail the allocation, nvmf_connect_io_queue simply > > > needs a tag to issue the connect request, I much rather to take this > > > tag from an online cpu than failing it... We use this because we reserve > > > > The failure is only triggered when there isn't any online CPU mapped to > > this hctx, so do you want to wait for CPUs for this hctx becoming online? > > I was thinking of allocating a tag from that hctx even if it had no > online cpu, the execution is done on an online cpu (hence the call > to blk_mq_alloc_request_hctx). That can be done, but not following the current blk-mq's rule, because blk-mq requires to dispatch the request on CPUs mapping to this hctx. Could you explain a bit why you want to do in this way? > > > Or I may understand you wrong, :-) > > In the report we connected 40 hctxs (which was exactly the number of > online cpus), after Yi removed 3 cpus, we tried to connect 37 hctxs. > I'm not sure why some hctxs are left without any online cpus. That is possible after the following two commits: 4b855ad37194 ("blk-mq: Create hctx for each present CPU) 20e4d8139319 (blk-mq: simplify queue mapping & schedule with each possisble CPU) And this can be triggered even without putting down any CPUs. The blk-mq CPU hotplug handler is removed in 4b855ad37194, and we can't remap queue any more when CPU topo is changed, so the static & fixed mapping has to be setup from the beginning. Then if there are less enough online CPUs compared with number of hw queues, some of hctxes can be mapped with all offline CPUs. For example, if one device has 4 hw queues, but there are only 2 online CPUs and 6 offline CPUs, at most 2 hw queues are assigned to online CPUs, and the other two are all with offline CPUs. > > This seems to be related to the queue mapping. Yes. > > Lets say I have 4-cpu system and my device always allocates > num_online_cpus() hctxs. > > at first I get: > cpu0 -> hctx0 > cpu1 -> hctx1 > cpu2 -> hctx2 > cpu3 -> hctx3 > > When cpu1 goes offline I think the new mapping will be: > cpu0 -> hctx0 > cpu1 -> hctx0 (from cpu_to_queue_index) // offline > cpu2 -> hctx2 > cpu3 -> hctx0 (from cpu_to_queue_index) > > This means that now hctx1 is unmapped. I guess we can fix nvmf code > to not connect it. But we end up with less queues than cpus without > any good reason. > > I would have optimally want a different mapping that will use all > the queues: > cpu0 -> hctx0 > cpu2 -> hctx1 > cpu3 -> hctx2 > * cpu1 -> hctx1 (doesn't matter, offline) > > Something looks broken... No, it isn't broken. Storage is client/server model, the hw queue should be only active if there is request coming from client(CPU), and the hw queue becomes inactive if no online CPU is mapped to it. That is why the normal rule is that request allocation needs CPU context info, then the hctx is obtained via the queue mapping. Thanks Ming
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
Hi Sagi Still can reproduce this issue with the change: Thanks for validating Yi, Would it be possible to test the following: -- diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } alloc_data.ctx = __blk_mq_get_ctx(q, cpu); rq = blk_mq_get_request(q, NULL, op, _data); -- ... [ 153.384977] BUG: unable to handle kernel paging request at 3a9ed053bd48 [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 Also would it be possible to provide gdb output of: l *(blk_mq_get_request+0x23e) nvmf_connect_io_queue() is used in this way by asking blk-mq to allocate request from one specific hw queue, but there may not be all online CPUs mapped to this hw queue. Yes, this is what I suspect.. And the following patchset may fail this kind of allocation and avoid the kernel oops. https://marc.info/?l=linux-block=152318091025252=2 Thanks Ming, But I don't want to fail the allocation, nvmf_connect_io_queue simply needs a tag to issue the connect request, I much rather to take this tag from an online cpu than failing it... We use this because we reserve The failure is only triggered when there isn't any online CPU mapped to this hctx, so do you want to wait for CPUs for this hctx becoming online? I was thinking of allocating a tag from that hctx even if it had no online cpu, the execution is done on an online cpu (hence the call to blk_mq_alloc_request_hctx). Or I may understand you wrong, :-) In the report we connected 40 hctxs (which was exactly the number of online cpus), after Yi removed 3 cpus, we tried to connect 37 hctxs. I'm not sure why some hctxs are left without any online cpus. This seems to be related to the queue mapping. Lets say I have 4-cpu system and my device always allocates num_online_cpus() hctxs. at first I get: cpu0 -> hctx0 cpu1 -> hctx1 cpu2 -> hctx2 cpu3 -> hctx3 When cpu1 goes offline I think the new mapping will be: cpu0 -> hctx0 cpu1 -> hctx0 (from cpu_to_queue_index) // offline cpu2 -> hctx2 cpu3 -> hctx0 (from cpu_to_queue_index) This means that now hctx1 is unmapped. I guess we can fix nvmf code to not connect it. But we end up with less queues than cpus without any good reason. I would have optimally want a different mapping that will use all the queues: cpu0 -> hctx0 cpu2 -> hctx1 cpu3 -> hctx2 * cpu1 -> hctx1 (doesn't matter, offline) Something looks broken...
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On Sun, Apr 08, 2018 at 01:58:49PM +0300, Sagi Grimberg wrote: > > > > > > Hi Sagi > > > > > > > > > > Still can reproduce this issue with the change: > > > > > > > > Thanks for validating Yi, > > > > > > > > Would it be possible to test the following: > > > > -- > > > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > > > index 75336848f7a7..81ced3096433 100644 > > > > --- a/block/blk-mq.c > > > > +++ b/block/blk-mq.c > > > > @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct > > > > request_queue *q, > > > > return ERR_PTR(-EXDEV); > > > > } > > > > cpu = cpumask_first_and(alloc_data.hctx->cpumask, > > > > cpu_online_mask); > > > > + if (cpu >= nr_cpu_ids) { > > > > + pr_warn("no online cpu for hctx %d\n", hctx_idx); > > > > + cpu = cpumask_first(alloc_data.hctx->cpumask); > > > > + } > > > > alloc_data.ctx = __blk_mq_get_ctx(q, cpu); > > > > > > > > rq = blk_mq_get_request(q, NULL, op, _data); > > > > -- > > > > ... > > > > > > > > > > > > > [ 153.384977] BUG: unable to handle kernel paging request at > > > > > 3a9ed053bd48 > > > > > [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 > > > > > > > > Also would it be possible to provide gdb output of: > > > > > > > > l *(blk_mq_get_request+0x23e) > > > > > > nvmf_connect_io_queue() is used in this way by asking blk-mq to allocate > > > request from one specific hw queue, but there may not be all online CPUs > > > mapped to this hw queue. > > Yes, this is what I suspect.. > > > And the following patchset may fail this kind of allocation and avoid > > the kernel oops. > > > > https://marc.info/?l=linux-block=152318091025252=2 > > Thanks Ming, > > But I don't want to fail the allocation, nvmf_connect_io_queue simply > needs a tag to issue the connect request, I much rather to take this > tag from an online cpu than failing it... We use this because we reserve The failure is only triggered when there isn't any online CPU mapped to this hctx, so do you want to wait for CPUs for this hctx becoming online? Or I may understand you wrong, :-) > a tag per-queue for this, but in this case, I'd rather block until the > inflight tag complete than failing the connect. No, there can't be any inflight request for this hctx. Thanks, Ming
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
Hi Sagi Still can reproduce this issue with the change: Thanks for validating Yi, Would it be possible to test the following: -- diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } alloc_data.ctx = __blk_mq_get_ctx(q, cpu); rq = blk_mq_get_request(q, NULL, op, _data); -- ... [ 153.384977] BUG: unable to handle kernel paging request at 3a9ed053bd48 [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 Also would it be possible to provide gdb output of: l *(blk_mq_get_request+0x23e) nvmf_connect_io_queue() is used in this way by asking blk-mq to allocate request from one specific hw queue, but there may not be all online CPUs mapped to this hw queue. Yes, this is what I suspect.. And the following patchset may fail this kind of allocation and avoid the kernel oops. https://marc.info/?l=linux-block=152318091025252=2 Thanks Ming, But I don't want to fail the allocation, nvmf_connect_io_queue simply needs a tag to issue the connect request, I much rather to take this tag from an online cpu than failing it... We use this because we reserve a tag per-queue for this, but in this case, I'd rather block until the inflight tag complete than failing the connect.
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On Sun, Apr 08, 2018 at 06:44:33PM +0800, Ming Lei wrote: > On Sun, Apr 08, 2018 at 01:36:27PM +0300, Sagi Grimberg wrote: > > > > > Hi Sagi > > > > > > Still can reproduce this issue with the change: > > > > Thanks for validating Yi, > > > > Would it be possible to test the following: > > -- > > diff --git a/block/blk-mq.c b/block/blk-mq.c > > index 75336848f7a7..81ced3096433 100644 > > --- a/block/blk-mq.c > > +++ b/block/blk-mq.c > > @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct > > request_queue *q, > > return ERR_PTR(-EXDEV); > > } > > cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); > > + if (cpu >= nr_cpu_ids) { > > + pr_warn("no online cpu for hctx %d\n", hctx_idx); > > + cpu = cpumask_first(alloc_data.hctx->cpumask); > > + } > > alloc_data.ctx = __blk_mq_get_ctx(q, cpu); > > > > rq = blk_mq_get_request(q, NULL, op, _data); > > -- > > ... > > > > > > > [ 153.384977] BUG: unable to handle kernel paging request at > > > 3a9ed053bd48 > > > [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 > > > > Also would it be possible to provide gdb output of: > > > > l *(blk_mq_get_request+0x23e) > > nvmf_connect_io_queue() is used in this way by asking blk-mq to allocate > request from one specific hw queue, but there may not be all online CPUs > mapped to this hw queue. And the following patchset may fail this kind of allocation and avoid the kernel oops. https://marc.info/?l=linux-block=152318091025252=2 Thanks, Ming
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On Sun, Apr 08, 2018 at 01:36:27PM +0300, Sagi Grimberg wrote: > > > Hi Sagi > > > > Still can reproduce this issue with the change: > > Thanks for validating Yi, > > Would it be possible to test the following: > -- > diff --git a/block/blk-mq.c b/block/blk-mq.c > index 75336848f7a7..81ced3096433 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct > request_queue *q, > return ERR_PTR(-EXDEV); > } > cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); > + if (cpu >= nr_cpu_ids) { > + pr_warn("no online cpu for hctx %d\n", hctx_idx); > + cpu = cpumask_first(alloc_data.hctx->cpumask); > + } > alloc_data.ctx = __blk_mq_get_ctx(q, cpu); > > rq = blk_mq_get_request(q, NULL, op, _data); > -- > ... > > > > [ 153.384977] BUG: unable to handle kernel paging request at > > 3a9ed053bd48 > > [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 > > Also would it be possible to provide gdb output of: > > l *(blk_mq_get_request+0x23e) nvmf_connect_io_queue() is used in this way by asking blk-mq to allocate request from one specific hw queue, but there may not be all online CPUs mapped to this hw queue. Thanks, Ming
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
Hi Sagi Still can reproduce this issue with the change: Thanks for validating Yi, Would it be possible to test the following: -- diff --git a/block/blk-mq.c b/block/blk-mq.c index 75336848f7a7..81ced3096433 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -444,6 +444,10 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, return ERR_PTR(-EXDEV); } cpu = cpumask_first_and(alloc_data.hctx->cpumask, cpu_online_mask); + if (cpu >= nr_cpu_ids) { + pr_warn("no online cpu for hctx %d\n", hctx_idx); + cpu = cpumask_first(alloc_data.hctx->cpumask); + } alloc_data.ctx = __blk_mq_get_ctx(q, cpu); rq = blk_mq_get_request(q, NULL, op, _data); -- ... [ 153.384977] BUG: unable to handle kernel paging request at 3a9ed053bd48 [ 153.393197] IP: blk_mq_get_request+0x23e/0x390 Also would it be possible to provide gdb output of: l *(blk_mq_get_request+0x23e) Thanks,
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On 04/04/2018 09:22 PM, Sagi Grimberg wrote: On 03/30/2018 12:32 PM, Yi Zhang wrote: Hello I got this kernel BUG on 4.16.0-rc7, here is the reproducer and log, let me know if you need more info, thanks. Reproducer: 1. setup target #nvmetcli restore /etc/rdma.json 2. connect target on host #nvme connect-all -t rdma -a $IP -s 4420during my NVMeoF RDMA testing 3. do fio background on host #fio -filename=/dev/nvme0n1 -iodepth=1 -thread -rw=randwrite -ioengine=psync -bssplit=5k/10:9k/10:13k/10:17k/10:21k/10:25k/10:29k/10:33k/10:37k/10:41k/10 -bs_unaligned -runtime=180 -size=-group_reporting -name=mytest -numjobs=60 & 4. offline cpu on host #echo 0 > /sys/devices/system/cpu/cpu1/online #echo 0 > /sys/devices/system/cpu/cpu2/online #echo 0 > /sys/devices/system/cpu/cpu3/online 5. clear target #nvmetcli clear 6. restore target #nvmetcli restore /etc/rdma.json 7. check console log on host Hi Yi, Does this happen with this applied? -- diff --git a/block/blk-mq-rdma.c b/block/blk-mq-rdma.c index 996167f1de18..b89da55e8aaa 100644 --- a/block/blk-mq-rdma.c +++ b/block/blk-mq-rdma.c @@ -35,6 +35,8 @@ int blk_mq_rdma_map_queues(struct blk_mq_tag_set *set, const struct cpumask *mask; unsigned int queue, cpu; + goto fallback; + for (queue = 0; queue < set->nr_hw_queues; queue++) { mask = ib_get_vector_affinity(dev, first_vec + queue); if (!mask) -- Hi Sagi Still can reproduce this issue with the change: [ 133.469908] nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 172.31.0.90:4420 [ 133.554025] nvme nvme0: creating 40 I/O queues. [ 133.947648] nvme nvme0: new ctrl: NQN "testnqn", addr 172.31.0.90:4420 [ 138.740870] smpboot: CPU 1 is now offline [ 138.778382] IRQ 37: no longer affine to CPU2 [ 138.783153] IRQ 54: no longer affine to CPU2 [ 138.787919] IRQ 70: no longer affine to CPU2 [ 138.792687] IRQ 98: no longer affine to CPU2 [ 138.797458] IRQ 140: no longer affine to CPU2 [ 138.802319] IRQ 141: no longer affine to CPU2 [ 138.807189] IRQ 166: no longer affine to CPU2 [ 138.813622] smpboot: CPU 2 is now offline [ 139.043610] smpboot: CPU 3 is now offline [ 141.587283] print_req_error: operation not supported error, dev nvme0n1, sector 494622136 [ 141.587303] print_req_error: operation not supported error, dev nvme0n1, sector 219643648 [ 141.587304] print_req_error: operation not supported error, dev nvme0n1, sector 279256456 [ 141.587306] print_req_error: operation not supported error, dev nvme0n1, sector 1208024 [ 141.587322] print_req_error: operation not supported error, dev nvme0n1, sector 100575248 [ 141.587335] print_req_error: operation not supported error, dev nvme0n1, sector 111717456 [ 141.587346] print_req_error: operation not supported error, dev nvme0n1, sector 171939296 [ 141.587348] print_req_error: operation not supported error, dev nvme0n1, sector 476420528 [ 141.587353] print_req_error: operation not supported error, dev nvme0n1, sector 371566696 [ 141.587356] print_req_error: operation not supported error, dev nvme0n1, sector 161758408 [ 141.587463] Buffer I/O error on dev nvme0n1, logical block 54193430, lost async page write [ 141.587472] Buffer I/O error on dev nvme0n1, logical block 54193431, lost async page write [ 141.587478] Buffer I/O error on dev nvme0n1, logical block 54193432, lost async page write [ 141.587483] Buffer I/O error on dev nvme0n1, logical block 54193433, lost async page write [ 141.587532] Buffer I/O error on dev nvme0n1, logical block 54193476, lost async page write [ 141.587534] Buffer I/O error on dev nvme0n1, logical block 54193477, lost async page write [ 141.587536] Buffer I/O error on dev nvme0n1, logical block 54193478, lost async page write [ 141.587538] Buffer I/O error on dev nvme0n1, logical block 54193479, lost async page write [ 141.587540] Buffer I/O error on dev nvme0n1, logical block 54193480, lost async page write [ 141.587542] Buffer I/O error on dev nvme0n1, logical block 54193481, lost async page write [ 142.573522] nvme nvme0: Reconnecting in 10 seconds... [ 146.587532] buffer_io_error: 3743628 callbacks suppressed [ 146.587534] Buffer I/O error on dev nvme0n1, logical block 64832757, lost async page write [ 146.602837] Buffer I/O error on dev nvme0n1, logical block 64832758, lost async page write [ 146.612091] Buffer I/O error on dev nvme0n1, logical block 64832759, lost async page write [ 146.621346] Buffer I/O error on dev nvme0n1, logical block 64832760, lost async page write [ 146.630615] print_req_error: 556822 callbacks suppressed [ 146.630616] print_req_error: I/O error, dev nvme0n1, sector 518662176 [ 146.643776] Buffer I/O error on dev nvme0n1, logical block 64832772, lost async page write [ 146.653030] Buffer I/O error on dev nvme0n1, logical block 64832773, lost async page write [ 146.662282] Buffer I/O error on dev nvme0n1, logical block 64832774, lost async
Re: BUG at IP: blk_mq_get_request+0x23e/0x390 on 4.16.0-rc7
On 03/30/2018 12:32 PM, Yi Zhang wrote: Hello I got this kernel BUG on 4.16.0-rc7, here is the reproducer and log, let me know if you need more info, thanks. Reproducer: 1. setup target #nvmetcli restore /etc/rdma.json 2. connect target on host #nvme connect-all -t rdma -a $IP -s 4420during my NVMeoF RDMA testing 3. do fio background on host #fio -filename=/dev/nvme0n1 -iodepth=1 -thread -rw=randwrite -ioengine=psync -bssplit=5k/10:9k/10:13k/10:17k/10:21k/10:25k/10:29k/10:33k/10:37k/10:41k/10 -bs_unaligned -runtime=180 -size=-group_reporting -name=mytest -numjobs=60 & 4. offline cpu on host #echo 0 > /sys/devices/system/cpu/cpu1/online #echo 0 > /sys/devices/system/cpu/cpu2/online #echo 0 > /sys/devices/system/cpu/cpu3/online 5. clear target #nvmetcli clear 6. restore target #nvmetcli restore /etc/rdma.json 7. check console log on host Hi Yi, Does this happen with this applied? -- diff --git a/block/blk-mq-rdma.c b/block/blk-mq-rdma.c index 996167f1de18..b89da55e8aaa 100644 --- a/block/blk-mq-rdma.c +++ b/block/blk-mq-rdma.c @@ -35,6 +35,8 @@ int blk_mq_rdma_map_queues(struct blk_mq_tag_set *set, const struct cpumask *mask; unsigned int queue, cpu; + goto fallback; + for (queue = 0; queue < set->nr_hw_queues; queue++) { mask = ib_get_vector_affinity(dev, first_vec + queue); if (!mask) --