On Tue, Aug 23, 2016 at 2:54 PM, Dan Williams <dan.j.williams@xxxxxxxxx> 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@xxxxxxxxx> > Cc: Toshi Kani <toshi.kani@xxxxxxx> > Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx> > --- > 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. -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html