mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH v3 1/7] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings
Date: Tue,  3 May 2016 16:48:20 +0800	[thread overview]
Message-ID: <2c3815d72ac69e60e278757d0c74cd5e3003f1ad.1462263979.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1462263979.git.lv.zheng@intel.com>

The order of the _OSI related functionalities is as follows:
  acpi_blacklisted()
    acpi_dmi_osi_linux()
      acpi_osi_setup()
    acpi_osi_setup()
      acpi_update_interfaces() if "!*"
      <<<<<<<<<<<<<<<<<<<<<<<<
  parse_args()
    __setup("acpi_osi=")
      acpi_osi_setup_linux()
        acpi_update_interfaces() if "!*"
        <<<<<<<<<<<<<<<<<<<<<<<<
  acpi_early_init()
    acpi_initialize_subsystem()
      acpi_ut_initialize_interfaces()
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  acpi_bus_init()
    acpi_os_initialize1()
      acpi_install_interface_handler(acpi_osi_handler)
      acpi_osi_setup_late()
        acpi_update_interfaces() for "!"
        >>>>>>>>>>>>>>>>>>>>>>>>
  acpi_osi_handler()
Since acpi_osi_setup_linux() can override acpi_dmi_osi_linux(), the command
line setting can override the DMI detection. That's why acpi_blacklisted()
is put before __setup("acpi_osi=").

Then we can notice the following wrong invocation order. There are
acpi_update_interfaces() (marked by <<<<) calls invoked before
acpi_ut_initialize_interfaces() (marked by ^^^^). This makes it impossible
to use acpi_osi=!* correctly from OSI DMI table or from the command line.
The use of acpi_osi=!* is meant to disable both ACPICA
(acpi_gbl_supported_interfaces) and Linux specific strings
(osi_setup_entries) while the ACPICA part should have stopped working
because of the order issue.

This patch fixes this issue by moving acpi_update_interfaces() to where
it is invoked for acpi_osi=! (marked by >>>>) as this is ensured to be
invoked after acpi_ut_initialize_interfaces() (marked by ^^^^). Linux
specific strings are still handled in the original place in order to make
the following command line working: acpi_osi=!* acpi_osi="Module Device".

Note that since acpi_osi=!* is meant to further disable linux specific
string comparing to the acpi_osi=!, there is no such use case in our bug
fixing work and hence there is no one using acpi_osi=!* either from the
command line or from the DMI quirks, this issue is just a theoretical
issue.

Fixes: 741d81280ad2 ("ACPI: Add facility to remove all _OSI strings")
Cc: <stable@vger.kernel.org> # 3.12+
Tested-by: Lukas Wunner <lukas@wunner.de>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/osl.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 00d2a22..d7d84a8 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -135,7 +135,7 @@ static struct osi_linux {
 	unsigned int	enable:1;
 	unsigned int	dmi:1;
 	unsigned int	cmdline:1;
-	unsigned int	default_disabling:1;
+	u8		default_disabling;
 } osi_linux = {0, 0, 0, 0};
 
 static u32 acpi_osi_handler(acpi_string interface, u32 supported)
@@ -1477,10 +1477,13 @@ void __init acpi_osi_setup(char *str)
 	if (*str == '!') {
 		str++;
 		if (*str == '\0') {
-			osi_linux.default_disabling = 1;
+			/* Do not override acpi_osi=!* */
+			if (!osi_linux.default_disabling)
+				osi_linux.default_disabling =
+					ACPI_DISABLE_ALL_VENDOR_STRINGS;
 			return;
 		} else if (*str == '*') {
-			acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
+			osi_linux.default_disabling = ACPI_DISABLE_ALL_STRINGS;
 			for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
 				osi = &osi_setup_entries[i];
 				osi->enable = false;
@@ -1553,10 +1556,13 @@ static void __init acpi_osi_setup_late(void)
 	acpi_status status;
 
 	if (osi_linux.default_disabling) {
-		status = acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
+		status = acpi_update_interfaces(osi_linux.default_disabling);
 
 		if (ACPI_SUCCESS(status))
-			printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n");
+			printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n",
+				osi_linux.default_disabling ==
+				ACPI_DISABLE_ALL_STRINGS ?
+				" and feature groups" : "");
 	}
 
 	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
-- 
1.7.10

  reply	other threads:[~2016-05-03  8:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26  7:39 [PATCH 0/4] ACPI / osi: Fix several issues in _OSI handling Lv Zheng
2016-04-26  7:40 ` [PATCH 1/4] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Lv Zheng
2016-04-26  7:40 ` [PATCH 2/4] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support Lv Zheng
2016-04-26 20:10   ` Rafael J. Wysocki
2016-04-27  2:00     ` Zheng, Lv
2016-04-26  7:40 ` [PATCH 3/4] ACPI / osi: Change default _OSI(Darwin) support Lv Zheng
2016-04-26 20:13   ` Rafael J. Wysocki
2016-04-27  2:01     ` Zheng, Lv
2016-04-26  7:40 ` [PATCH 4/4] ACPI / osi: Collect _OSI handling into one single file Lv Zheng
2016-04-27  8:54 ` [PATCH v2 0/6] ACPI / osi: Fix several issues in _OSI handling Lv Zheng
2016-04-27  8:54   ` [PATCH v2 1/6] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Lv Zheng
2016-04-27  8:54   ` [PATCH v2 2/6] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support Lv Zheng
2016-04-27  8:54   ` [PATCH v2 3/6] ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! Lv Zheng
2016-04-27  8:54   ` [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support Lv Zheng
2016-04-27  9:45     ` Chen, Yu C
2016-04-27 21:24       ` Rafael J. Wysocki
2016-04-28  2:30         ` Zheng, Lv
2016-04-29  2:07           ` Zheng, Lv
2016-04-29 13:01             ` Lukas Wunner
2016-05-03  1:56               ` Zheng, Lv
2016-04-28  7:54         ` Chen, Yu C
2016-04-27  8:54   ` [PATCH v2 5/6] ACPI / osi: Cleanup coding style issues before creating a separate OSI source file Lv Zheng
2016-04-27  8:54   ` [PATCH v2 6/6] ACPI / osi: Collect _OSI handling into one single file Lv Zheng
2016-05-03  8:48 ` [PATCH v3 0/7] ACPI / osi: Fix several issues in _OSI handling Lv Zheng
2016-05-03  8:48   ` Lv Zheng [this message]
2016-05-03  8:48   ` [PATCH v3 2/7] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support Lv Zheng
2016-05-03  8:48   ` [PATCH v3 3/7] ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! Lv Zheng
2016-05-03  8:48   ` [PATCH v3 4/7] ACPI / osi: Fix default _OSI(Darwin) support Lv Zheng
2016-05-03  8:48   ` [PATCH v3 5/7] ACPI / osi: Cleanup OSI handling code to use bool Lv Zheng
2016-05-03  8:48   ` [PATCH v3 6/7] ACPI / osi: Cleanup coding style issues before creating a separate OSI source file Lv Zheng
2016-05-03  8:49   ` [PATCH v3 7/7] ACPI / osi: Collect _OSI handling into one single file Lv Zheng
2016-05-05 23:41   ` [PATCH v3 0/7] ACPI / osi: Fix several issues in _OSI handling Rafael J. Wysocki

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=2c3815d72ac69e60e278757d0c74cd5e3003f1ad.1462263979.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=zetalog@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

all inboxes | Powered by JetHome®