public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Michal Wilczynski <michal.wilczynski@intel.com>,
	<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<nvdimm@lists.linux.dev>
Cc: <rafael.j.wysocki@intel.com>, <andriy.shevchenko@intel.com>,
	<lenb@kernel.org>, <dan.j.williams@intel.com>,
	<vishal.l.verma@intel.com>, <ira.weiny@intel.com>,
	Michal Wilczynski <michal.wilczynski@intel.com>
Subject: RE: [PATCH v2 5/6] ACPI: NFIT: Replace acpi_driver with platform_driver
Date: Tue, 17 Oct 2023 11:24:21 -0700	[thread overview]
Message-ID: <652ed155ef8e_780ef294f@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20231006173055.2938160-6-michal.wilczynski@intel.com>

Michal Wilczynski wrote:
> NFIT driver uses struct acpi_driver incorrectly to register itself.
> This is wrong as the instances of the ACPI devices are not meant
> to be literal devices, they're supposed to describe ACPI entry of a
> particular device.
> 
> Use platform_driver instead of acpi_driver. In relevant places call
> platform devices instances pdev to make a distinction with ACPI
> devices instances.
> 
> NFIT driver uses devm_*() family of functions extensively. This change
> has no impact on correct functioning of the whole devm_*() family of
> functions, since the lifecycle of the device stays the same. It is still
> being created during the enumeration, and destroyed on platform device
> removal.

I notice this verbiage has the same fundamental misunderstanding of devm
allocation lifetime as the acpi_nfit_init_interleave_set() discussion.
The devm allocation lifetime typically starts in driver->probe() and
ends either with driver->probe() failure, or the driver->remove() call.
Note that the driver->remove() call is invoked not only for
platform-device removal, but also driver "unbind" events. So the
"destroyed on platform device removal" is the least likely way that
these allocations are torn down given ACPI0012 devices are never
removed.

Outside of that, my main concern about this patch is that I expect it
breaks unit tests. The infrastructure in
tools/testing/nvdimm/test/nfit.c emulates an ACPI0012 device that allows
for deeper regression testing given hardware is difficult to come by,
and because QEMU does not implement some of the tricky corner cases that
the unit tests cover.

This needs to pass tests, but fair warning, 
tools/testing/nvdimm/test/nfit.c does some non-idiomatic + "strange"
things to achieve deeper test coverage. So I expect that if this breaks
tests as I expect the effort needed to fix the emulation could be
significant.

If you want to give running the tests a try the easiest would be to use
"run_qemu.sh" with --nfit-test option [1], or you can try to setup an
environment manually using the ndctl instructions [2].

[1]: https://github.com/pmem/run_qemu
[2]: https://github.com/pmem/ndctl#readme

  parent reply	other threads:[~2023-10-17 18:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 17:30 [PATCH v2 0/6] Replace acpi_driver with platform_driver Michal Wilczynski
2023-10-06 17:30 ` [PATCH v2 1/6] ACPI: AC: Remove unnecessary checks Michal Wilczynski
2023-10-06 17:30 ` [PATCH v2 2/6] ACPI: AC: Use string_choices API instead of ternary operator Michal Wilczynski
2023-10-06 17:30 ` [PATCH v2 3/6] ACPI: AC: Replace acpi_driver with platform_driver Michal Wilczynski
2023-10-06 17:45   ` Andy Shevchenko
2023-10-06 19:47   ` Rafael J. Wysocki
2023-10-07  7:56     ` Andy Shevchenko
2023-10-07 10:41       ` Rafael J. Wysocki
2023-10-07 10:43         ` Rafael J. Wysocki
2023-10-09  8:40           ` Wilczynski, Michal
2023-10-09 12:27             ` Rafael J. Wysocki
2023-10-09 13:03               ` Wilczynski, Michal
2023-10-09 17:51                 ` Rafael J. Wysocki
2023-10-06 17:30 ` [PATCH v2 4/6] ACPI: AC: Rename ACPI device from device to adev Michal Wilczynski
2023-10-06 17:30 ` [PATCH v2 5/6] ACPI: NFIT: Replace acpi_driver with platform_driver Michal Wilczynski
2023-10-17  8:51   ` Wilczynski, Michal
2023-10-17 10:55     ` Rafael J. Wysocki
2023-10-17 14:06   ` Rafael J. Wysocki
2023-10-17 18:24   ` Dan Williams [this message]
2023-10-18 15:38     ` Wilczynski, Michal
2023-10-06 17:30 ` [PATCH v2 6/6] ACPI: NFIT: Remove redundant call to to_acpi_dev() Michal Wilczynski

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=652ed155ef8e_780ef294f@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.wilczynski@intel.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=rafael.j.wysocki@intel.com \
    --cc=vishal.l.verma@intel.com \
    /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