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 43029C433E1 for ; Mon, 22 Jun 2020 15:28:07 +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 244CA206D7 for ; Mon, 22 Jun 2020 15:28:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 244CA206D7 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 0A20F10FC72A4; Mon, 22 Jun 2020 08:28:07 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.210.68; helo=mail-ot1-f68.google.com; envelope-from=rjwysocki@gmail.com; receiver= Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) (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 C16E610FC729F for ; Mon, 22 Jun 2020 08:28:05 -0700 (PDT) Received: by mail-ot1-f68.google.com with SMTP id g7so13329027oti.13 for ; Mon, 22 Jun 2020 08:28:05 -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=i2c95N6ci/w7OThvHcf5Fy4XsnnDSG6ckQoNsGPl1eo=; b=DqTL45lKv5qel/A5k1cxJPqUEMEAhcnjI0Ug85k0wLUGg5F4r0nkA14ASo7TXAdzFg CJbs9TcoYb+qKk01yKzhcdzVbY49KqnwAAD/hT7IjPYaKs+IDvZzvJwuvHBaMICT8Qx+ DB3/LA+8ZVP7V5C4x2z+YEwvEzmS2JRySsCZaty28xR1XpnG8bDRzYEsMcCIV8XOpcb6 k+bMN6bX7dMx05n6ESBE2kIAViRFXUigr7X/OIpIhfbI6/2wa+FbxRZ02LBrm2Droks5 qn+wQO/jtgTdjpnVz172d69grmrGX0Ng/oAMdFsuuqqhoQL9Ia2a3D74OFXE6pgKtawp sPRg== X-Gm-Message-State: AOAM530IG3VRck7On63k21yUNLC3Co+1jX4oi8XkXmt/Ia92ZzWEhUwr R2H04io+0X0tY2iBBElcn714b67wO2rCazVIp2A= X-Google-Smtp-Source: ABdhPJwPycask6rXfFgrsgFmggHDR562yU+PZHy41snSPCHC1tppXmJo1aa1PK+69GQNrvfUgNROeNC4pvEbtPnx6sM= X-Received: by 2002:a05:6830:10ca:: with SMTP id z10mr13946922oto.167.1592839684757; Mon, 22 Jun 2020 08:28:04 -0700 (PDT) MIME-Version: 1.0 References: <158889473309.2292982.18007035454673387731.stgit@dwillia2-desk3.amr.corp.intel.com> <2713141.s8EVnczdoM@kreacher> <1821880.vZFEW4x2Ui@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 22 Jun 2020 17:27:53 +0200 Message-ID: Subject: Re: [RFT][PATCH v2 2/4] ACPI: OSL: Add support for deferred unmapping of ACPI memory To: Andy Shevchenko Message-ID-Hash: 3QNQRQ5ATVAEQBTRLP4QQUJX5TVUWKVD X-Message-ID-Hash: 3QNQRQ5ATVAEQBTRLP4QQUJX5TVUWKVD 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" , Erik Kaneda , "Rafael J. Wysocki" , Len Brown , Borislav Petkov , James Morse , Myron Stowe , Andy Shevchenko , Linux Kernel Mailing List , ACPI Devel Maling List , "linux-nvdimm@lists.01.org" , Bob Moore 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 Mon, Jun 22, 2020 at 4:56 PM Andy Shevchenko wrote: > > On Mon, Jun 22, 2020 at 5:06 PM Rafael J. Wysocki wrote: > > > > From: "Rafael J. Wysocki" > > > > Implement acpi_os_unmap_deferred() and > > acpi_os_release_unused_mappings() and set ACPI_USE_DEFERRED_UNMAPPING > > to allow ACPICA to use deferred unmapping of memory in > > acpi_ex_system_memory_space_handler() so as to avoid RCU-related > > performance issues with memory opregions. > > ... > > > +static bool acpi_os_drop_map_ref(struct acpi_ioremap *map, bool defer) > > { > > - unsigned long refcount = --map->refcount; > > + if (--map->track.refcount) > > + return true; > > > > - if (!refcount) > > - list_del_rcu(&map->list); > > - return refcount; > > + list_del_rcu(&map->list); > > + > > > + if (defer) { > > + INIT_LIST_HEAD(&map->track.gc); > > + list_add_tail(&map->track.gc, &unused_mappings); > > > + return true; > > + } > > + > > + return false; > > A nit: > > Effectively it returns a value of defer. > > return defer; > > > } Do you mean that one line of code could be saved? Yes, it could. > > ... > > > @@ -416,26 +421,102 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) > > } > > > > mutex_lock(&acpi_ioremap_lock); > > + > > map = acpi_map_lookup_virt(virt, size); > > A nit: should it be somewhere else (I mean in another patch)? Do you mean the extra empty line? No, I don't think so, or the code style after this patch would not look consistent. > > if (!map) { > > ... > > > + /* Release the unused mappings in the list. */ > > + while (!list_empty(&list)) { > > + struct acpi_ioremap *map; > > + > > + map = list_entry(list.next, struct acpi_ioremap, track.gc); > > A nt: if __acpi_os_map_cleanup() (actually acpi_unmap() according to > the code) has no side effects, can we use list_for_each_entry_safe() > here? I actually prefer a do .. while version of this which saves the initial check (which has been carried out already). > > + list_del(&map->track.gc); > > + __acpi_os_map_cleanup(map); > > + } > > +} > > ... > > > @@ -472,16 +552,18 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) > > return; > > > > mutex_lock(&acpi_ioremap_lock); > > + > > map = acpi_map_lookup(addr, gas->bit_width / 8); > > A nit: should it be somewhere else (I mean in another patch)? Nope. Thanks! _______________________________________________ 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 BB9A8C433DF for ; Mon, 22 Jun 2020 15:28:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93C0D2071A for ; Mon, 22 Jun 2020 15:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592839686; bh=YnHPgJqw8Zmqnuh2F9azOANz5078hmhWIbZgAwtFJqw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=HWRF1dYtNEVBzwpE6crhj7vAcV1wZwi/zHEL9PXQEseof/IOtQ4bRBNZuaQlvedSZ AyljpepPucED35bHlJa8sWmrhgwexBrDQRqPaR/Yb4mHOx0dRTKejZ6JSNpk8USliE nJoUhD4777mQOAaPOg0eDy7lROdBPwOD/ZiifLqA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729049AbgFVP2G (ORCPT ); Mon, 22 Jun 2020 11:28:06 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:39324 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728293AbgFVP2F (ORCPT ); Mon, 22 Jun 2020 11:28:05 -0400 Received: by mail-ot1-f68.google.com with SMTP id g5so13358718otg.6; Mon, 22 Jun 2020 08:28:05 -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=i2c95N6ci/w7OThvHcf5Fy4XsnnDSG6ckQoNsGPl1eo=; b=f7vKEfOXl4WaAdH5q0JB9U8HDfCF6CPBxTeblqh57+TPvlampTHUIY7bwvNXwqklSW waBCl43ICIL8FfprfAyq5EQG8NbbaHzlB2o/OrDLPz6v4gsX+Ox+foy1Wsz+lh4A89ls SiEUIBbvHjxBzELGSqOWrzy8x7a4/iKMxGqQQl7wlgZHZXYYSThoqiqNEUAgCjJ0cEfa 5ihyLa2DRzY4d2rtF8imVjRjFoNshZIeqwgtS85coVZYHbe4yu5Xv7v2oZiJ0v4kddFe gbB4//xCRGLa6gNVuhgZNqlHchqMluJvhhbJ5nxen826ZDVallCReJJJlc/LchAYmwbm ynKA== X-Gm-Message-State: AOAM531cafPIiCs1bMyB/vpi1UFjH4He0txYcePvV4689kR4nZhhdP9+ MEPaZo0itaJxHQq4e2NyPXZcOm+hrLW1I5twc04= X-Google-Smtp-Source: ABdhPJwPycask6rXfFgrsgFmggHDR562yU+PZHy41snSPCHC1tppXmJo1aa1PK+69GQNrvfUgNROeNC4pvEbtPnx6sM= X-Received: by 2002:a05:6830:10ca:: with SMTP id z10mr13946922oto.167.1592839684757; Mon, 22 Jun 2020 08:28:04 -0700 (PDT) MIME-Version: 1.0 References: <158889473309.2292982.18007035454673387731.stgit@dwillia2-desk3.amr.corp.intel.com> <2713141.s8EVnczdoM@kreacher> <1821880.vZFEW4x2Ui@kreacher> In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 22 Jun 2020 17:27:53 +0200 Message-ID: Subject: Re: [RFT][PATCH v2 2/4] ACPI: OSL: Add support for deferred unmapping of ACPI memory To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Dan Williams , Erik Kaneda , "Rafael J. Wysocki" , Len Brown , Borislav Petkov , Ira Weiny , James Morse , Myron Stowe , Andy Shevchenko , Linux Kernel Mailing List , ACPI Devel Maling List , "linux-nvdimm@lists.01.org" , Bob Moore 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 Mon, Jun 22, 2020 at 4:56 PM Andy Shevchenko wrote: > > On Mon, Jun 22, 2020 at 5:06 PM Rafael J. Wysocki wrote: > > > > From: "Rafael J. Wysocki" > > > > Implement acpi_os_unmap_deferred() and > > acpi_os_release_unused_mappings() and set ACPI_USE_DEFERRED_UNMAPPING > > to allow ACPICA to use deferred unmapping of memory in > > acpi_ex_system_memory_space_handler() so as to avoid RCU-related > > performance issues with memory opregions. > > ... > > > +static bool acpi_os_drop_map_ref(struct acpi_ioremap *map, bool defer) > > { > > - unsigned long refcount = --map->refcount; > > + if (--map->track.refcount) > > + return true; > > > > - if (!refcount) > > - list_del_rcu(&map->list); > > - return refcount; > > + list_del_rcu(&map->list); > > + > > > + if (defer) { > > + INIT_LIST_HEAD(&map->track.gc); > > + list_add_tail(&map->track.gc, &unused_mappings); > > > + return true; > > + } > > + > > + return false; > > A nit: > > Effectively it returns a value of defer. > > return defer; > > > } Do you mean that one line of code could be saved? Yes, it could. > > ... > > > @@ -416,26 +421,102 @@ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) > > } > > > > mutex_lock(&acpi_ioremap_lock); > > + > > map = acpi_map_lookup_virt(virt, size); > > A nit: should it be somewhere else (I mean in another patch)? Do you mean the extra empty line? No, I don't think so, or the code style after this patch would not look consistent. > > if (!map) { > > ... > > > + /* Release the unused mappings in the list. */ > > + while (!list_empty(&list)) { > > + struct acpi_ioremap *map; > > + > > + map = list_entry(list.next, struct acpi_ioremap, track.gc); > > A nt: if __acpi_os_map_cleanup() (actually acpi_unmap() according to > the code) has no side effects, can we use list_for_each_entry_safe() > here? I actually prefer a do .. while version of this which saves the initial check (which has been carried out already). > > + list_del(&map->track.gc); > > + __acpi_os_map_cleanup(map); > > + } > > +} > > ... > > > @@ -472,16 +552,18 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) > > return; > > > > mutex_lock(&acpi_ioremap_lock); > > + > > map = acpi_map_lookup(addr, gas->bit_width / 8); > > A nit: should it be somewhere else (I mean in another patch)? Nope. Thanks!