From patchwork Tue Oct 25 05:21:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9393993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CC2D960231 for ; Tue, 25 Oct 2016 05:22:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF1D328D94 for ; Tue, 25 Oct 2016 05:22:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B228028EB0; Tue, 25 Oct 2016 05:22:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27BB128D94 for ; Tue, 25 Oct 2016 05:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941361AbcJYFWj (ORCPT ); Tue, 25 Oct 2016 01:22:39 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:34252 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755062AbcJYFWA (ORCPT ); Tue, 25 Oct 2016 01:22:00 -0400 Received: by mail-oi0-f65.google.com with SMTP id p136so5261001oic.1; Mon, 24 Oct 2016 22:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5uohAq5BBY/o71midOLCKQmrS6stoUD1ODWybAce4Zs=; b=f1BpkbXm0OVDqvWVDr0bWscW4we4lV0jwtr47rGwTRl/TOxBY1lqKVIeEMM5zlx0dj ryRgnBKdjfhhLtnJmNmXgg9z+wMK3VtP0YMCrxyXmfW1BtsshL9l2lxq0wbxkmP7pmg2 mRO1KOc4E6rRydn0TvSPYTztSr8PNwrSUWRKA8je7iGvgfhHvVsiU73KS2ppminG85fh AnHR2sFX1tci7Yc+NmQJKcKyDZzx6nM42k17xto9vAY9Rba08eCWQIKSBg2PRhzjqAAL Qy+27r5EgZ252887kYSAqIquES4Jn/7W5jJTYkl6yclIcNxgZAMFYsBSk/yxVxgf9Iej bvBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5uohAq5BBY/o71midOLCKQmrS6stoUD1ODWybAce4Zs=; b=CIRCaeBnlkPhKICr0zVYAs51lV3lC1kFzQ4RY7AQ98gFm8SZlNEIHTcSykV6NRfqno fHyOQuYHg2qI9Yt6cRia60kBWEIC50p9S1Klrmh2mBAApEGW3aYw+zHkXdBSy3F4i34n yL4V0v+8RxOeIk57iBrcG4j+FSbLCbTjjfh2CKB6q7xa+i+vWhW8+MHO/iM/pU6B/2k0 UhysmXyqo8prEiGbQ745CytZ5v13iLp8UhGaIluCuAojiEl6dEyq06gsUaIN9roPU+2M NHykRzDsKCMaD1t4Bq/WwGGI7zhtDzlwndBNxrOZKDLTNJkJajDRFpoivptYXBfGQvaq 5lbQ== X-Gm-Message-State: ABUngveoHNd6EqXS1kJMzvTz7azq3fft/h+V2V2vtjOQoChMI/o9qEHmduEfBdUuaywWog== X-Received: by 10.157.20.206 with SMTP id r14mr3630603otr.226.1477372893340; Mon, 24 Oct 2016 22:21:33 -0700 (PDT) Received: from localhost.localdomain (h3.246.129.40.static.ip.windstream.net. [40.129.246.3]) by smtp.gmail.com with ESMTPSA id l2sm6297959otc.15.2016.10.24.22.21.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Oct 2016 22:21:33 -0700 (PDT) From: Lv Zheng X-Google-Original-From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Lv Zheng Subject: [PATCH 4/6] ACPICA: Events: Cleanup acpi_ev_initialize_region() Date: Tue, 25 Oct 2016 13:21:29 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch changes acpi_ev_initialize_region(), stop returning AE_NOT_EXIST from it so that, not only in acpi_ds_load2_end_op(), but all places invoking this function won't emit exceptions. This patch also removes acpi_ns_locked from acpi_ev_initialize_region() as we have tuned table/namespace mutexes to be independent to each other, and decided to deal with namespace node deletion stuffs with new design other than using the 2 locks (because using them are not working correctly). Thus this function won't be invoked with the namespace lock held. No functional changes. Lv Zheng. Signed-off-by: Lv Zheng --- drivers/acpi/acpica/acevents.h | 4 +-- drivers/acpi/acpica/dsopcode.c | 2 +- drivers/acpi/acpica/dswload2.c | 13 +--------- drivers/acpi/acpica/evrgnini.c | 59 +++++++++++++++++------------------------- 4 files changed, 27 insertions(+), 51 deletions(-) diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 92fa47c..8a0049d 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h @@ -243,9 +243,7 @@ acpi_ev_default_region_setup(acpi_handle handle, u32 function, void *handler_context, void **region_context); -acpi_status -acpi_ev_initialize_region(union acpi_operand_object *region_obj, - u8 acpi_ns_locked); +acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj); /* * evsci - SCI (System Control Interrupt) handling/dispatch diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 4cc9d98..77fd7c8 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c @@ -84,7 +84,7 @@ acpi_status acpi_ds_initialize_region(acpi_handle obj_handle) /* Namespace is NOT locked */ - status = acpi_ev_initialize_region(obj_desc, FALSE); + status = acpi_ev_initialize_region(obj_desc); return (status); } diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index e362182..651f35a 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c @@ -609,18 +609,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) status = acpi_ev_initialize_region - (acpi_ns_get_attached_object(node), FALSE); - - if (ACPI_FAILURE(status)) { - /* - * If AE_NOT_EXIST is returned, it is not fatal - * because many regions get created before a handler - * is installed for said region. - */ - if (AE_NOT_EXIST == status) { - status = AE_OK; - } - } + (acpi_ns_get_attached_object(node)); break; case AML_NAME_OP: diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 75ddd16..a909225 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c @@ -479,7 +479,6 @@ acpi_ev_default_region_setup(acpi_handle handle, * FUNCTION: acpi_ev_initialize_region * * PARAMETERS: region_obj - Region we are initializing - * acpi_ns_locked - Is namespace locked? * * RETURN: Status * @@ -497,19 +496,28 @@ acpi_ev_default_region_setup(acpi_handle handle, * MUTEX: Interpreter should be unlocked, because we may run the _REG * method for this region. * + * NOTE: Possible incompliance: + * There is a behavior conflict in automatic _REG execution: + * 1. When the interpreter is evaluating a method, we can only + * automatically run _REG for the following case: + * operation_region (OPR1, 0x80, 0x1000010, 0x4) + * 2. When the interpreter is loading a table, we can also + * automatically run _REG for the following case: + * operation_region (OPR1, 0x80, 0x1000010, 0x4) + * Though this may not be compliant to the de-facto standard, the + * logic is kept in order not to trigger regressions. And keeping + * this logic should be taken care by the caller of this function. + * ******************************************************************************/ -acpi_status -acpi_ev_initialize_region(union acpi_operand_object *region_obj, - u8 acpi_ns_locked) +acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj) { union acpi_operand_object *handler_obj; union acpi_operand_object *obj_desc; acpi_adr_space_type space_id; struct acpi_namespace_node *node; - acpi_status status; - ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); + ACPI_FUNCTION_TRACE(ev_initialize_region); if (!region_obj) { return_ACPI_STATUS(AE_BAD_PARAMETER); @@ -580,39 +588,17 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, handler_obj, region_obj, obj_desc)); - status = - acpi_ev_attach_region(handler_obj, - region_obj, - acpi_ns_locked); + (void)acpi_ev_attach_region(handler_obj, + region_obj, FALSE); /* * Tell all users that this region is usable by * running the _REG method */ - if (acpi_ns_locked) { - status = - acpi_ut_release_mutex - (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - acpi_ex_exit_interpreter(); - status = - acpi_ev_execute_reg_method(region_obj, - ACPI_REG_CONNECT); + (void)acpi_ev_execute_reg_method(region_obj, + ACPI_REG_CONNECT); acpi_ex_enter_interpreter(); - - if (acpi_ns_locked) { - status = - acpi_ut_acquire_mutex - (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } - return_ACPI_STATUS(AE_OK); } } @@ -622,12 +608,15 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, node = node->parent; } - /* If we get here, there is no handler for this region */ - + /* + * If we get here, there is no handler for this region. This is not + * fatal because many regions get created before a handler is installed + * for said region. + */ ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, "No handler for RegionType %s(%X) (RegionObj %p)\n", acpi_ut_get_region_name(space_id), space_id, region_obj)); - return_ACPI_STATUS(AE_NOT_EXIST); + return_ACPI_STATUS(AE_OK); }