Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2289208ybg; Fri, 5 Jun 2020 10:05:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVM0QWmyNNPExzqm5jZApxxmArSS+IceoPV1n5auVz8op5PWDkfHLJAzh+Vt78QQjS/Ivp X-Received: by 2002:a50:ac84:: with SMTP id x4mr10594799edc.124.1591376709487; Fri, 05 Jun 2020 10:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591376709; cv=none; d=google.com; s=arc-20160816; b=nD9Ik8tnIAPnbC7DPbUV8mUsPuHJqMI3F7Eu8V9sXiTqNwAy4+PJMyR95QTCTmn0MS JuNmTsLwi+tIH3AAuKjuLfA++qT1/gpilrvvrae/YXzXAay/VhqOIbPpRlujCNQiMdvj v5WyUkC5M2n6gyQlwVojz92Ne6tDFn06ISV7qkwxePfdSb8DP+EWhXGq1XZXLn+Rcnln m2e9Xf7Ay4gVEhGPGCBf8QKU7P89r3O/jKo659SBXb9pQGFh75I36tXaO9/3AQ9KlOOk 23gPfTxsgCX0q2sc9/ECQbMEcNSEy3hRHZHx61EFWC5vzE25THv1vOt5zJr/ii/DAo/Z AdYg== 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=wTZiSOR+igC/gRCry3GVm0Zp9Ahw3ee9N7yu1QHMPRc=; b=el+jey47nxBoWYKlAMNy5UK9R/zcHlFWT/DZ2gRUBO2jP7AZx6vZCsI1a4wDkXrdbp TFZ2Qd49XhXdB57Rq56RHo/8H/Gwr0LsGzjdj8XfxIefEOukIjTOqQDRxcNvblffHKsi tFhbgDQ8r6nSfyLaei7oKOkSqSWMiz8rRSYgFgKS/WQ+Lbd8v8Rq3tyGmvdDI7aa68Qh weL6kbo3INGV4M4bOKxIcVIdV1WD7VOmvO2yuwwKjkXknhe8pQ1O3LI0Vv8Qq7LIFOov m2a1EnwLnQ3RDI9GB1aP0f77BVhBv9fOtyltLFKJZur1a/2omi6OpeyVDL0RMrr/9DQX dxRw== 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 8si4306278ejx.280.2020.06.05.10.04.45; Fri, 05 Jun 2020 10:05:09 -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 S1726986AbgFERCh (ORCPT + 99 others); Fri, 5 Jun 2020 13:02:37 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:47040 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgFERCg (ORCPT ); Fri, 5 Jun 2020 13:02:36 -0400 Received: by mail-ot1-f67.google.com with SMTP id g7so7060072oti.13; Fri, 05 Jun 2020 10:02: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=wTZiSOR+igC/gRCry3GVm0Zp9Ahw3ee9N7yu1QHMPRc=; b=YiRpuDfmlt2WeNv2aLXt+VZkCxONKnM/w81WbGLR06RwqA/TQZpStDcV5Kwd0yGnj/ XS4/E1DB46gCzd9koUsTbKgtw0Mj7uv9EdhBYmpIE1Dyd5GJoqt7IcEEOR41nFkTkCo3 +6c6L/Q2m7lHJZ8jKDE0ApcxEYsFStQa7dn+KoRVaw4OF71RDuQroOH65Yxe0xjq9oR6 CG3GZGc1uQSz/h4C62jtwmFuKUULcYLjZZyIpPZ8jUGuRgzeEnvXHoLqmYxIseJbK3h/ tQm4L0Vw5rTHSIWiqOJXAlbzEzvuGwGYPH7sFtwT16VnBerEVEMONknGUKzjgQDEGT3O xQGQ== X-Gm-Message-State: AOAM530M8q6GT5k/CVgBTqklvSWzKwDrImPvkOGfIgRGOxz5AeXUuY7Z nC2NhlhO6k+B8KmOzDsyVPGnBS6iv2lSPIPYW+s= X-Received: by 2002:a05:6830:20d1:: with SMTP id z17mr7997880otq.167.1591376555389; Fri, 05 Jun 2020 10:02:35 -0700 (PDT) MIME-Version: 1.0 References: <158889473309.2292982.18007035454673387731.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 5 Jun 2020 19:02:24 +0200 Message-ID: Subject: Re: [PATCH v2] ACPI: Drop rcu usage for MMIO mappings To: Dan Williams Cc: "Rafael J. Wysocki" , Rafael Wysocki , Stable , Len Brown , Borislav Petkov , Ira Weiny , James Morse , Erik Kaneda , Myron Stowe , "Rafael J. Wysocki" , Andy Shevchenko , Linux Kernel Mailing List , ACPI Devel Maling List , "linux-nvdimm@lists.01.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 Fri, Jun 5, 2020 at 6:39 PM Dan Williams wrote: > > On Fri, Jun 5, 2020 at 9:22 AM Rafael J. Wysocki wrote: > [..] > > > The fix we are looking at now is to pre-map operation regions in a > > > similar manner as the way APEI resources are pre-mapped. The > > > pre-mapping would arrange for synchronize_rcu_expedited() to be elided > > > on each dynamic mapping attempt. The other piece is to arrange for > > > operation-regions to be mapped at their full size at once rather than > > > a page at a time. > > > > However, if the RCU usage in ACPI OSL can be replaced with an rwlock, > > some of the ACPICA changes above may not be necessary anymore (even > > though some of them may still be worth making). > > I don't think you can replace the RCU usage in ACPI OSL and still > maintain NMI lookups in a dynamic list. I'm not sure what NMI lookups have to do with the issue at hand. If acpi_os_{read|write}_memory() is used from NMI, that is a bug already in there which is unrelated to the performance problem with opregions. > However, there are 3 solutions I see: > > - Prevent acpi_os_map_cleanup() from triggering at high frequency by > pre-mapping and never unmapping operation-regions resources (internal > discussion in progress) Yes, that can be done, if necessary. > - Prevent walks of the 'acpi_ioremaps' list (acpi_map_lookup_virt()) > from NMI context by re-writing the physical addresses in the APEI > tables with pre-mapped virtual address, i.e. remove rcu_read_lock() > and list_for_each_entry_rcu() from NMI context. That sounds a bit convoluted to me. > - Split operation-region resources into a separate mapping mechanism > than APEI resources so that typical locking can be used for the > sleepable resources and let the NMI accessible resources be managed > separately. > > That last one is one we have not discussed internally, but it occurred > to me when you mentioned replacing RCU. So NMI cannot use acpi_os_{read|write}_memory() safely which you have pointed out for a few times. But even if NMI resources are managed separately, the others will still not be sleepable (at least not all of them). Cheers!