Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp464132pxa; Fri, 21 Aug 2020 11:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHrJuCeSIxWUsVFGHeJhJN6RRv+FuLmwXSSd8GIUFH3m6z/vZR+uW0nUa1SKeHmtihAFOC X-Received: by 2002:aa7:c1ca:: with SMTP id d10mr4274485edp.261.1598035574677; Fri, 21 Aug 2020 11:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598035574; cv=none; d=google.com; s=arc-20160816; b=RvDXDoSeq/93/6hd/AWzpXQrGlfIlTVlVzn1I5qXGQFV/10GNebJ6bjdXn7V6QE381 vsR8xRX6KOGK7CTEG3iYsxTsmJ5axLqaEtAb69xmrBb1/DKZrrH+xa0Lz39Z1AAv6Z/C TissFzUcW3bLQANWkVY/0slVHM8UfRGFM7hJM/V6A9G3JObe9zTLmvXF9aBzNJHgFYtw agWKvWmtA2/1taWK9qLwtt5h9/YiQaO27blJewk/M0nugUsfgtSzqphtwNAJAf0lL+ZI dYZGhV9o+DMWOFdnelrmam+rJ75dTwk7sVQLfTLinI28xspuq0PDvLTs7wi7vo1j/SQp gvPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:reply-to:from:date; bh=B+rT4iMKqgwEiil21CU2tcXnpX3FQnY3qkJw6xjZcHM=; b=nEQli5L/qknbioY3DQYVIhx/6b9hzmx1VrA5VKpdgLvYIAQ9K+kN4RMKCRq2Yxq/DX MSN7+wwBJZjHL+Mu3F8Ssxp4d16dE7wbybv2rG5dIhR7DJorgGh+w5qv0on+Zj0xtP4f ZIA02TsYwDDuk9e7qtV61s5/2X5H67P4OnNwtyXWVEOqBapTDQd44wmMEjKnQHMxqFnd 3L54phqrm2EdhyXAVIkxpPOKHN7K+011P98lvj8BLZFoJcoBI02AOuXD33Wz1JEoH7Q1 v0GbWdZ9NNGR9NBouLEYXjbYoXposttWa9dN/Z+mbw/wCyHTy14JfC3RB+qn95/6FaRz qm3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si1730493ejb.359.2020.08.21.11.45.50; Fri, 21 Aug 2020 11:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbgHUSpL (ORCPT + 99 others); Fri, 21 Aug 2020 14:45:11 -0400 Received: from l2mail1.panix.com ([166.84.1.75]:56142 "EHLO l2mail1.panix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbgHUSpJ (ORCPT ); Fri, 21 Aug 2020 14:45:09 -0400 X-Greylist: delayed 970 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Aug 2020 14:45:09 EDT Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by l2mail1.panix.com (Postfix) with ESMTPS id 4BY95W0HJszDdc; Fri, 21 Aug 2020 14:29:02 -0400 (EDT) Received: from xps-7390 (cpe-23-242-39-94.socal.res.rr.com [23.242.39.94]) by mailbackend.panix.com (Postfix) with ESMTPSA id 4BY95Q1Z1Lz1XCR; Fri, 21 Aug 2020 14:28:58 -0400 (EDT) Date: Fri, 21 Aug 2020 11:28:57 -0700 (PDT) From: "Kenneth R. Crudup" Reply-To: "Kenneth R. Crudup" To: "Rafael J. Wysocki" cc: Linux ACPI , LKML , Mika Westerberg , "Krogerus, Heikki" Subject: Re: [PATCH] ACPI: OSL: Prevent acpi_release_memory() from returning too early In-Reply-To: <6142241.0H6QnnlUA7@kreacher> Message-ID: References: <6142241.0H6QnnlUA7@kreacher> User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Works here for me: ---- $ l /sys/class/typec total 0 10012 0 drwxr-xr-x 2 root root 0 Aug 21 11:25 ./ 10 0 drwxr-xr-x 67 root root 0 Aug 21 11:25 ../ 27771 0 lrwxrwxrwx 1 root root 0 Aug 21 11:25 port0 -> ../../devices/platform/USBC000:00/typec/port0/ 35601 0 lrwxrwxrwx 1 root root 0 Aug 21 11:25 port0-partner -> ../../devices/platform/USBC000:00/typec/port0/port0-partner/ 36686 0 lrwxrwxrwx 1 root root 0 Aug 21 11:25 port1 -> ../../devices/platform/USBC000:00/typec/port1/ $ ---- On Fri, 21 Aug 2020, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > After commit 1757659d022b ("ACPI: OSL: Implement deferred unmapping > of ACPI memory") in some cases acpi_release_memory() may return > before the target memory mappings actually go away, because they > are released asynchronously now. > > Prevent it from returning prematurely by making it wait for the next > RCU grace period to elapse, for all of the RCU callbacks to complete > and for all of the scheduled work items to be flushed before > returning. > > Fixes: 1757659d022b ("ACPI: OSL: Implement deferred unmapping of ACPI memory") > Reported-by: Kenneth R. Crudup > Signed-off-by: Rafael J. Wysocki > --- > drivers/acpi/osl.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > > Index: linux-pm/drivers/acpi/osl.c > =================================================================== > --- linux-pm.orig/drivers/acpi/osl.c > +++ linux-pm/drivers/acpi/osl.c > @@ -1575,11 +1575,26 @@ static acpi_status acpi_deactivate_mem_r > acpi_status acpi_release_memory(acpi_handle handle, struct resource *res, > u32 level) > { > + acpi_status status; > + > if (!(res->flags & IORESOURCE_MEM)) > return AE_TYPE; > > - return acpi_walk_namespace(ACPI_TYPE_REGION, handle, level, > - acpi_deactivate_mem_region, NULL, res, NULL); > + status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level, > + acpi_deactivate_mem_region, NULL, > + res, NULL); > + if (ACPI_FAILURE(status)) > + return status; > + > + /* > + * Wait for all of the mappings queued up for removal by > + * acpi_deactivate_mem_region() to actually go away. > + */ > + synchronize_rcu(); > + rcu_barrier(); > + flush_scheduled_work(); > + > + return AE_OK; > } > EXPORT_SYMBOL_GPL(acpi_release_memory); > > > > > -- Kenneth R. Crudup Sr. SW Engineer, Scott County Consulting, Orange County CA