Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2389340ybi; Sat, 1 Jun 2019 15:32:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjY1S4OHLLXdtPWAT4dcUJyO368f7gapRy82URJtY2B86Ee+PxDjbczu5JOHnRdHZhwSKs X-Received: by 2002:a63:b547:: with SMTP id u7mr18707791pgo.322.1559428358823; Sat, 01 Jun 2019 15:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559428358; cv=none; d=google.com; s=arc-20160816; b=a5KFx+Q4fwz1H1nBOVGry5E9oCz7D6V1+CHq+jEQhIILL5V1V4+PIrA5PD/aWFedrK uXz3QS6HnnY2zHRi4bOKLzWc8VhmQkky28KHGUph63XE78FRrCw4CC9Z6yEt/i5grgRQ zkmrGEyUJXKduORf48b43QL5R5e9MZrbPnHbPZveLrnp8tR1K6EL/cdCq7kyY1Qtzc15 vfkffcCcoLiHtidAThYnaEF8SPOgBeOOderkXCteVXIiX2KStPWLUezlwS+EsTup62D9 bX7ugWlhYPgEVhrifg4aPsNYPUPPRWCgn5Si8fqvu6NAm5Z0Hgazxp53gHGbqkNIjP2c G+Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z4Z5Q8yj6p64Y2o7Spib8gfVriUeNJkKQsEzc/+Hzz0=; b=r7QhPjllgyh6g9FjwslBfRRoYfvkUuSsITU4A72gkSe0si+QYxvW46zf3sFiodBLkn AkeKurfoHGczopT5y8OaDpTjLCBtkz0BspEQYyFseXE/aZLtLd9Qy4fitOe6D4W/LQah m3Xg5VVZq6F1WmLrck64fEYdCNQF5GzVN44oqBtLfHESrJrj+kEixEvmEmpFcKdu9SJQ cXbB4Qj87gOKXHdPZQzMtFN3pY6C72iyfzeSM9fQq5w/874MwS9mSKSDdW2TakFrsjCl wgrRDbmlNFZGUcDVrIMj79EmjV3GaQyfuQJjNVm3gbvmrS3f7BZtdD64ZWQjIYiJJH62 c8Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=tn0zxaPZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si3951647pgm.548.2019.06.01.15.31.41; Sat, 01 Jun 2019 15:32:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=tn0zxaPZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726921AbfFAW2N (ORCPT + 99 others); Sat, 1 Jun 2019 18:28:13 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36763 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbfFAW2J (ORCPT ); Sat, 1 Jun 2019 18:28:09 -0400 Received: by mail-pf1-f193.google.com with SMTP id u22so8352906pfm.3 for ; Sat, 01 Jun 2019 15:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z4Z5Q8yj6p64Y2o7Spib8gfVriUeNJkKQsEzc/+Hzz0=; b=tn0zxaPZcEF0gzwva8HqnPjJia9DDhSQmHjOrC5LIgyWnnOofGPjmYj/hXfVZ8L0em XP3bB8/bqiw1eHWRAsDs+Eo+KMd0muYlR7W1IGD9w2kQhutp6W3nJjVkUHo/gqw0gscT hSNuQPr6j2Tn6vwct85U2AwqZoqgLSmSxBAAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z4Z5Q8yj6p64Y2o7Spib8gfVriUeNJkKQsEzc/+Hzz0=; b=ADfKbYpMQAFzTQYFayNogKyyV0NyABjtgkVAlX94hooWq4mM4+BJw2o0MCuSb5zN3R /XUvR2NdTs8lRXKTeteq7thZ8yQJ+gi71aLnElOScYWl4KT7eLhNjcTUOx6sEEhzshjg g7bhqaIceqUFj3EzIJiVcTHv4+QpxHtCtSfBq4Sqk3HRfLHEcbqTBKpuUeAqoF6uy84q rNyqvY+1XAVX9on9DVqrZ9K2Etb6V60AnWDK2icx/cyfpIR+v2p1JYFV8akMVIIvs+H6 wLqzgK8aGJrzrvU25qiqoTT8B2MZvbuitDEqM/tZJ2iiuiKnmhtyTNcmsRCIp1npUcWg 8tEg== X-Gm-Message-State: APjAAAW+9M9YZ3ODeg4G5SprZXs+UT29I5Qdps9S542n61nuZ1/NawXu rdSkf1oA9HU9XVJdchNPcLATj8wEyNZ9sA== X-Received: by 2002:a63:a34c:: with SMTP id v12mr17850914pgn.198.1559428087981; Sat, 01 Jun 2019 15:28:07 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id t33sm9908018pjb.1.2019.06.01.15.28.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 01 Jun 2019 15:28:07 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Alexey Kuznetsov , Bjorn Helgaas , Borislav Petkov , "David S. Miller" , edumazet@google.com, Greg Kroah-Hartman , Hideaki YOSHIFUJI , "H. Peter Anvin" , Ingo Molnar , Josh Triplett , keescook@chromium.org, kernel-hardening@lists.openwall.com, Lai Jiangshan , Len Brown , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, Mathieu Desnoyers , neilb@suse.com, netdev@vger.kernel.org, oleg@redhat.com, "Paul E. McKenney" , Pavel Machek , peterz@infradead.org, "Rafael J. Wysocki" , rcu@vger.kernel.org, Steven Rostedt , Tejun Heo , Thomas Gleixner , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)) Subject: [RFC 6/6] acpi: Use built-in RCU list checking for acpi_ioremaps list Date: Sat, 1 Jun 2019 18:27:38 -0400 Message-Id: <20190601222738.6856-7-joel@joelfernandes.org> X-Mailer: git-send-email 2.22.0.rc1.311.g5d7573a151-goog In-Reply-To: <20190601222738.6856-1-joel@joelfernandes.org> References: <20190601222738.6856-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org list_for_each_entry_rcu has built-in RCU and lock checking. Make use of it for acpi_ioremaps list traversal. Signed-off-by: Joel Fernandes (Google) --- drivers/acpi/osl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f29e427d0d1d..c8b5d712c7ae 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -94,6 +95,7 @@ struct acpi_ioremap { static LIST_HEAD(acpi_ioremaps); static DEFINE_MUTEX(acpi_ioremap_lock); +#define acpi_ioremap_lock_held() lock_is_held(&acpi_ioremap_lock.dep_map) static void __init acpi_request_region (struct acpi_generic_address *gas, unsigned int length, char *desc) @@ -220,7 +222,7 @@ acpi_map_lookup(acpi_physical_address phys, acpi_size size) { struct acpi_ioremap *map; - list_for_each_entry_rcu(map, &acpi_ioremaps, list) + list_for_each_entry_rcu(map, &acpi_ioremaps, list, acpi_ioremap_lock_held()) if (map->phys <= phys && phys + size <= map->phys + map->size) return map; @@ -263,7 +265,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) { struct acpi_ioremap *map; - list_for_each_entry_rcu(map, &acpi_ioremaps, list) + list_for_each_entry_rcu(map, &acpi_ioremaps, list, acpi_ioremap_lock_held()) if (map->virt <= virt && virt + size <= map->virt + map->size) return map; -- 2.22.0.rc1.311.g5d7573a151-goog