[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <161117153248.2853729.2452425259045172318.stgit@dwillia2-desk3.amr.corp.intel.com>
Date: Wed, 20 Jan 2021 11:38:52 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: gregkh@...uxfoundation.org
Cc: Ira Weiny <ira.weiny@...el.com>, Dave Jiang <dave.jiang@...el.com>,
Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Vishal Verma <vishal.l.verma@...el.com>,
Logan Gunthorpe <logang@...tatee.com>,
Hans Verkuil <hans.verkuil@...co.com>, logang@...tatee.com,
linux-kernel@...r.kernel.org, linux-nvdimm@...ts.01.org
Subject: [PATCH 0/3] cdev: Generic shutdown handling
After reviewing driver submissions with new cdev + ioctl usages one
common stumbling block is coordinating the shutdown of the ioctl path,
or other file operations, at driver ->remove() time. While cdev_del()
guarantees that no new file descriptors will be established, operations
on existing file descriptors can proceed indefinitely.
Given the observation that the kernel spends the resources for a percpu_ref
per request_queue shared with all block_devices on a gendisk, do the
same for all the cdev instances that share the same
cdev_add()-to-cdev_del() lifetime.
With this in place cdev_del() not only guarantees 'no new opens', but it
also guarantees 'no new operations invocations' and 'all threads running
in an operation handler have exited that handler'.
As a proof point of the way driver implementations open-code around this
gap in the api the libnvdimm ioctl path is reworked with a result of:
4 files changed, 101 insertions(+), 153 deletions(-)
---
Dan Williams (3):
cdev: Finish the cdev api with queued mode support
libnvdimm/ida: Switch to non-deprecated ida helpers
libnvdimm/ioctl: Switch to cdev_register_queued()
drivers/nvdimm/btt_devs.c | 6 +
drivers/nvdimm/bus.c | 177 +++++++++------------------------------
drivers/nvdimm/core.c | 14 ++-
drivers/nvdimm/dax_devs.c | 4 -
drivers/nvdimm/dimm_devs.c | 53 +++++++++---
drivers/nvdimm/namespace_devs.c | 14 +--
drivers/nvdimm/nd-core.h | 14 ++-
drivers/nvdimm/pfn_devs.c | 4 -
fs/char_dev.c | 108 ++++++++++++++++++++++--
include/linux/cdev.h | 21 ++++-
10 files changed, 238 insertions(+), 177 deletions(-)
Powered by blists - more mailing lists