Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'block-6.13-20241207' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

- NVMe pull request via Keith:
- Target fix using incorrect zero buffer (Nilay)
- Device specifc deallocate quirk fixes (Christoph, Keith)
- Fabrics fix for handling max command target bugs (Maurizio)
- Cocci fix usage for kzalloc (Yu-Chen)
- DMA size fix for host memory buffer feature (Christoph)
- Fabrics queue cleanup fixes (Chunguang)

- CPU hotplug ordering fixes

- Add missing MODULE_DESCRIPTION for rnull

- bcache error value fix

- virtio-blk queue freeze fix

* tag 'block-6.13-20241207' of git://git.kernel.dk/linux:
blk-mq: move cpuhp callback registering out of q->sysfs_lock
blk-mq: register cpuhp callback after hctx is added to xarray table
virtio-blk: don't keep queue frozen during system suspend
nvme-tcp: simplify nvme_tcp_teardown_io_queues()
nvme-tcp: no need to quiesce admin_q in nvme_tcp_teardown_io_queues()
nvme-rdma: unquiesce admin_q before destroy it
nvme-tcp: fix the memleak while create new ctrl failed
nvme-pci: don't use dma_alloc_noncontiguous with 0 merge boundary
nvmet: replace kmalloc + memset with kzalloc for data allocation
nvme-fabrics: handle zero MAXCMD without closing the connection
bcache: revert replacing IS_ERR_OR_NULL with IS_ERR again
nvme-pci: remove two deallocate zeroes quirks
block: rnull: add missing MODULE_DESCRIPTION
nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
nvmet: use kzalloc instead of ZERO_PAGE in nvme_execute_identify_ns_nvm()

