From: Hans de Goede <hdegoede@redhat.com>
To: "Schmauss, Erik" <erik.schmauss@intel.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>,
"Moore, Robert" <robert.moore@intel.com>,
"Zheng, Lv" <lv.zheng@intel.com>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"devel@acpica.org" <devel@acpica.org>
Subject: Re: ACPI: Do not call _STA on battery devices with unmet dependencies
Date: Fri, 26 Jan 2018 16:46:31 +0100 [thread overview]
Message-ID: <c4fcb0b6-fbcc-18e7-9053-3c73d83863cc@redhat.com> (raw)
In-Reply-To: <CF6A88132359CE47947DB4C6E1709ED5396D7178@ORSMSX110.amr.corp.intel.com>
Hi,
On 01/23/2018 01:24 AM, Schmauss, Erik wrote:
> Hi,
>> -----Original Message-----
>> From: Hans de Goede [mailto:hdegoede@redhat.com]
>> Sent: Saturday, January 20, 2018 4:48 AM
>> To: Schmauss, Erik <erik.schmauss@intel.com>
>> Cc: Rafael J . Wysocki <rjw@rjwysocki.net>; Len Brown <lenb@kernel.org>;
>> Bjorn Helgaas <bhelgaas@google.com>; Moore, Robert
>> <robert.moore@intel.com>; Zheng, Lv <lv.zheng@intel.com>; linux-
>> acpi@vger.kernel.org; linux-pci@vger.kernel.org; devel@acpica.org
>> Subject: Re: ACPI: Do not call _STA on battery devices with unmet dependencies
>>
>> Hi,
>>
>> On 19-01-18 22:03, Schmauss, Erik wrote:
>>>
>>>> -----Original Message-----
>>>> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
>>>> owner@vger.kernel.org] On Behalf Of Bjorn Helgaas
>>>> Sent: Thursday, January 18, 2018 11:11 AM
>>>> To: Hans de Goede <hdegoede@redhat.com>
>>>> Cc: Rafael J . Wysocki <rjw@rjwysocki.net>; Len Brown
>>>> <lenb@kernel.org>; Bjorn Helgaas <bhelgaas@google.com>; Moore, Robert
>>>> <robert.moore@intel.com>; Zheng, Lv <lv.zheng@intel.com>; linux-
>>>> acpi@vger.kernel.org; linux-pci@vger.kernel.org; devel@acpica.org
>>>> Subject: Re: ACPI: Do not call _STA on battery devices with unmet
>>>> dependencies
>>>>
>>>> On Thu, Jan 18, 2018 at 05:03:55PM +0100, Hans de Goede wrote:
>>>
>>> Hi Hans,
>>>
>>>>> Hi All,
>>>>>
>>>>> The ACPI code already contains quite a bit of code to not bind theFrom the acpi_get_object_info() documentation in drivers/acpi/acpica/nsxfname.c:
* Note: This interface is intended to be used during the initial device
* discovery namespace traversal. Therefore, no complex methods can be
* executed, especially those that access operation regions.
>>>>> ACPI-battery until all deps for an ACPI battery device have been
>>>>> met, but on some devices calling _STA before all deps are met is a
>>>>> problem too because the _STA method uses an i2c OpRegion there.
>>>
>>> Could you explain why _STA method using an I2C OpRegion is problematic?
>>
>> It is problematic if we call the _STA method before the handler for the OpRegion
>> has been installed, this series delays / avoids calling _STA before the OpRegion
>> has been installed.
>
> Thanks for the explanation.
> I'm looking at the ACPI spec and from what it said about _STA, I gathered that _STA is allowed to have side-effects to named objects within the AML namespace. So removing _STA from acpi_get_object_info seems a little dangerous... Is there a reason why you cannot remove or delay the call to acpi_get_object_info instead? Chapter 6 section 1 of the ACPI spec also states that it's possible for _HID and _ADR to read from operation regions as well. Is it common convention that these _HID and _ADR objects do not access operation regions?
From the acpi_get_object_info() documentation in drivers/acpi/acpica/nsxfname.c:
* Note: This interface is intended to be used during the initial device
* discovery namespace traversal. Therefore, no complex methods can be
* executed, especially those that access operation regions.
So if _STA can have side-effects then that seems like another reason to NOT
call it from acpi_get_object_info().
If something depends on the side-effects (which I doubt) then the code which
depends on it should really call _STA explicitly itself.
Regards,
Hans
>>>>> Here is the DSDT of the device I'm seeing this on:
>>>>> https://fedorapeople.org/~jwrdegoede/toshiba-click-mini-dsdt.dsl
>>>>
>>>> This looks like interesting info, but (a) this link isn't mentioned
>>>> in the actual patches, and (b) it's conceivable that fedorapeople.org could go
>> away someday.
>>>> If this were a PCI series, I would suggest opening a report at
>>>> bugzilla.kernel.org, attaching the DSL there, and including the link in the
>> patch changelog.
>>>>
>>>>> This series modifies the kernel to not call _STA until all deps are
>>>>> met, mirroring the binding behavior of the battery driver.
>>>>>
>>>>> Without this series a total of 32 ACPI errors get printend to the
>>>>> console on boot, there are 4 errors per _STA call, 2 battery devices
>>>>> on this system and 4 _STA calls per battery device.
>>>>>
>>>>> The first commit is a preparation commit for making the ACPICA
>>>>> changes in the 4th commit, this commit is necessary to not break
>>>>> things after the ACPICA changes.
>>>>>
>>>>> The second commit modifies acpi_bus_get_status to not call _STA on
>>>>> battery devices until all deps are met. This fixes 2 of the 4 too
>>>>> early _STA calls triggering these errors.
>>>>>
>>>>> The third commit makes the device instantiation code use
>>>>> acpi_bus_get_status instead of acpi_bus_get_status_handle so that
>>>>> the code to get the initial status also does not makes 1 too early _STA call.
>>>>>
>>>>> The fourth commit changes the ACPICA acpi_get_object_info function
>>>>> to not call _STA. Only 1 user (which is fixed in the first commit)
>>>>> cares about acpi_device_info.current_status. And the ACPICA code has
>>>>> this
>>>> comment:
>>>>>
>>>>> * Note: This interface is intended to be used during the initial
>>>>> device
>>>>> * discovery namespace traversal. Therefore, no complex methods can be
>>>>> * executed, especially those that access operation regions.
>>>>> Therefore, do
>>>>> * not add any additional methods that could cause problems in this area.
>>>>> * Because of this reason support for the following methods has
>>>>> been
>>>> removed:
>>>>> * this was the fate of the _SUB method which was found to cause such
>>>>> * problems and was removed (11/2015).
>>>>>
>>>>> The described problems with the _SUB method clearly also apply to
>>>>> the _STA method, so removing it from acpi_get_object_info seems like
>>>>> it is the right thing to do here. This too fixes 1 too early _STA
>>>>> call, so that with all
>>>>> 4 patches in place we've fixed all 4 too early _STA calls.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Hans
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe linux-acpi"
>>>>> in the body of a message to majordomo@vger.kernel.org More majordomo
>>>>> info at http://vger.kernel.org/majordomo-info.html
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-acpi"
>>>> in the body of a message to majordomo@vger.kernel.org More majordomo
>>>> info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2018-01-26 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 16:03 ACPI: Do not call _STA on battery devices with unmet dependencies Hans de Goede
2018-01-18 16:03 ` [PATCH 1/4] PCI: acpiphp_ibm: prepare for acpi_get_object_info no longer returning status Hans de Goede
2018-01-18 19:13 ` Bjorn Helgaas
2018-01-19 11:38 ` Hans de Goede
2018-01-18 16:03 ` [PATCH 2/4] ACPI / bus: Do not call _STA on battery devices with unmet dependencies Hans de Goede
2018-01-18 16:03 ` [PATCH 3/4] ACPI / scan: Use acpi_bus_get_status for initial status of ACPI_TYPE_DEVICE devs Hans de Goede
2018-01-18 16:03 ` [PATCH 4/4] ACPICA: Remove calling of _STA from acpi_get_object_info Hans de Goede
2018-01-18 19:11 ` ACPI: Do not call _STA on battery devices with unmet dependencies Bjorn Helgaas
2018-01-19 21:03 ` Schmauss, Erik
2018-01-20 12:48 ` Hans de Goede
2018-01-23 0:24 ` Schmauss, Erik
2018-01-26 15:46 ` Hans de Goede [this message]
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=c4fcb0b6-fbcc-18e7-9053-3c73d83863cc@redhat.com \
--to=hdegoede@redhat.com \
--cc=bhelgaas@google.com \
--cc=devel@acpica.org \
--cc=erik.schmauss@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@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;
as well as URLs for NNTP newsgroup(s).