Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1220741ybh; Sun, 19 Jul 2020 12:15:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvUnzF8B8+rdaaL8HoJL+Bz1Gm8BiZxDawu59pWd9HVbvMvHSJ0qZdgO7iLq0fyk1OQayQ X-Received: by 2002:a17:906:7694:: with SMTP id o20mr17481479ejm.289.1595186111749; Sun, 19 Jul 2020 12:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595186111; cv=none; d=google.com; s=arc-20160816; b=1DRbxG+LAsBXxkOth9j9CQGIQkrxqkKwRGTgAccVeMbkWc6gb5o9ff2+v1oVyKmiPQ xkaD4h05tH5BGFQ3fDWTZa7suNO/10VFARoNYCmhehpX+nLo44wtCv6kYWoxZ/F9BnqJ txg2WNCkB+vH9cHxvaA4xXNOw+LjTteL36I0SVCu15Kukjn41BVvcKkZ8nbAidjxmPp9 /8aq6e6L1gG9sTgUEwBPpYfdAl3etupMnmdzEPLNI5f2QS3F7o5HgzpsDQpGtmXe+IQc t2q9YR0GHWC441+SrrFc5ZdMvWZmzk/YYjkfsxll/hNH4ZOShHu643th/Y0/dLs8oUcD vMVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=/vgePeYsDGdOfYJ+zrhF6ulRCJSEh7r7GG7PhUNcyLQ=; b=yXULc5KEiBReizgDnkIy7rypCKNOuXApOlzOo6B5xNxDSKlOrOTtWz+6Yh5nLigJcK h8q3t1rQ2pIV6P3ZStTCijC1jIp+xp4uTYh+7pONkAa/jxYf45BJnRP/006cj6hsl9KR Zz2ne3F4nu6vJagLnAOR1lP/hEc4viM/YJZ67ktQN6kz9XDQGih5kVwqLG6H6zq3gI8V E/ZOp0xqwWCet/T5TTzyUZRD+VfeY03E6nh1tUnaGqFoEn/vIbrw6fkf9k1eaLBeJsh5 +/HoP9C9xRRGFPQvu9AtWcNPBctVPE5ESlWFa7tvopjq/8P+g4ypCZtUcswGEUJIUN6W 6AEA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si8988778ejk.576.2020.07.19.12.14.46; Sun, 19 Jul 2020 12:15:11 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726161AbgGSTOg (ORCPT + 99 others); Sun, 19 Jul 2020 15:14:36 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36158 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbgGSTOg (ORCPT ); Sun, 19 Jul 2020 15:14:36 -0400 Received: by mail-ot1-f68.google.com with SMTP id 72so10595020otc.3; Sun, 19 Jul 2020 12:14:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/vgePeYsDGdOfYJ+zrhF6ulRCJSEh7r7GG7PhUNcyLQ=; b=cBPB3z4dag6pgFqrJXBC/hcQZaACsU6016ZinRNn55vEqaKeS/em8tpvzsSULv7/S+ CLY71dJJh6+QId5HH7ZwDXc1tbjGam+uWlwpKAoucwCsYNjQ46YPoP29GfDqvC8oXzfR D7lnRDc4+KsPlITqkUj7Y0hHX+w1f3KExKmI9Svxh7oDyNvYN54WdCyrfI3+KT3YH1FI t1uhep0MNmypgel+MhPzTvvs0xfZH31hkmQ9/7ywE8oed1c/zY470nZPvnapub+i1Nhg bbl5SuW7P21DNGMjF9Qwasf7Rqe0rG8OYANKAhwXN2KV/k52QFO4Oeg36S2JgETH6hiw njww== X-Gm-Message-State: AOAM531cA74inAKeXmOdD/T45aHHj235ZODMpyjGB4PQW1oRFvv8p+Uh x/5N7SJsf2qjgHDZUS2qv6Cp/+EJY0YRJrgQkVw= X-Received: by 2002:a9d:590a:: with SMTP id t10mr17201578oth.262.1595186075072; Sun, 19 Jul 2020 12:14:35 -0700 (PDT) MIME-Version: 1.0 References: <158889473309.2292982.18007035454673387731.stgit@dwillia2-desk3.amr.corp.intel.com> <2788992.3K7huLjdjL@kreacher> <1666722.UopIai5n7p@kreacher> <1794490.F2OrUDcHQn@kreacher> <1738949fd49e9804722bf82d790e3022fc714677.camel@intel.com> In-Reply-To: <1738949fd49e9804722bf82d790e3022fc714677.camel@intel.com> From: "Rafael J. Wysocki" Date: Sun, 19 Jul 2020 21:14:23 +0200 Message-ID: Subject: Re: [PATCH v4 2/2] ACPICA: Preserve memory opregion mappings To: "Verma, Vishal L" Cc: "Williams, Dan J" , "Kaneda, Erik" , "rjw@rjwysocki.net" , "linux-nvdimm@lists.01.org" , "james.morse@arm.com" , "lenb@kernel.org" , "andriy.shevchenko@linux.intel.com" , "bp@alien8.de" , "linux-kernel@vger.kernel.org" , "myron.stowe@redhat.com" , "Wysocki, Rafael J" , "Weiny, Ira" , "Moore, Robert" , "linux-acpi@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 9:22 PM Verma, Vishal L wrote: > > On Mon, 2020-06-29 at 18:33 +0200, Rafael J. Wysocki wrote: > > From: "Rafael J. Wysocki" > > > > The ACPICA's strategy with respect to the handling of memory mappings > > associated with memory operation regions is to avoid mapping the > > entire region at once which may be problematic at least in principle > > (for example, it may lead to conflicts with overlapping mappings > > having different attributes created by drivers). It may also be > > wasteful, because memory opregions on some systems take up vast > > chunks of address space while the fields in those regions actually > > accessed by AML are sparsely distributed. > > > > For this reason, a one-page "window" is mapped for a given opregion > > on the first memory access through it and if that "window" does not > > cover an address range accessed through that opregion subsequently, > > it is unmapped and a new "window" is mapped to replace it. Next, > > if the new "window" is not sufficient to acess memory through the > > opregion in question in the future, it will be replaced with yet > > another "window" and so on. That may lead to a suboptimal sequence > > of memory mapping and unmapping operations, for example if two fields > > in one opregion separated from each other by a sufficiently wide > > chunk of unused address space are accessed in an alternating pattern. > > > > The situation may still be suboptimal if the deferred unmapping > > introduced previously is supported by the OS layer. For instance, > > the alternating memory access pattern mentioned above may produce > > a relatively long list of mappings to release with substantial > > duplication among the entries in it, which could be avoided if > > acpi_ex_system_memory_space_handler() did not release the mapping > > used by it previously as soon as the current access was not covered > > by it. > > > > In order to improve that, modify acpi_ex_system_memory_space_handler() > > to preserve all of the memory mappings created by it until the memory > > regions associated with them go away. > > > > Accordingly, update acpi_ev_system_memory_region_setup() to unmap all > > memory associated with memory opregions that go away. > > > > Reported-by: Dan Williams > > Signed-off-by: Rafael J. Wysocki > > --- > > drivers/acpi/acpica/evrgnini.c | 14 ++++---- > > drivers/acpi/acpica/exregion.c | 65 ++++++++++++++++++++++++---------- > > include/acpi/actypes.h | 12 +++++-- > > 3 files changed, 64 insertions(+), 27 deletions(-) > > > > Hi Rafael, > > Picking up from Dan while he's out - I had these patches tested by the > original reporter, and they work fine. I see you had them staged in the > acpica-osl branch. Is that slated to go in during the 5.9 merge window? Yes, it is. > You can add: > Tested-by: Xiang Li Thank you!