From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: stuart hayes <stuart.w.hayes@gmail.com>,
linux-pci@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Bjorn Helgaas <bhelgaas@google.com>,
Dan Williams <dan.j.williams@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>,
Keith Busch <kbusch@kernel.org>, Marek Behun <marek.behun@nic.cz>,
Pavel Machek <pavel@ucw.cz>, Randy Dunlap <rdunlap@infradead.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v2 2/3] PCI/NPEM: Add Native PCIe Enclosure Management support
Date: Tue, 18 Jun 2024 10:56:53 +0200 [thread overview]
Message-ID: <20240618105653.0000796d@linux.intel.com> (raw)
In-Reply-To: <Zm1uCa_l98yFXYqf@wunner.de>
On Sat, 15 Jun 2024 12:33:45 +0200
Lukas Wunner <lukas@wunner.de> wrote:
> On Fri, Jun 14, 2024 at 04:06:14PM -0500, stuart hayes wrote:
> > On 5/28/2024 8:19 AM, Mariusz Tkaczyk wrote:
> > > +static int pci_npem_init(struct pci_dev *dev, const struct npem_ops *ops,
> > > + int pos, u32 caps)
> > > +{
> [...]
> > > + ret = ops->get_active_indications(npem, &active);
> > > + if (ret) {
> > > + npem_free(npem);
> > > + return -EACCES;
> > > + }
> >
> > Failing pci_npem_init() if this ops->get_active_indications() fails
> > will keep this from working on most (all?) Dell servers, because the
> > _DSM get/set functions use an IPMI operation region to get/set the
> > active LEDs, and this is getting run before the IPMI drivers and
> > acpi_ipmi module (which provides ACPI access to IPMI operation
> > regions) get loaded. (GET_SUPPORTED_STATES works without IPMI.)
>
> CONFIG_ACPI_IPMI is tristate. Even if it's built-in, the
> module_initcall() becomes a device_initcall().
>
> PCI enumeration happens from a subsys_initcall(), way earlier
> than device_initcall().
>
> If you set CONFIG_ACPI_IPMI=y and change the module_initcall() in
> drivers/acpi/acpi_ipmi.c to arch_initcall(), does the issue go away?
That seems to be the best option. Please test Lukas proposal and let me know.
Shouldn't I make a dependency to ACPI_IPMI in Kconfig (with optional comment
about initcall)?
+config PCI_NPEM
+ bool "Native PCIe Enclosure Management"
+ depends on LEDS_CLASS=y
+ depends on ACPI_IPMI=y
>
>
> > (2) providing a mechanism to trigger this driver to rescan a PCI
> > device later from user space
>
> If this was a regular device driver and -EPROBE_DEFER was returned if
> IPMI drivers aren't loaded yet, then this would be easy to solve.
> But neither is the case here.
>
> Of course it's possible to exercise the "remove" and "rescan" attributes
> in sysfs to re-enumerate the device but that's not a great solution.
We cannot expect from users to know and do that. If we cannot configure driver,
we should not register it. We have to guarantee that IMPI commands are
available at the point we are using them.
There is not better place to add _DSM device than its enumeration and I have a
feeling than sooner or later someone else will reach this problem so it would
be better for community to solve it now.
>
>
> > (3) don't cache the active LEDs--just get the active states using
> > NPEM/DSM when brightness is read, and do a get/modify/set when
> > setting the brightness... then get_active_indications() wouldn't
> > need to be called during init.
>
> Not good. The LEDs are published in sysfs from a subsys_initcall().
> Brightness changes through sysfs could in theory immediately happen
> once they're published. If acpi_ipmi is a module and gets loaded way
> later, we'd still have to cope with Set State or Get State DSMs going
> nowhere.
>
Agree. I can do it and it should be safe but it is not addressing the issue.
We would limit time race window but we will not close it.
Thanks,
Mariusz
next prev parent reply other threads:[~2024-06-18 8:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 13:19 [PATCH v2 0/3] PCIe Enclosure LED Management Mariusz Tkaczyk
2024-05-28 13:19 ` [PATCH v2 1/3] leds: Init leds class earlier Mariusz Tkaczyk
2024-05-29 4:22 ` Dan Williams
2024-06-14 14:08 ` Lukas Wunner
2024-06-14 14:13 ` Greg Kroah-Hartman
2024-05-28 13:19 ` [PATCH v2 2/3] PCI/NPEM: Add Native PCIe Enclosure Management support Mariusz Tkaczyk
2024-05-28 13:55 ` Ilpo Järvinen
2024-06-14 13:40 ` Mariusz Tkaczyk
2024-05-29 5:21 ` Dan Williams
2024-05-29 9:38 ` Lukas Wunner
2024-06-12 11:40 ` Mariusz Tkaczyk
2024-06-13 16:11 ` stuart hayes
2024-06-19 14:28 ` Mariusz Tkaczyk
2024-06-14 21:06 ` stuart hayes
2024-06-15 10:33 ` Lukas Wunner
2024-06-18 8:56 ` Mariusz Tkaczyk [this message]
2024-06-18 17:13 ` Lukas Wunner
2024-06-18 18:50 ` stuart hayes
2024-06-18 19:32 ` Dan Williams
2024-06-19 9:08 ` Lukas Wunner
2024-06-19 12:07 ` Mariusz Tkaczyk
2024-05-28 13:19 ` [PATCH v2 3/3] PCI/NPEM: Add _DSM PCIe SSD status LED management Mariusz Tkaczyk
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=20240618105653.0000796d@linux.intel.com \
--to=mariusz.tkaczyk@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kbusch@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=marek.behun@nic.cz \
--cc=pavel@ucw.cz \
--cc=rdunlap@infradead.org \
--cc=stuart.w.hayes@gmail.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