From patchwork Wed Jun 14 05:59:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9785497 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 39231602D9 for ; Wed, 14 Jun 2017 06:00:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C7382853F for ; Wed, 14 Jun 2017 06:00:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A8102858D; Wed, 14 Jun 2017 06:00:04 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 AE52D28552 for ; Wed, 14 Jun 2017 06:00:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750749AbdFNF7a (ORCPT ); Wed, 14 Jun 2017 01:59:30 -0400 Received: from mga05.intel.com ([192.55.52.43]:21398 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754406AbdFNF73 (ORCPT ); Wed, 14 Jun 2017 01:59:29 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 13 Jun 2017 22:59:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,340,1493708400"; d="scan'208";a="274026151" Received: from unknown (HELO lvzheng-MOBLsp3.sh.intel.com) ([10.239.159.55]) by fmsmga004.fm.intel.com with ESMTP; 13 Jun 2017 22:59:26 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH 3/3] ACPI: EC: Change EC noirq tuning to be an optional behavior Date: Wed, 14 Jun 2017 13:59:24 +0800 Message-Id: <157972fa5572b0f0c157142ea151b8508e7640b4.1497418749.git.lv.zheng@intel.com> 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 According to the bug report, though the busy polling mode can make noirq stages executed faster, it causes abnormal fan blowing in noirq stages. This patch prepares an option so that the automatic busy polling mode switching for noirq stages can be enabled by who wants to tune it, not all users. Noticed that the new global option cannot be changed during noirq stages. There is no need to lock its value changes to sync with polling mode settings switches. For reporters and testers in the thread, as there are too many reporters on the bug link, this patch only picks names from most active commenters. Sorry for the neglet. Link: https://bugzilla.kernel.org/show_bug.cgi?id=191181 Reported-by: Tatsuyuki Ishi Reported-by: Claudio Sacerdoti Coen Tested-by: Nicolo' Reported-by: Jens Axboe Tested-by: Gjorgji Jankovski Tested-by: Damjan Georgievski Tested-by: Fernando Chaves Signed-off-by: Lv Zheng --- drivers/acpi/ec.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index f3ff591..de5dde6 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -151,6 +151,10 @@ static bool ec_freeze_events __read_mostly = true; module_param(ec_freeze_events, bool, 0644); MODULE_PARM_DESC(ec_freeze_events, "Disabling event handling during suspend/resume"); +static bool ec_tune_noirq __read_mostly = false; +module_param(ec_tune_noirq, bool, 0644); +MODULE_PARM_DESC(ec_tune_noirq, "Automatic enabling busy polling to tune noirq stages faster"); + struct acpi_ec_query_handler { struct list_head node; acpi_ec_query_func func; @@ -979,9 +983,11 @@ static void acpi_ec_enter_noirq(struct acpi_ec *ec) unsigned long flags; spin_lock_irqsave(&ec->lock, flags); - ec->busy_polling = true; - ec->polling_guard = 0; - ec_log_drv("interrupt blocked"); + if (ec_tune_noirq) { + ec->busy_polling = true; + ec->polling_guard = 0; + ec_log_drv("interrupt blocked"); + } spin_unlock_irqrestore(&ec->lock, flags); } @@ -990,9 +996,11 @@ static void acpi_ec_leave_noirq(struct acpi_ec *ec) unsigned long flags; spin_lock_irqsave(&ec->lock, flags); - ec->busy_polling = ec_busy_polling; - ec->polling_guard = ec_polling_guard; - ec_log_drv("interrupt unblocked"); + if (ec_tune_noirq) { + ec->busy_polling = ec_busy_polling; + ec->polling_guard = ec_polling_guard; + ec_log_drv("interrupt unblocked"); + } spin_unlock_irqrestore(&ec->lock, flags); }