Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2013392pxa; Mon, 24 Aug 2020 02:31:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy67YqFRUMTBQ/D4VJZHgC6NPOQvPMwEIEllbgMgBNcaXuGN+EzO0ayKdXy0H75mEPkhFgn X-Received: by 2002:a17:906:4a07:: with SMTP id w7mr4927968eju.515.1598261476811; Mon, 24 Aug 2020 02:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598261476; cv=none; d=google.com; s=arc-20160816; b=aw0mf8vEw4QMYLzbIPBJVYpui5tXngKkkhDsMaeDBznOFYwGo3p3Ik1mYORvpEXyZg +qveoYnrCW5p3LV2Bl2iNDVj+KP1GzdLpRmg+QWc8mJ8PCL/qlQsrZKK01cahby8Xjm0 qXPuHYICdJKuS5dLEP9Fm5I6/wRIUdNitvYNNZSQdXc/G502Rl/JZYSC0eWzE1W+GNbX wj1NeiJsEOJd2FDalfgaZFm1l4LeqaHLzVPAqeyQ8Qi/tOQeLNtB2q/MO8sdEfGKrmNp 8RS6bIjV74DfRHdgTYKD1Bb1tBoZkJkUYuubvOnF43xG2tB+wAVyim9v5pKmYm34V6jQ VW6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=fzUsbC3DR2krYn3jAKa2rzA7Iu5tudZyc+naFNJbD3A=; b=HuNV3z4S0he4AcS6a0UoXnztVBDah8Pf97GUqjhAQHXmKnorwf+JF2/JTRqwUCdeJx +wb+C1arBpy3iBIvVC0aPDb1BAdFucAoAijpso/L5lyJB7ElfZ2Ts+RQkIFhk0dbzejy yAmxHYjV91via8H28d3rJsSlRgDVvfVXwILN1lZZ7er8BU7tPh3CEma1vNfmLiAAG8DN 3afLhQ96CU8tOm9Te6lKcp0r0jcabZNth1Yhrl6Arn8sIU/sh3zWDWB4w+Fe9/VhLYUp qdrT17Z9WqqWFuT1EgW/x6NgGXwbOThHTJwobi9Xst44dz5/iq2C5JP13qpNyTq+iekM 4Axw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si2146872ejz.613.2020.08.24.02.30.54; Mon, 24 Aug 2020 02:31:16 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730033AbgHXJ3U (ORCPT + 99 others); Mon, 24 Aug 2020 05:29:20 -0400 Received: from mga09.intel.com ([134.134.136.24]:60120 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727122AbgHXIvC (ORCPT ); Mon, 24 Aug 2020 04:51:02 -0400 IronPort-SDR: vw7163l3gBejpmsPbYAHA1Hvsms0cy5vUs7WarctqQw1Isvqg+AT2z5Te0OWZzMxrYAmCSww6Y 6kTRlOoqtFdw== X-IronPort-AV: E=McAfee;i="6000,8403,9722"; a="156918464" X-IronPort-AV: E=Sophos;i="5.76,347,1592895600"; d="scan'208";a="156918464" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 01:51:01 -0700 IronPort-SDR: Z/QlW50JtdUITuzynkBomeNe0c4gFDUznebeKbjj0IoTwNFJW5Tt9DqQKMyfwoTP3wgwM02tCd QoVhhZ+f5esg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,347,1592895600"; d="scan'208";a="402253300" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 24 Aug 2020 01:50:58 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 24 Aug 2020 11:50:58 +0300 Date: Mon, 24 Aug 2020 11:50:57 +0300 From: Heikki Krogerus To: "Rafael J. Wysocki" Cc: Linux ACPI , LKML , Mika Westerberg , "Kenneth R. Crudup" Subject: Re: [PATCH] ACPI: OSL: Prevent acpi_release_memory() from returning too early Message-ID: <20200824085057.GA189773@kuha.fi.intel.com> References: <6142241.0H6QnnlUA7@kreacher> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6142241.0H6QnnlUA7@kreacher> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 07:42:55PM +0200, 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 FWIW: Reviewed-by: Heikki Krogerus > --- > 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); thanks, -- heikki