From patchwork Tue Jun 26 17:01:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 10489603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 364CD604D3 for ; Tue, 26 Jun 2018 17:04:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 230CE203B9 for ; Tue, 26 Jun 2018 17:04:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15A4628647; Tue, 26 Jun 2018 17:04:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE7612890B for ; Tue, 26 Jun 2018 17:02:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC9B96B026E; Tue, 26 Jun 2018 13:02:09 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A79916B026F; Tue, 26 Jun 2018 13:02:09 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9680D6B0270; Tue, 26 Jun 2018 13:02:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot0-f199.google.com (mail-ot0-f199.google.com [74.125.82.199]) by kanga.kvack.org (Postfix) with ESMTP id 677326B026E for ; Tue, 26 Jun 2018 13:02:09 -0400 (EDT) Received: by mail-ot0-f199.google.com with SMTP id b1-v6so11805064otf.22 for ; Tue, 26 Jun 2018 10:02:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=bPM/ZT8ZtkkXvE44UBeUU4tkiztR8DpMUDrVPraLDPE=; b=FVjGyJj/EZvxLPt0Fo+k+SSneoZyaHRDSwv/7rmmBzwE4493ch3vF4LQBP6syySQoB aVbakqSeQLngcwyfCGF0AwkTK4eIUN16XHgbDH/5DYou0SYm60f+8tM+yNei9mxQwDmf brC1Y1Ozmv2DkOlnOYU5YdTHoBNIQQJ2i0uv/7X7882kq3QTOuijZKQVjK2Tq3HnCZcl Tp4kRAeF3jPyfeUGNJa13NfVuTJi74rb8TKLfk8egVQXCueoYxxG5CY1BxRz4fzzO0kj LhL5bvLyl97uXQerdB1OLa8DKkUS3xsYq68y0RnVy7xzSn/eaAXRC4bYn2cb4HLMoN35 QlUw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=james.morse@arm.com X-Gm-Message-State: APt69E3BOK4tVIiVPVygtjPZ6ATxDD2J1eDvd6QGSmFkIraxrUXemrpW zuiEChKAUDGIMEi2c+iSuJMh4fwPbKITKQmjhbKZHinzOye6epQEHKHCgrsQquZFocz1JtZQOVs YfBSl76SmKrnt0EuuEUXti195Rbzq36Ua4YKb+Qk/EgaI3gG16vK+77OcLYhEmBSF7g== X-Received: by 2002:aca:654d:: with SMTP id j13-v6mr1429594oiw.0.1530032529087; Tue, 26 Jun 2018 10:02:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpenLPj/Y02HNZ45SUG8N32DK5rqb7s/XOs/h14fzzUVVeTx2Ix2v/4QVUINV++0KOHbaFaJ X-Received: by 2002:aca:654d:: with SMTP id j13-v6mr1429554oiw.0.1530032528182; Tue, 26 Jun 2018 10:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530032528; cv=none; d=google.com; s=arc-20160816; b=hUe9V/EGWyi/7jOX7vThW4MkubGKIZmAwzs321HK1fJdvJLrU7z7U0rH+lTquVkEKG rQZF1CeF9AQmu8kn5lKfuUJ7A8M/nx8QXt0/8T4p0p30v4b2KFchw4uP+dwupp7rqKU3 KySNd2+U5i/UjEPu+TXbryXrK2K9zm/UwBkfQLjiy+2HLU2FbdfOB1S+bHquj3+NY6Tb se2whs7VEvYL5xHU0rMbgzElCcpXClso4Zle+vDs630BebjcuW/Tux9VLXgUCnN+93sW K4b5l1OamkQVmMFGTv/sCToKAa+NeQ0wyZgIf4HSiaSE9um9ZcS+YUk7COoAduvF3heC vB0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bPM/ZT8ZtkkXvE44UBeUU4tkiztR8DpMUDrVPraLDPE=; b=D1znvcxs0grfua3aIzHjl7HFqIdisFw6apMMPCrumqOSICGB6UlmxiUriLy3lF8FBg B3KTRIxMh8nxR7Lf71n5k2Z5AtCjHuEzijTBYHcqkR5R3MMeaOPTCZ+Q4gKKDseFvUAK U0qud6bv9MmvWsxVA/ONH7JJtILGyQP/rmYwdU/LVaCUEjK7poFmy28d/YmF1/f6+MDn i6ogxPWnNdkweSxIv5/Pxx9eNSo5YUEJkoO4IN2y7nuXB+nmrfV21my5k2daKL+dMvLi KQ8wr6Dgd2hg6qqzzsLp6UVN2VGv6qKKFUjIAr5KfSTdjX9Erox43IopOfYGa1FG3KAH /hgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=james.morse@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id h63-v6si675328oth.307.2018.06.26.10.02.07 for ; Tue, 26 Jun 2018 10:02:08 -0700 (PDT) Received-SPF: pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of james.morse@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=james.morse@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 637221713; Tue, 26 Jun 2018 10:02:07 -0700 (PDT) Received: from melchizedek.cambridge.arm.com (melchizedek.cambridge.arm.com [10.1.206.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 256CB3F318; Tue, 26 Jun 2018 10:02:03 -0700 (PDT) From: James Morse To: linux-acpi@vger.kernel.org Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, Borislav Petkov , Marc Zyngier , Christoffer Dall , Will Deacon , Catalin Marinas , Naoya Horiguchi , Rafael Wysocki , Len Brown , Tony Luck , Tyler Baicar , Dongjiu Geng , Xie XiuQi , Punit Agrawal , jonathan.zhang@cavium.com, James Morse Subject: [PATCH v5 04/20] ACPI / APEI: Switch NOTIFY_SEA to use the estatus queue Date: Tue, 26 Jun 2018 18:01:00 +0100 Message-Id: <20180626170116.25825-5-james.morse@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626170116.25825-1-james.morse@arm.com> References: <20180626170116.25825-1-james.morse@arm.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Now that the estatus queue can be used by more than one notification method, we can move notifications that have NMI-like behaviour over to it, and start abstracting GHES's single in_nmi() path. Switch NOTIFY_SEA over to use the estatus queue. This makes it behave in the same way as x86's NOTIFY_NMI. Signed-off-by: James Morse Reviewed-by: Punit Agrawal Tested-by: Tyler Baicar --- drivers/acpi/apei/ghes.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index d7c46236b353..150fb184c7cb 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -58,6 +58,10 @@ #define GHES_PFX "GHES: " +#if defined(CONFIG_HAVE_ACPI_APEI_NMI) || defined(CONFIG_ACPI_APEI_SEA) +#define WANT_NMI_ESTATUS_QUEUE 1 +#endif + #define GHES_ESTATUS_MAX_SIZE 65536 #define GHES_ESOURCE_PREALLOC_MAX_SIZE 65536 @@ -681,7 +685,7 @@ static void ghes_estatus_cache_add( rcu_read_unlock(); } -#ifdef CONFIG_HAVE_ACPI_APEI_NMI +#ifdef WANT_NMI_ESTATUS_QUEUE /* * Handlers for CPER records may not be NMI safe. For example, * memory_failure_queue() takes spinlocks and calls schedule_work_on(). @@ -861,7 +865,7 @@ static void ghes_nmi_init_cxt(void) #else static inline void ghes_nmi_init_cxt(void) { } -#endif /* CONFIG_HAVE_ACPI_APEI_NMI */ +#endif /* WANT_NMI_ESTATUS_QUEUE */ static int ghes_ack_error(struct acpi_hest_generic_v2 *gv2) { @@ -977,20 +981,13 @@ static LIST_HEAD(ghes_sea); */ int ghes_notify_sea(void) { - struct ghes *ghes; - int ret = -ENOENT; - - rcu_read_lock(); - list_for_each_entry_rcu(ghes, &ghes_sea, list) { - if (!ghes_proc(ghes)) - ret = 0; - } - rcu_read_unlock(); - return ret; + return ghes_estatus_queue_notified(&ghes_sea); } static void ghes_sea_add(struct ghes *ghes) { + ghes_estatus_queue_grow_pool(ghes); + mutex_lock(&ghes_list_mutex); list_add_rcu(&ghes->list, &ghes_sea); mutex_unlock(&ghes_list_mutex); @@ -1002,6 +999,8 @@ static void ghes_sea_remove(struct ghes *ghes) list_del_rcu(&ghes->list); mutex_unlock(&ghes_list_mutex); synchronize_rcu(); + + ghes_estatus_queue_shrink_pool(ghes); } #else /* CONFIG_ACPI_APEI_SEA */ static inline void ghes_sea_add(struct ghes *ghes) { }