From patchwork Sun Nov 9 09:53:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 5260241 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 379AE9F2F1 for ; Sun, 9 Nov 2014 10:53:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64697200FF for ; Sun, 9 Nov 2014 10:53:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D98A02015A for ; Sun, 9 Nov 2014 10:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbaKIKxn (ORCPT ); Sun, 9 Nov 2014 05:53:43 -0500 Received: from mail-la0-f42.google.com ([209.85.215.42]:47602 "EHLO mail-la0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbaKIKxm (ORCPT ); Sun, 9 Nov 2014 05:53:42 -0500 Received: by mail-la0-f42.google.com with SMTP id gq15so6489972lab.1 for ; Sun, 09 Nov 2014 02:53:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; bh=DptfpIIR/9g5n5mQUA7Ga2z2fJcpKfYRy8/w/1isTrY=; b=IEWp3nC1kOOjpw5awWWDftuMoDanhfpqRFqXsn5cwoWnOk43L6ZwCC1AcCnYXVeZI1 ylUOn+L3Tlkb6kj9LVCpumBXIo7xIrtZYx3BRbYA/KXjMdhztP61GQLI/UVbYKTSuk4H bkcAil2xZ7uvoTQfmLGzi7ZUSAtK7Z7DMHlBQrhZDS1nC3SCjKo+IydoCVIx5JWQe4xQ 6Y1p8dOTglU/jNC1R70uzhLp/rJw6xsw4AfHQYvt+T0OPC6PUWQlj9+HDNrJWEFS6XL2 0BVy1ygTLvhUAWpKnQyeuNlpe8quunA97qF+F62rzEqxEebgQ4P/tCfmRxl1WZ1rEyxL YryQ== X-Received: by 10.112.132.34 with SMTP id or2mr2181596lbb.75.1415530420655; Sun, 09 Nov 2014 02:53:40 -0800 (PST) Received: from localhost (128-72-204-139.broadband.corbina.ru. [128.72.204.139]) by mx.google.com with ESMTPSA id x7sm4508722lad.13.2014.11.09.02.53.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Nov 2014 02:53:39 -0800 (PST) Subject: [PATCH v2] ACPI/osl: speedup grace period in acpi_os_map_cleanup From: Konstantin Khlebnikov To: linux-acpi@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Len Brown Cc: Tom Boshoven , "Paul E. McKenney" , x86@kernel.org, Josh Triplett , Alexander Monakov Date: Sun, 09 Nov 2014 13:53:37 +0400 Message-ID: <20141109105337.4952.36899.stgit@zurg> In-Reply-To: <20141108094717.9388.34638.stgit@zurg> References: <20141108094717.9388.34638.stgit@zurg> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ACPI maintains cache of ioremap regions to speed up operations and access to them from irq context where ioremap() calls aren't allowed. This code abuses synchronize_rcu() on unmap path for synchronization with fast-path in acpi_os_read/write_memory which uses this cache. Since v3.10 CPUs are allowed to enter idle state even if they have RCU callbacks queued, see commit c0f4dfd4f90f1667d234d21f15153ea09a2eaa66 ("rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks"). That change caused problems with nvidia proprietary driver which calls acpi_os_map/unmap_generic_address several times during initialization. Each unmap calls synchronize_rcu and adds significant delay. Totally initialization is slowed for a couple of seconds and that is enough to trigger timeout in hardware, gpu decides to "fell off the bus". Widely spread workaround is reducing "rcu_idle_gp_delay" from 4 to 1 jiffy. This patch replaces synchronize_rcu() with synchronize_rcu_expedited() which is much faster. Signed-off-by: Konstantin Khlebnikov Reported-and-tested-by: Alexander Monakov Cc: Tom Boshoven Link: https://devtalk.nvidia.com/default/topic/567297/linux/linux-3-10-driver-crash/ Reviewed-by: Paul E. McKenney Tested-by: Lee, Chun-Yi --- drivers/acpi/osl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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 diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 9964f70..217713c 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -436,7 +436,7 @@ static void acpi_os_drop_map_ref(struct acpi_ioremap *map) static void acpi_os_map_cleanup(struct acpi_ioremap *map) { if (!map->refcount) { - synchronize_rcu(); + synchronize_rcu_expedited(); acpi_unmap(map->phys, map->virt); kfree(map); }