+123 -47
+94 -14
block/blk-mq.c
··· 43 43 44 44 static DEFINE_PER_CPU(struct llist_head, blk_cpu_done); 45 45 static DEFINE_PER_CPU(call_single_data_t, blk_cpu_csd); 46 + static DEFINE_MUTEX(blk_mq_cpuhp_lock); 46 47 47 48 static void blk_mq_insert_request(struct request *rq, blk_insert_t flags); 48 49 static void blk_mq_request_bypass_insert(struct request *rq, ··· 3740 3739 return 0; 3741 3740 } 3742 3741 3743 - static void blk_mq_remove_cpuhp(struct blk_mq_hw_ctx *hctx) 3742 + static void __blk_mq_remove_cpuhp(struct blk_mq_hw_ctx *hctx) 3744 3743 { 3745 - if (!(hctx->flags & BLK_MQ_F_STACKING)) 3744 + lockdep_assert_held(&blk_mq_cpuhp_lock); 3745 + 3746 + if (!(hctx->flags & BLK_MQ_F_STACKING) && 3747 + !hlist_unhashed(&hctx->cpuhp_online)) { 3746 3748 cpuhp_state_remove_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE, 3747 3749 &hctx->cpuhp_online); 3748 - cpuhp_state_remove_instance_nocalls(CPUHP_BLK_MQ_DEAD, 3749 - &hctx->cpuhp_dead); 3750 + INIT_HLIST_NODE(&hctx->cpuhp_online); 3751 + } 3752 + 3753 + if (!hlist_unhashed(&hctx->cpuhp_dead)) { 3754 + cpuhp_state_remove_instance_nocalls(CPUHP_BLK_MQ_DEAD, 3755 + &hctx->cpuhp_dead); 3756 + INIT_HLIST_NODE(&hctx->cpuhp_dead); 3757 + } 3758 + } 3759 + 3760 + static void blk_mq_remove_cpuhp(struct blk_mq_hw_ctx *hctx) 3761 + { 3762 + mutex_lock(&blk_mq_cpuhp_lock); 3763 + __blk_mq_remove_cpuhp(hctx); 3764 + mutex_unlock(&blk_mq_cpuhp_lock); 3765 + } 3766 + 3767 + static void __blk_mq_add_cpuhp(struct blk_mq_hw_ctx *hctx) 3768 + { 3769 + lockdep_assert_held(&blk_mq_cpuhp_lock); 3770 + 3771 + if (!(hctx->flags & BLK_MQ_F_STACKING) && 3772 + hlist_unhashed(&hctx->cpuhp_online)) 3773 + cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE, 3774 + &hctx->cpuhp_online); 3775 + 3776 + if (hlist_unhashed(&hctx->cpuhp_dead)) 3777 + cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, 3778 + &hctx->cpuhp_dead); 3779 + } 3780 + 3781 + static void __blk_mq_remove_cpuhp_list(struct list_head *head) 3782 + { 3783 + struct blk_mq_hw_ctx *hctx; 3784 + 3785 + lockdep_assert_held(&blk_mq_cpuhp_lock); 3786 + 3787 + list_for_each_entry(hctx, head, hctx_list) 3788 + __blk_mq_remove_cpuhp(hctx); 3789 + } 3790 + 3791 + /* 3792 + * Unregister cpuhp callbacks from exited hw queues 3793 + * 3794 + * Safe to call if this `request_queue` is live 3795 + */ 3796 + static void blk_mq_remove_hw_queues_cpuhp(struct request_queue *q) 3797 + { 3798 + LIST_HEAD(hctx_list); 3799 + 3800 + spin_lock(&q->unused_hctx_lock); 3801 + list_splice_init(&q->unused_hctx_list, &hctx_list); 3802 + spin_unlock(&q->unused_hctx_lock); 3803 + 3804 + mutex_lock(&blk_mq_cpuhp_lock); 3805 + __blk_mq_remove_cpuhp_list(&hctx_list); 3806 + mutex_unlock(&blk_mq_cpuhp_lock); 3807 + 3808 + spin_lock(&q->unused_hctx_lock); 3809 + list_splice(&hctx_list, &q->unused_hctx_list); 3810 + spin_unlock(&q->unused_hctx_lock); 3811 + } 3812 + 3813 + /* 3814 + * Register cpuhp callbacks from all hw queues 3815 + * 3816 + * Safe to call if this `request_queue` is live 3817 + */ 3818 + static void blk_mq_add_hw_queues_cpuhp(struct request_queue *q) 3819 + { 3820 + struct blk_mq_hw_ctx *hctx; 3821 + unsigned long i; 3822 + 3823 + mutex_lock(&blk_mq_cpuhp_lock); 3824 + queue_for_each_hw_ctx(q, hctx, i) 3825 + __blk_mq_add_cpuhp(hctx); 3826 + mutex_unlock(&blk_mq_cpuhp_lock); 3750 3827 } 3751 3828 3752 3829 /* ··· 3875 3796 if (set->ops->exit_hctx) 3876 3797 set->ops->exit_hctx(hctx, hctx_idx); 3877 3798 3878 - blk_mq_remove_cpuhp(hctx); 3879 - 3880 3799 xa_erase(&q->hctx_table, hctx_idx); 3881 3800 3882 3801 spin_lock(&q->unused_hctx_lock); ··· 3891 3814 queue_for_each_hw_ctx(q, hctx, i) { 3892 3815 if (i == nr_queue) 3893 3816 break; 3817 + blk_mq_remove_cpuhp(hctx); 3894 3818 blk_mq_exit_hctx(q, set, hctx, i); 3895 3819 } 3896 3820 } ··· 3902 3824 { 3903 3825 hctx->queue_num = hctx_idx; 3904 3826 3905 - if (!(hctx->flags & BLK_MQ_F_STACKING)) 3906 - cpuhp_state_add_instance_nocalls(CPUHP_AP_BLK_MQ_ONLINE, 3907 - &hctx->cpuhp_online); 3908 - cpuhp_state_add_instance_nocalls(CPUHP_BLK_MQ_DEAD, &hctx->cpuhp_dead); 3909 - 3910 3827 hctx->tags = set->tags[hctx_idx]; 3911 3828 3912 3829 if (set->ops->init_hctx && 3913 3830 set->ops->init_hctx(hctx, set->driver_data, hctx_idx)) 3914 - goto unregister_cpu_notifier; 3831 + goto fail; 3915 3832 3916 3833 if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx, 3917 3834 hctx->numa_node)) ··· 3923 3850 exit_hctx: 3924 3851 if (set->ops->exit_hctx) 3925 3852 set->ops->exit_hctx(hctx, hctx_idx); 3926 - unregister_cpu_notifier: 3927 - blk_mq_remove_cpuhp(hctx); 3853 + fail: 3928 3854 return -1; 3929 3855 } 3930 3856 ··· 3949 3877 INIT_DELAYED_WORK(&hctx->run_work, blk_mq_run_work_fn); 3950 3878 spin_lock_init(&hctx->lock); 3951 3879 INIT_LIST_HEAD(&hctx->dispatch); 3880 + INIT_HLIST_NODE(&hctx->cpuhp_dead); 3881 + INIT_HLIST_NODE(&hctx->cpuhp_online); 3952 3882 hctx->queue = q; 3953 3883 hctx->flags = set->flags & ~BLK_MQ_F_TAG_QUEUE_SHARED; 3954 3884 ··· 4489 4415 xa_for_each_start(&q->hctx_table, j, hctx, j) 4490 4416 blk_mq_exit_hctx(q, set, hctx, j); 4491 4417 mutex_unlock(&q->sysfs_lock); 4418 + 4419 + /* unregister cpuhp callbacks for exited hctxs */ 4420 + blk_mq_remove_hw_queues_cpuhp(q); 4421 + 4422 + /* register cpuhp for new initialized hctxs */ 4423 + blk_mq_add_hw_queues_cpuhp(q); 4492 4424 } 4493 4425 4494 4426 int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
+1
drivers/block/rnull.rs
··· 28 28 type: NullBlkModule, 29 29 name: "rnull_mod", 30 30 author: "Andreas Hindborg", 31 + description: "Rust implementation of the C null block driver", 31 32 license: "GPL v2", 32 33 } 33 34
+5 -2
drivers/block/virtio_blk.c
··· 1586 1586 static int virtblk_freeze(struct virtio_device *vdev) 1587 1587 { 1588 1588 struct virtio_blk *vblk = vdev->priv; 1589 + struct request_queue *q = vblk->disk->queue; 1589 1590 1590 1591 /* Ensure no requests in virtqueues before deleting vqs. */ 1591 - blk_mq_freeze_queue(vblk->disk->queue); 1592 + blk_mq_freeze_queue(q); 1593 + blk_mq_quiesce_queue_nowait(q); 1594 + blk_mq_unfreeze_queue(q); 1592 1595 1593 1596 /* Ensure we don't receive any more interrupts */ 1594 1597 virtio_reset_device(vdev); ··· 1615 1612 return ret; 1616 1613 1617 1614 virtio_device_ready(vdev); 1615 + blk_mq_unquiesce_queue(vblk->disk->queue); 1618 1616 1619 - blk_mq_unfreeze_queue(vblk->disk->queue); 1620 1617 return 0; 1621 1618 } 1622 1619 #endif
+1 -1
drivers/md/bcache/super.c
··· 1718 1718 if (!IS_ERR_OR_NULL(c->gc_thread)) 1719 1719 kthread_stop(c->gc_thread); 1720 1720 1721 - if (!IS_ERR(c->root)) 1721 + if (!IS_ERR_OR_NULL(c->root)) 1722 1722 list_add(&c->root->list, &c->btree_cache); 1723 1723 1724 1724 /*
+5 -3
drivers/nvme/host/core.c
··· 2071 2071 lim->physical_block_size = min(phys_bs, atomic_bs); 2072 2072 lim->io_min = phys_bs; 2073 2073 lim->io_opt = io_opt; 2074 - if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) 2074 + if ((ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) && 2075 + (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM)) 2075 2076 lim->max_write_zeroes_sectors = UINT_MAX; 2076 2077 else 2077 2078 lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors; ··· 3261 3260 } 3262 3261 3263 3262 if (!ctrl->maxcmd) { 3264 - dev_err(ctrl->device, "Maximum outstanding commands is 0\n"); 3265 - return -EINVAL; 3263 + dev_warn(ctrl->device, 3264 + "Firmware bug: maximum outstanding commands is 0\n"); 3265 + ctrl->maxcmd = ctrl->sqsize + 1; 3266 3266 } 3267 3267 3268 3268 return 0;
+3 -4
drivers/nvme/host/pci.c
··· 2172 2172 2173 2173 static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred) 2174 2174 { 2175 + unsigned long dma_merge_boundary = dma_get_merge_boundary(dev->dev); 2175 2176 u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES); 2176 2177 u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2); 2177 2178 u64 chunk_size; ··· 2181 2180 * If there is an IOMMU that can merge pages, try a virtually 2182 2181 * non-contiguous allocation for a single segment first. 2183 2182 */ 2184 - if (!(PAGE_SIZE & dma_get_merge_boundary(dev->dev))) { 2183 + if (dma_merge_boundary && (PAGE_SIZE & dma_merge_boundary) == 0) { 2185 2184 if (!nvme_alloc_host_mem_single(dev, preferred)) 2186 2185 return 0; 2187 2186 } ··· 3589 3588 NVME_QUIRK_DEALLOCATE_ZEROES, }, 3590 3589 { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ 3591 3590 .driver_data = NVME_QUIRK_STRIPE_SIZE | 3592 - NVME_QUIRK_DEALLOCATE_ZEROES | 3593 3591 NVME_QUIRK_IGNORE_DEV_SUBNQN | 3594 3592 NVME_QUIRK_BOGUS_NID, }, 3595 3593 { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ 3596 - .driver_data = NVME_QUIRK_STRIPE_SIZE | 3597 - NVME_QUIRK_DEALLOCATE_ZEROES, }, 3594 + .driver_data = NVME_QUIRK_STRIPE_SIZE, }, 3598 3595 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ 3599 3596 .driver_data = NVME_QUIRK_NO_DEEPEST_PS | 3600 3597 NVME_QUIRK_MEDIUM_PRIO_SQ |
+1 -7
drivers/nvme/host/rdma.c
··· 1091 1091 } 1092 1092 destroy_admin: 1093 1093 nvme_stop_keep_alive(&ctrl->ctrl); 1094 - nvme_quiesce_admin_queue(&ctrl->ctrl); 1095 - blk_sync_queue(ctrl->ctrl.admin_q); 1096 - nvme_rdma_stop_queue(&ctrl->queues[0]); 1097 - nvme_cancel_admin_tagset(&ctrl->ctrl); 1098 - if (new) 1099 - nvme_remove_admin_tag_set(&ctrl->ctrl); 1100 - nvme_rdma_destroy_admin_queue(ctrl); 1094 + nvme_rdma_teardown_admin_queue(ctrl, new); 1101 1095 return ret; 1102 1096 } 1103 1097
+5 -12
drivers/nvme/host/tcp.c
··· 2101 2101 return ret; 2102 2102 } 2103 2103 2104 - static void nvme_tcp_destroy_admin_queue(struct nvme_ctrl *ctrl, bool remove) 2105 - { 2106 - nvme_tcp_stop_queue(ctrl, 0); 2107 - if (remove) 2108 - nvme_remove_admin_tag_set(ctrl); 2109 - nvme_tcp_free_admin_queue(ctrl); 2110 - } 2111 - 2112 2104 static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new) 2113 2105 { 2114 2106 int error; ··· 2155 2163 blk_sync_queue(ctrl->admin_q); 2156 2164 nvme_tcp_stop_queue(ctrl, 0); 2157 2165 nvme_cancel_admin_tagset(ctrl); 2158 - if (remove) 2166 + if (remove) { 2159 2167 nvme_unquiesce_admin_queue(ctrl); 2160 - nvme_tcp_destroy_admin_queue(ctrl, remove); 2168 + nvme_remove_admin_tag_set(ctrl); 2169 + } 2170 + nvme_tcp_free_admin_queue(ctrl); 2161 2171 if (ctrl->tls_pskid) { 2162 2172 dev_dbg(ctrl->device, "Wipe negotiated TLS_PSK %08x\n", 2163 2173 ctrl->tls_pskid); ··· 2172 2178 { 2173 2179 if (ctrl->queue_count <= 1) 2174 2180 return; 2175 - nvme_quiesce_admin_queue(ctrl); 2176 2181 nvme_quiesce_io_queues(ctrl); 2177 2182 nvme_sync_io_queues(ctrl); 2178 2183 nvme_tcp_stop_io_queues(ctrl); ··· 2271 2278 } 2272 2279 destroy_admin: 2273 2280 nvme_stop_keep_alive(ctrl); 2274 - nvme_tcp_teardown_admin_queue(ctrl, false); 2281 + nvme_tcp_teardown_admin_queue(ctrl, new); 2275 2282 return ret; 2276 2283 } 2277 2284
+7 -2
drivers/nvme/target/admin-cmd.c
··· 902 902 static void nvme_execute_identify_ns_nvm(struct nvmet_req *req) 903 903 { 904 904 u16 status; 905 + struct nvme_id_ns_nvm *id; 905 906 906 907 status = nvmet_req_find_ns(req); 907 908 if (status) 908 909 goto out; 909 910 910 - status = nvmet_copy_to_sgl(req, 0, ZERO_PAGE(0), 911 - NVME_IDENTIFY_DATA_SIZE); 911 + id = kzalloc(sizeof(*id), GFP_KERNEL); 912 + if (!id) { 913 + status = NVME_SC_INTERNAL; 914 + goto out; 915 + } 916 + status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); 912 917 out: 913 918 nvmet_req_complete(req, status); 914 919 }
+1 -2
drivers/nvme/target/pr.c
··· 828 828 goto out; 829 829 } 830 830 831 - data = kmalloc(num_bytes, GFP_KERNEL); 831 + data = kzalloc(num_bytes, GFP_KERNEL); 832 832 if (!data) { 833 833 status = NVME_SC_INTERNAL; 834 834 goto out; 835 835 } 836 - memset(data, 0, num_bytes); 837 836 data->gen = cpu_to_le32(atomic_read(&pr->generation)); 838 837 data->ptpls = 0; 839 838 ctrl_eds = data->regctl_eds;