Received: by 10.223.164.202 with SMTP id h10csp1401565wrb; Thu, 23 Nov 2017 17:22:57 -0800 (PST) X-Google-Smtp-Source: AGs4zMb3Ei3uZYwlHbzDeTbA/87tsJLKO9ABLRP/L/zbbTF0GJsmvKrVsGZctnFdv7YPsDAvZKv0 X-Received: by 10.101.77.201 with SMTP id q9mr25802926pgt.226.1511486577432; Thu, 23 Nov 2017 17:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511486577; cv=none; d=google.com; s=arc-20160816; b=kZLV7dsWWa0+wiqsgyiDs6gexYe9OI6mNblOKXNg7YER8IhhvTR88pt0XDU04+MeTu f5S/XS1NWFvtWUU+vmEkwMHM8+fo4hdFYU7mu6+1x2RDOzqZNU66sGSUw7kLUsX98Sz/ WHFb86BJ6opZKkhy7qPYaZ4dwFDx8AK7pHOPu1gGM4bAvEbVlTDb9ckQLXhuthdFv1t5 +8WYT8wnNCaaa8uaHUyBHTJMk1DUM+sAsRFaNGmhL+BdFcLHXHJr208orTLrGHQkZNZk uul+zS3IRkkYxup7yIGyPfeyCIOFqiWuOxHYBphbToRFlyqVskPJjXkOldx/LEFUi1FV IM7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:arc-authentication-results; bh=ntNUIajyIETF9yvn1zIQrl3A3xcz/SFPmnhLfyE/fyc=; b=BKpyGw6PGKFf5Hh03aMfjuTQY5/16qkH0ZDQXmvOrB6YPRmOeMGxadTVAjQgFu7ZYH mw5qNcfHOF84vyM6ZldAt8TfVaLqiHM0ZeaKwYt7G0aw5yJVXGUqz45OXG9nD+HsjG9a J4N7zV1Bi+Oa5fHhWGYvFF2s6kC86EG7Jp2KzOc4t1RDzt7+kemYQJiUwz0tHhTJXiYc VCumOzCVfdIUg7gGkWMxOtlvfCAOcArwuP3fgOdqVLV2yjYZOk5QMnpzzggceOjYAeAM 4db/Njoi0h9PVUES+6jVRq8MTxaiLDBtFgKtpUgYU7jw+QzLJiLlb5xGxTI2MTORECe1 WkCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y81si18728569pfb.21.2017.11.23.17.22.46; Thu, 23 Nov 2017 17:22:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753395AbdKXBWF convert rfc822-to-8bit (ORCPT + 74 others); Thu, 23 Nov 2017 20:22:05 -0500 Received: from mga06.intel.com ([134.134.136.31]:39258 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753228AbdKXBWD (ORCPT ); Thu, 23 Nov 2017 20:22:03 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Nov 2017 17:22:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,444,1505804400"; d="scan'208";a="5166989" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 23 Nov 2017 17:22:02 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 23 Nov 2017 17:22:02 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Fri, 24 Nov 2017 09:20:47 +0800 From: "Zheng, Lv" To: "Zhang, Rui" , "Wysocki, Rafael J" , "Rafael J . Wysocki" , "Brown, Len" , Benjamin Tissoires CC: Lv Zheng , "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" Subject: RE: [RFC PATCH v6 1/3] ACPI / EC: Fix possible driver order issue by moving EC event handling earlier Thread-Topic: [RFC PATCH v6 1/3] ACPI / EC: Fix possible driver order issue by moving EC event handling earlier Thread-Index: AQHTOM23I0l+VNfhG02yzpj6n4nct6MgKcCAgALn0LA= Date: Fri, 24 Nov 2017 01:20:46 +0000 Message-ID: <1AE640813FDE7649BE1B193DEA596E886CFBBF6E@SHSMSX101.ccr.corp.intel.com> References: <99f23db65bbe89ee856018629654584a96734c84.1501141963.git.lv.zheng@intel.com> <88fd3a8dd4a99d25525b55b8ac5274067ddc4195.1506653046.git.lv.zheng@intel.com> <744357E9AAD1214791ACBA4B0B9092636BE5557C@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <744357E9AAD1214791ACBA4B0B9092636BE5557C@SHSMSX101.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzU4ZWY0MjctOTkwMi00YjM4LWI2ODYtMThmMWMxZWM0ZjQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNi41LjkuMyIsIlRydXN0ZWRMYWJlbEhhc2giOiJSdzZsSytQNmhnN1V3WXROb2VETmhUdkVEYzJiK3U5ZUR4WTJ2QkZkWlwvUT0ifQ== x-ctpclassification: CTP_PUBLIC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Rui > From: Zhang, Rui > Subject: RE: [RFC PATCH v6 1/3] ACPI / EC: Fix possible driver order issue by moving EC event handling > earlier > > > > From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi- > > Subject: [RFC PATCH v6 1/3] ACPI / EC: Fix possible driver order issue by > > moving EC event handling earlier > > > > This patch tries to detect EC events earlier after resume, so that if an event > > occurred before invoking acpi_ec_unblock_transactions(), it could be > > detected by acpi_ec_unblock_transactions() which is the earliest EC driver > > call after resume. > > > > However after the noirq stage, if an event ocurred after > > acpi_ec_unblock_transactions() and before acpi_ec_resume(), there was no > > mean to detect and trigger it right then, but can only detect it and handle it > > after acpi_ec_resume(). > > > > Now the final logic is: > > 1. If ec_freeze_events=Y, event handling is stopped in acpi_ec_suspend(), > > restarted in acpi_ec_resume(); > > 2. If ec_freeze_events=N, event handling is stopped in > > acpi_ec_block_transactions(), restarted in > > acpi_ec_unblock_transactions(); > > 3. In order to handling the conflict of the edge-trigger nature of EC IRQ > > and the Linux noirq stage, advance_transaction() is invoked where the > > event handling is enabled and the noirq stage is ended. > > > > Known issue: > > 1. Event ocurred between acpi_ec_unblock_transactions() and > > acpi_ec_resume() may still lead to the order issue. This can only be > > fixed by adding a periodic detection mechanism during the noirq stage. > > > > Signed-off-by: Lv Zheng > > Tested-by: Tomislav Ivek > > Tested-by: Luya Tshimbalanga > > I don't know what issue this patch has been tested for. Lv, can you please clarify? The testers' names are listed here because they have tried the commit and no regressions can be found on their test platforms. > > I agree with lv that it can probably fix some issues brought by the device order issue. > And I'll be glad to push this after we have verified it is really helpful. > Lv, > Do you still remember the bug report for the lid issue? Maybe you should ask Benjamin. Let me Cc him for further investigation. Thanks, Lv > > Thanks, > rui > > --- > > drivers/acpi/ec.c | 35 ++++++++++++++++++++++++++--------- > > 1 file changed, 26 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index df84246..f1f320b > > 100644 > > --- a/drivers/acpi/ec.c > > +++ b/drivers/acpi/ec.c > > @@ -249,6 +249,11 @@ static bool acpi_ec_started(struct acpi_ec *ec) > > !test_bit(EC_FLAGS_STOPPED, &ec->flags); } > > > > +static bool acpi_ec_no_sleep_events(void) { > > + return acpi_sleep_no_ec_events() && ec_freeze_events; } > > + > > static bool acpi_ec_event_enabled(struct acpi_ec *ec) { > > /* > > @@ -260,14 +265,14 @@ static bool acpi_ec_event_enabled(struct acpi_ec > > *ec) > > return false; > > /* > > * However, disabling the event handling is experimental for late > > - * stage (suspend), and is controlled by the boot parameter of > > - * "ec_freeze_events": > > + * stage (suspend), and is controlled by > > + * "acpi_ec_no_sleep_events()": > > * 1. true: The EC event handling is disabled before entering > > * the noirq stage. > > * 2. false: The EC event handling is automatically disabled as > > * soon as the EC driver is stopped. > > */ > > - if (ec_freeze_events) > > + if (acpi_ec_no_sleep_events()) > > return acpi_ec_started(ec); > > else > > return test_bit(EC_FLAGS_STARTED, &ec->flags); @@ -524,8 > > +529,8 @@ static bool acpi_ec_query_flushed(struct acpi_ec *ec) static void > > __acpi_ec_flush_event(struct acpi_ec *ec) { > > /* > > - * When ec_freeze_events is true, we need to flush events in > > - * the proper position before entering the noirq stage. > > + * When acpi_ec_no_sleep_events() is true, we need to flush events > > + * in the proper position before entering the noirq stage. > > */ > > wait_event(ec->wait, acpi_ec_query_flushed(ec)); > > if (ec_query_wq) > > @@ -948,7 +953,8 @@ static void acpi_ec_start(struct acpi_ec *ec, bool > > resuming) > > if (!resuming) { > > acpi_ec_submit_request(ec); > > ec_dbg_ref(ec, "Increase driver"); > > - } > > + } else if (!acpi_ec_no_sleep_events()) > > + __acpi_ec_enable_event(ec); > > ec_log_drv("EC started"); > > } > > spin_unlock_irqrestore(&ec->lock, flags); @@ -980,7 +986,7 @@ > > static void acpi_ec_stop(struct acpi_ec *ec, bool suspending) > > if (!suspending) { > > acpi_ec_complete_request(ec); > > ec_dbg_ref(ec, "Decrease driver"); > > - } else if (!ec_freeze_events) > > + } else if (!acpi_ec_no_sleep_events()) > > __acpi_ec_disable_event(ec); > > clear_bit(EC_FLAGS_STARTED, &ec->flags); > > clear_bit(EC_FLAGS_STOPPED, &ec->flags); @@ -1910,7 > > +1916,7 @@ static int acpi_ec_suspend(struct device *dev) > > struct acpi_ec *ec = > > acpi_driver_data(to_acpi_device(dev)); > > > > - if (acpi_sleep_no_ec_events() && ec_freeze_events) > > + if (acpi_ec_no_sleep_events()) > > acpi_ec_disable_event(ec); > > return 0; > > } > > @@ -1946,7 +1952,18 @@ static int acpi_ec_resume(struct device *dev) > > struct acpi_ec *ec = > > acpi_driver_data(to_acpi_device(dev)); > > > > - acpi_ec_enable_event(ec); > > + if (acpi_ec_no_sleep_events()) > > + acpi_ec_enable_event(ec); > > + else { > > + /* > > + * Though whether there is an event pending has been > > + * checked in acpi_ec_unblock_transactions() when > > + * acpi_ec_no_sleep_events() is false, check it one more > > + * time after noirq stage to detect events occurred after > > + * acpi_ec_unblock_transactions(). > > + */ > > + advance_transaction(ec); > > + } > > return 0; > > } > > #endif > > -- > > 2.7.4 > > > > -- > > 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 From 1584770787448137967@xxx Wed Nov 22 12:53:17 +0000 2017 X-GM-THRID: 1577233563469529260 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread