lkml.org 
[lkml]   [2016]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/3] acpi, nfit: add dimm device notification support
On Tue, Aug 23, 2016 at 2:54 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> Per "ACPI 6.1 Section 9.20.3" NVDIMM devices, children of the ACPI0012
> NVDIMM Root device, can receive health event notifications.
>
> Given that these devices are precluded from registering a notification
> handler via acpi_driver.acpi_device_ops (due to no _HID), we use
> acpi_install_notify_handler() directly. The registered handler,
> acpi_nvdimm_notify(), triggers a poll(2) event on the nmemX/nfit/flags
> sysfs attribute when a health event notification is received.
>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Toshi Kani <toshi.kani@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> drivers/acpi/nfit/core.c | 83 ++++++++++++++++++++++++++++++++++++++++++--
> drivers/acpi/nfit/nfit.h | 5 +++
> drivers/nvdimm/dimm_devs.c | 6 +++
> include/linux/libnvdimm.h | 1 +
> 4 files changed, 91 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 8120e8218f93..65f155db4283 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
[..]
> @@ -2400,6 +2464,7 @@ static int acpi_nfit_desc_init_scrub_attr(struct acpi_nfit_desc *acpi_desc)
>
> static void acpi_nfit_destruct(void *data)
> {
> + struct nfit_mem *nfit_mem;
> struct acpi_nfit_desc *acpi_desc = data;
> struct device *bus_dev = to_nvdimm_bus_dev(acpi_desc->nvdimm_bus);
>
> @@ -2415,6 +2480,16 @@ static void acpi_nfit_destruct(void *data)
> * either submit or see ->cancel set.
> */
> device_lock(bus_dev);
> + /*
> + * Clear out the nfit_mem->flags_attr and shut down dimm event
> + * notifications.
> + */
> + list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) {
> + sysfs_put(nfit_mem->flags_attr);
> + nfit_mem->flags_attr = NULL;

We need to check if flags_attr is NULL here in the case when the DIMM
failed to initialize. I believe the crash I am hitting is fixed by
Toshi's patch https://patchwork.kernel.org/patch/9284427/, but I'll
still fix this up for other cases.

\
 
 \ /
  Last update: 2016-09-17 09:58    [W:0.170 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site