]> Git Repo - linux.git/commitdiff
Merge tag 'wq-for-6.5-cleanup-ordered' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <[email protected]>
Tue, 27 Jun 2023 23:46:06 +0000 (16:46 -0700)
committerLinus Torvalds <[email protected]>
Tue, 27 Jun 2023 23:46:06 +0000 (16:46 -0700)
Pull ordered workqueue creation updates from Tejun Heo:
 "For historical reasons, unbound workqueues with max concurrency limit
  of 1 are considered ordered, even though the concurrency limit hasn't
  been system-wide for a long time.

  This creates ambiguity around whether ordered execution is actually
  required for correctness, which was actually confusing for e.g. btrfs
  (btrfs updates are being routed through the btrfs tree).

  There aren't that many users in the tree which use the combination and
  there are pending improvements to unbound workqueue affinity handling
  which will make inadvertent use of ordered workqueue a bigger loss.

  This clarifies the situation for most of them by updating the ones
  which require ordered execution to use alloc_ordered_workqueue().

  There are some conversions being routed through subsystem-specific
  trees and likely a few stragglers. Once they're all converted,
  workqueue can trigger a warning on unbound + @max_active==1 usages and
  eventually drop the implicit ordered behavior"

* tag 'wq-for-6.5-cleanup-ordered' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  rxrpc: Use alloc_ordered_workqueue() to create ordered workqueues
  net: qrtr: Use alloc_ordered_workqueue() to create ordered workqueues
  net: wwan: t7xx: Use alloc_ordered_workqueue() to create ordered workqueues
  dm integrity: Use alloc_ordered_workqueue() to create ordered workqueues
  media: amphion: Use alloc_ordered_workqueue() to create ordered workqueues
  scsi: NCR5380: Use default @max_active for hostdata->work_q
  media: coda: Use alloc_ordered_workqueue() to create ordered workqueues
  crypto: octeontx2: Use alloc_ordered_workqueue() to create ordered workqueues
  wifi: ath10/11/12k: Use alloc_ordered_workqueue() to create ordered workqueues
  wifi: mwifiex: Use default @max_active for workqueues
  wifi: iwlwifi: Use default @max_active for trans_pcie->rba.alloc_wq
  xen/pvcalls: Use alloc_ordered_workqueue() to create ordered workqueues
  virt: acrn: Use alloc_ordered_workqueue() to create ordered workqueues
  net: octeontx2: Use alloc_ordered_workqueue() to create ordered workqueues
  net: thunderx: Use alloc_ordered_workqueue() to create ordered workqueues
  greybus: Use alloc_ordered_workqueue() to create ordered workqueues
  powerpc, workqueue: Use alloc_ordered_workqueue() to create ordered workqueues

1  2 
drivers/md/dm.c
drivers/xen/pvcalls-back.c
net/rxrpc/af_rxrpc.c

diff --combined drivers/md/dm.c
index ae0a88defb415234a5bd80562cd848b58d745d72,9599d76cc9a95d7b7b9ead8d569243790ad41dfa..fe2d4750d9c7beba54e08c6aba83f16fd9ea3723
@@@ -207,7 -207,7 +207,7 @@@ static int __init local_init(void
        if (r)
                return r;
  
-       deferred_remove_workqueue = alloc_workqueue("kdmremove", WQ_UNBOUND, 1);
+       deferred_remove_workqueue = alloc_ordered_workqueue("kdmremove", 0);
        if (!deferred_remove_workqueue) {
                r = -ENOMEM;
                goto out_uevent_exit;
@@@ -310,13 -310,13 +310,13 @@@ int dm_deleting_md(struct mapped_devic
        return test_bit(DMF_DELETING, &md->flags);
  }
  
 -static int dm_blk_open(struct block_device *bdev, fmode_t mode)
 +static int dm_blk_open(struct gendisk *disk, blk_mode_t mode)
  {
        struct mapped_device *md;
  
        spin_lock(&_minor_lock);
  
 -      md = bdev->bd_disk->private_data;
 +      md = disk->private_data;
        if (!md)
                goto out;
  
@@@ -334,7 -334,7 +334,7 @@@ out
        return md ? 0 : -ENXIO;
  }
  
 -static void dm_blk_close(struct gendisk *disk, fmode_t mode)
 +static void dm_blk_close(struct gendisk *disk)
  {
        struct mapped_device *md;
  
@@@ -448,7 -448,7 +448,7 @@@ static void dm_unprepare_ioctl(struct m
        dm_put_live_table(md, srcu_idx);
  }
  
 -static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
 +static int dm_blk_ioctl(struct block_device *bdev, blk_mode_t mode,
                        unsigned int cmd, unsigned long arg)
  {
        struct mapped_device *md = bdev->bd_disk->private_data;
@@@ -734,7 -734,7 +734,7 @@@ static char *_dm_claim_ptr = "I belong 
   * Open a table device so we can use it as a map destination.
   */
  static struct table_device *open_table_device(struct mapped_device *md,
 -              dev_t dev, fmode_t mode)
 +              dev_t dev, blk_mode_t mode)
  {
        struct table_device *td;
        struct block_device *bdev;
                return ERR_PTR(-ENOMEM);
        refcount_set(&td->count, 1);
  
 -      bdev = blkdev_get_by_dev(dev, mode | FMODE_EXCL, _dm_claim_ptr);
 +      bdev = blkdev_get_by_dev(dev, mode, _dm_claim_ptr, NULL);
        if (IS_ERR(bdev)) {
                r = PTR_ERR(bdev);
                goto out_free_td;
        return td;
  
  out_blkdev_put:
 -      blkdev_put(bdev, mode | FMODE_EXCL);
 +      blkdev_put(bdev, _dm_claim_ptr);
  out_free_td:
        kfree(td);
        return ERR_PTR(r);
@@@ -784,14 -784,14 +784,14 @@@ static void close_table_device(struct t
  {
        if (md->disk->slave_dir)
                bd_unlink_disk_holder(td->dm_dev.bdev, md->disk);
 -      blkdev_put(td->dm_dev.bdev, td->dm_dev.mode | FMODE_EXCL);
 +      blkdev_put(td->dm_dev.bdev, _dm_claim_ptr);
        put_dax(td->dm_dev.dax_dev);
        list_del(&td->list);
        kfree(td);
  }
  
  static struct table_device *find_table_device(struct list_head *l, dev_t dev,
 -                                            fmode_t mode)
 +                                            blk_mode_t mode)
  {
        struct table_device *td;
  
        return NULL;
  }
  
 -int dm_get_table_device(struct mapped_device *md, dev_t dev, fmode_t mode,
 +int dm_get_table_device(struct mapped_device *md, dev_t dev, blk_mode_t mode,
                        struct dm_dev **result)
  {
        struct table_device *td;
@@@ -1172,8 -1172,7 +1172,8 @@@ static inline sector_t max_io_len_targe
  }
  
  static sector_t __max_io_len(struct dm_target *ti, sector_t sector,
 -                           unsigned int max_granularity)
 +                           unsigned int max_granularity,
 +                           unsigned int max_sectors)
  {
        sector_t target_offset = dm_target_offset(ti, sector);
        sector_t len = max_io_len_target_boundary(ti, target_offset);
        if (!max_granularity)
                return len;
        return min_t(sector_t, len,
 -              min(queue_max_sectors(ti->table->md->queue),
 +              min(max_sectors ? : queue_max_sectors(ti->table->md->queue),
                    blk_chunk_sectors_left(target_offset, max_granularity)));
  }
  
  static inline sector_t max_io_len(struct dm_target *ti, sector_t sector)
  {
 -      return __max_io_len(ti, sector, ti->max_io_len);
 +      return __max_io_len(ti, sector, ti->max_io_len, 0);
  }
  
  int dm_set_target_max_io_len(struct dm_target *ti, sector_t len)
@@@ -1582,13 -1581,12 +1582,13 @@@ static void __send_empty_flush(struct c
  
  static void __send_changing_extent_only(struct clone_info *ci, struct dm_target *ti,
                                        unsigned int num_bios,
 -                                      unsigned int max_granularity)
 +                                      unsigned int max_granularity,
 +                                      unsigned int max_sectors)
  {
        unsigned int len, bios;
  
        len = min_t(sector_t, ci->sector_count,
 -                  __max_io_len(ti, ci->sector, max_granularity));
 +                  __max_io_len(ti, ci->sector, max_granularity, max_sectors));
  
        atomic_add(num_bios, &ci->io->io_count);
        bios = __send_duplicate_bios(ci, ti, num_bios, &len);
@@@ -1625,27 -1623,23 +1625,27 @@@ static blk_status_t __process_abnormal_
  {
        unsigned int num_bios = 0;
        unsigned int max_granularity = 0;
 +      unsigned int max_sectors = 0;
        struct queue_limits *limits = dm_get_queue_limits(ti->table->md);
  
        switch (bio_op(ci->bio)) {
        case REQ_OP_DISCARD:
                num_bios = ti->num_discard_bios;
 +              max_sectors = limits->max_discard_sectors;
                if (ti->max_discard_granularity)
 -                      max_granularity = limits->max_discard_sectors;
 +                      max_granularity = max_sectors;
                break;
        case REQ_OP_SECURE_ERASE:
                num_bios = ti->num_secure_erase_bios;
 +              max_sectors = limits->max_secure_erase_sectors;
                if (ti->max_secure_erase_granularity)
 -                      max_granularity = limits->max_secure_erase_sectors;
 +                      max_granularity = max_sectors;
                break;
        case REQ_OP_WRITE_ZEROES:
                num_bios = ti->num_write_zeroes_bios;
 +              max_sectors = limits->max_write_zeroes_sectors;
                if (ti->max_write_zeroes_granularity)
 -                      max_granularity = limits->max_write_zeroes_sectors;
 +                      max_granularity = max_sectors;
                break;
        default:
                break;
        if (unlikely(!num_bios))
                return BLK_STS_NOTSUPP;
  
 -      __send_changing_extent_only(ci, ti, num_bios, max_granularity);
 +      __send_changing_extent_only(ci, ti, num_bios,
 +                                  max_granularity, max_sectors);
        return BLK_STS_OK;
  }
  
@@@ -2815,10 -2808,6 +2815,10 @@@ retry
        }
  
        map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock));
 +      if (!map) {
 +              /* avoid deadlock with fs/namespace.c:do_mount() */
 +              suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
 +      }
  
        r = __dm_suspend(md, map, suspend_flags, TASK_INTERRUPTIBLE, DMF_SUSPENDED);
        if (r)
index 7beaf2c41fbbbe6bc6f3822953bab275f2db26a4,b41516f3f84a82576bba7c1b097c7e19a14017bb..d52593466a792c966f1bb40259a447d92ab796be
@@@ -325,10 -325,8 +325,10 @@@ static struct sock_mapping *pvcalls_new
        void *page;
  
        map = kzalloc(sizeof(*map), GFP_KERNEL);
 -      if (map == NULL)
 +      if (map == NULL) {
 +              sock_release(sock);
                return NULL;
 +      }
  
        map->fedata = fedata;
        map->sock = sock;
        map->data.in = map->bytes;
        map->data.out = map->bytes + XEN_FLEX_RING_SIZE(map->ring_order);
  
-       map->ioworker.wq = alloc_workqueue("pvcalls_io", WQ_UNBOUND, 1);
+       map->ioworker.wq = alloc_ordered_workqueue("pvcalls_io", 0);
        if (!map->ioworker.wq)
                goto out;
        atomic_set(&map->io, 1);
@@@ -420,8 -418,10 +420,8 @@@ static int pvcalls_back_connect(struct 
                                        req->u.connect.ref,
                                        req->u.connect.evtchn,
                                        sock);
 -      if (!map) {
 +      if (!map)
                ret = -EFAULT;
 -              sock_release(sock);
 -      }
  
  out:
        rsp = RING_GET_RESPONSE(&fedata->ring, fedata->ring.rsp_prod_pvt++);
@@@ -561,6 -561,7 +561,6 @@@ static void __pvcalls_back_accept(struc
                                        sock);
        if (!map) {
                ret = -EFAULT;
 -              sock_release(sock);
                goto out_error;
        }
  
@@@ -636,7 -637,7 +636,7 @@@ static int pvcalls_back_bind(struct xen
  
        INIT_WORK(&map->register_work, __pvcalls_back_accept);
        spin_lock_init(&map->copy_lock);
-       map->wq = alloc_workqueue("pvcalls_wq", WQ_UNBOUND, 1);
+       map->wq = alloc_ordered_workqueue("pvcalls_wq", 0);
        if (!map->wq) {
                ret = -ENOMEM;
                goto out;
diff --combined net/rxrpc/af_rxrpc.c
index da0b3b5157d5f343f7ffac19882e3d3a0ea26ea1,7eb24c25c7315164c1d25155bcff52da5e319a3a..4c471fa7e09a8617687b73a9a7466e5743a65a30
@@@ -980,7 -980,6 +980,7 @@@ static int __init af_rxrpc_init(void
        BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof_field(struct sk_buff, cb));
  
        ret = -ENOMEM;
 +      rxrpc_gen_version_string();
        rxrpc_call_jar = kmem_cache_create(
                "rxrpc_call_jar", sizeof(struct rxrpc_call), 0,
                SLAB_HWCACHE_ALIGN, NULL);
                goto error_call_jar;
        }
  
-       rxrpc_workqueue = alloc_workqueue("krxrpcd", WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
+       rxrpc_workqueue = alloc_ordered_workqueue("krxrpcd", WQ_HIGHPRI | WQ_MEM_RECLAIM);
        if (!rxrpc_workqueue) {
                pr_notice("Failed to allocate work queue\n");
                goto error_work_queue;
This page took 0.140387 seconds and 4 git commands to generate.