From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: akpm@linux-foundation.org, Logan Gunthorpe <logang@deltatee.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Christoph Hellwig <hch@lst.de>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Ira Weiny <ira.weiny@intel.com>,
linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org,
linux-mm@kvack.org
Subject: Re: [PATCH v2 1/6] drivers/base/devres: Introduce devm_release_action()
Date: Tue, 14 May 2019 21:12:43 +0200 [thread overview]
Message-ID: <20190514191243.GA17226@kroah.com> (raw)
In-Reply-To: <155727336530.292046.2926860263201336366.stgit@dwillia2-desk3.amr.corp.intel.com>
On Tue, May 07, 2019 at 04:56:05PM -0700, Dan Williams wrote:
> The devm_add_action() facility allows a resource allocation routine to
> add custom devm semantics. One such user is devm_memremap_pages().
>
> There is now a need to manually trigger devm_memremap_pages_release().
> Introduce devm_release_action() so the release action can be triggered
> via a new devm_memunmap_pages() api in a follow-on change.
>
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> drivers/base/devres.c | 24 +++++++++++++++++++++++-
> include/linux/device.h | 1 +
> 2 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
> index e038e2b3b7ea..0bbb328bd17f 100644
> --- a/drivers/base/devres.c
> +++ b/drivers/base/devres.c
> @@ -755,10 +755,32 @@ void devm_remove_action(struct device *dev, void (*action)(void *), void *data)
>
> WARN_ON(devres_destroy(dev, devm_action_release, devm_action_match,
> &devres));
> -
> }
> EXPORT_SYMBOL_GPL(devm_remove_action);
>
> +/**
> + * devm_release_action() - release previously added custom action
> + * @dev: Device that owns the action
> + * @action: Function implementing the action
> + * @data: Pointer to data passed to @action implementation
> + *
> + * Releases and removes instance of @action previously added by
> + * devm_add_action(). Both action and data should match one of the
> + * existing entries.
> + */
> +void devm_release_action(struct device *dev, void (*action)(void *), void *data)
> +{
> + struct action_devres devres = {
> + .data = data,
> + .action = action,
> + };
> +
> + WARN_ON(devres_release(dev, devm_action_release, devm_action_match,
> + &devres));
What does WARN_ON help here? are we going to start getting syzbot
reports of this happening?
How can this fail?
thanks,
greg k-h
next prev parent reply other threads:[~2019-05-14 19:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 23:55 [PATCH v2 0/6] mm/devm_memremap_pages: Fix page release race Dan Williams
2019-05-07 23:56 ` [PATCH v2 1/6] drivers/base/devres: Introduce devm_release_action() Dan Williams
2019-05-14 19:12 ` Greg Kroah-Hartman [this message]
2019-05-14 19:24 ` Dan Williams
2019-05-07 23:56 ` [PATCH v2 2/6] mm/devm_memremap_pages: Introduce devm_memunmap_pages Dan Williams
2019-05-07 23:56 ` [PATCH v2 3/6] PCI/P2PDMA: Fix the gen_pool_add_virt() failure path Dan Williams
2019-05-07 23:56 ` [PATCH v2 4/6] lib/genalloc: Introduce chunk owners Dan Williams
2019-05-07 23:56 ` [PATCH v2 5/6] PCI/P2PDMA: Track pgmap references per resource, not globally Dan Williams
2019-05-07 23:56 ` [PATCH v2 6/6] mm/devm_memremap_pages: Fix final page put race Dan Williams
2019-05-08 17:05 ` [PATCH v2 0/6] mm/devm_memremap_pages: Fix page release race Logan Gunthorpe
2019-05-13 19:22 ` Logan Gunthorpe
2019-05-14 18:51 ` Jane Chu
2019-05-14 19:04 ` Dan Williams
2019-05-14 21:18 ` Jane Chu
2019-05-16 16:45 ` Jane Chu
2019-05-16 21:42 ` jane.chu
2019-05-16 21:51 ` Dan Williams
2019-05-17 0:01 ` Jane Chu
2019-05-31 4:17 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190514191243.GA17226@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=ira.weiny@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=logang@deltatee.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox