From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A19AC433DF for ; Fri, 5 Jun 2020 17:02:39 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F349E20870 for ; Fri, 5 Jun 2020 17:02:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F349E20870 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 85D101009F03B; Fri, 5 Jun 2020 09:57:26 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.210.66; helo=mail-ot1-f66.google.com; envelope-from=rjwysocki@gmail.com; receiver= Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E30F41009F036 for ; Fri, 5 Jun 2020 09:57:23 -0700 (PDT) Received: by mail-ot1-f66.google.com with SMTP id o13so8148181otl.5 for ; Fri, 05 Jun 2020 10:02:36 -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=MuI6tG8Gqn6sR/MBfW7NMZV1aM9kjLL2Is1LvyQq5bLkreLtSMt3oPXq+ZGnJAPi/Y +qxGTExxjf/4NA9VjUauLm4ikYtb060Ntj0QuxPV+RLZ8IVqMt+J3oITRHWgTc49fGGt 7PDLW34QFHsRZCcgv3Y7LzCSvAfkOM4XBGs9VJ6TJdGlLD/gPLunVprs5wHaFlNNZJUX NayH1gXPLwusfKnenvcDZdFRkNAhFYlVmlxmJKCHl1L/7EkDwyj+c5e9QYNITy2bmQ0X Y4oBbPfZchPSdMqdIO2KMrRtIWgRc0TLRNul1Q8eehAM8CdYISJbLdz2PHLGKsnXSolI fiIg== X-Gm-Message-State: AOAM531qv7WdmpVej2pot0mGW3FYzeGM9jFaEeH8eOKU5o16oxrhUGJE q6RelT6eE7UTyO2ckFCHSsVq6Om16xvM4VTNuCE= X-Google-Smtp-Source: ABdhPJwS8cBnOQWNPzEMxfpCbrXxhygVWp3mt32v/HYym+XE4ggBkygQ0R0aKSiHguylxsBfEP6pBBRYzxoafwh8WA0= 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 Message-ID-Hash: J7KHQVEPAU4RXFGSLJM663JIYDRBAUNW X-Message-ID-Hash: J7KHQVEPAU4RXFGSLJM663JIYDRBAUNW X-MailFrom: rjwysocki@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: "Rafael J. Wysocki" , Rafael Wysocki , Stable , Len Brown , Borislav Petkov , James Morse , Erik Kaneda , Myron Stowe , "Rafael J. Wysocki" , Andy Shevchenko , Linux Kernel Mailing List , ACPI Devel Maling List , "linux-nvdimm@lists.01.org" X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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! _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5933DC433DF for ; Fri, 5 Jun 2020 17:02:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32C94206DB for ; Fri, 5 Jun 2020 17:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591376557; bh=wTZiSOR+igC/gRCry3GVm0Zp9Ahw3ee9N7yu1QHMPRc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=CtZqwrJirdpxvgUHEmi/il4J/T1hzYj6uiYz3Ih6LsYTUOgy+JxpSyVBe4b52OG1A zmHHylybbtxoKsOipbgV5XclZLtL/+mmjC33HvMo6sFKJfenGWNWVmbUwLFmVoVWq/ fXgIK+gbJCQfmyrKxEDZpp0o0/TBORSiDkIif9b8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726842AbgFERCg (ORCPT ); Fri, 5 Jun 2020 13:02:36 -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-Google-Smtp-Source: ABdhPJwS8cBnOQWNPzEMxfpCbrXxhygVWp3mt32v/HYym+XE4ggBkygQ0R0aKSiHguylxsBfEP6pBBRYzxoafwh8WA0= 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-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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!