From patchwork Fri Sep 21 22:16:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 10611019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD4ED5A4 for ; Fri, 21 Sep 2018 22:18:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B5A02AD9C for ; Fri, 21 Sep 2018 22:18:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C1D52AAD0; Fri, 21 Sep 2018 22:18:03 +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=unavailable 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 1D45B29D97 for ; Fri, 21 Sep 2018 22:18:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C51B8E0015; Fri, 21 Sep 2018 18:18:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 09B4A8E0001; Fri, 21 Sep 2018 18:18:02 -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 EF3D08E0015; Fri, 21 Sep 2018 18:18:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by kanga.kvack.org (Postfix) with ESMTP id C2F8C8E0001 for ; Fri, 21 Sep 2018 18:18:01 -0400 (EDT) Received: by mail-ot1-f72.google.com with SMTP id n23-v6so13825538otl.2 for ; Fri, 21 Sep 2018 15:18:01 -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:mime-version :content-transfer-encoding; bh=uhuKrpMkALaclkRhTZlwBer2cfI37HrF+E5FN6AkaoY=; b=nV7c+wWgMlvos09scB7q/Jb4jIKiKLr2EzrqrQb0Fai3dgkJWzmuf2IE2t4ULjJSVI gCz7KaFQeFAKFo2KAftX2FXBpwjsMgj3MSZ3OCBicqjWHmKKtxaofvCnpI3wqcq0g2YI AmY8NXlfEVOqiGH78BVVq6eyIjhOj5SwChKMDGewE/garzxq+B1C4pGZGgjPGp/7NACG Ii/DlgTKy6hUpuisEYn9aFW1tQeDqPKPrFu/AjPjitJDg0QWDdsv/ttE2lRECBTmEV5Y N5Us7qm2LOrMli5Yop7RvpzSl247gO+zlwfnGSrAZgYUiQtIXC7CT2bFBfUMP+admN/3 Z2CQ== 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: APzg51DYTgg4BA/KsZIKFwM9UZcusM8CLx+W8HfEfGM8GgeOtys1Q9fY x5bmkKtE0QmuhTfIjnMsYPLx6i3+3rX9PbvGCQW6GC+/2yysY9BYUDEd/xPEpLn/HPjYOoPQjfJ Gb0mTMqORpbth0FrfmpomG8k7ApJ0KkGhoLAG0NU/0+TbhfeIbhBZmyuXbIjuLutClw== X-Received: by 2002:aca:e089:: with SMTP id x131-v6mr305253oig.221.1537568281582; Fri, 21 Sep 2018 15:18:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYq3WJTwL/WxKJpy2bKOKQ1czj28tGlbBoeeAYXI4Gc63zQurkoxQNixHjEooeMR7w7FlYW X-Received: by 2002:aca:e089:: with SMTP id x131-v6mr305220oig.221.1537568280745; Fri, 21 Sep 2018 15:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537568280; cv=none; d=google.com; s=arc-20160816; b=Y6V2ngLU5Ktm37vI4wUGjY065vOrNCyqwpoxREPlkC60ziPg2YCHBmcIXXYwAbvzeg cL4RuFhKGU4pWtHc8mUGxBJfFLvMOOTRgiLCLEdSehZP6Djm5vKLa8EecFDkG1BEJCvM WSlPeU9BURikxd/4YCdVfBbHc/oe3wJL1/9Lfuh0TSm7uIqOYigxDQW5Ezxe71q+fEfT VH0sx7fW1tfkKY7Ik4cLAK3BHdpLrtrKb57JGyqUB3EwwQtlQYmxKKhFBp4j6B/mQi6f 6BURFMVP51WvXWVXaNTS0O8NHuxDV/zKKHnF0bytZU+c6seVpxIjpEmtrMzG7rALvgSQ NzFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=uhuKrpMkALaclkRhTZlwBer2cfI37HrF+E5FN6AkaoY=; b=hTZ+WXqcJcM0zZbapEBA/jpaumtOD5im4JPDo66vhekEqO7SRvcAPOgZSApzKLeY1C ttY7gdgglJU0iT9232olf9iV/oTrrlKIpjCMbZ4E0kXhWVxvutMxgAcOdjy/b5FhlWr4 aJKyuWx5MK6qlrG6XYRrDHIvDjA0kGJREfx3kq1kNWzrlIaZJZnvwB2AsLbRNZPhbKHe naxja+DbASpVAkB1Udb0pAapnYk6Zdmuon5i4ZQsEKCsyyh9V0lZ7I1INB0YIHvFC651 2WuaU/Zx5xjEfubJmlWk2pXgNaAPIyrGFQ4CY1mAFQjIDpeIvt3Xtpb0c/pHo65ZiCVa HHHw== 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 (usa-sjc-mx-foss1.foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id a65-v6si10915340otc.361.2018.09.21.15.18.00 for ; Fri, 21 Sep 2018 15:18:00 -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 5528C15BE; Fri, 21 Sep 2018 15:18:00 -0700 (PDT) Received: from melchizedek.Emea.Arm.com (melchizedek.emea.arm.com [10.4.12.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 404DE3F557; Fri, 21 Sep 2018 15:17:57 -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 v6 04/18] ACPI / APEI: Switch NOTIFY_SEA to use the estatus queue Date: Fri, 21 Sep 2018 23:16:51 +0100 Message-Id: <20180921221705.6478-5-james.morse@arm.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180921221705.6478-1-james.morse@arm.com> References: <20180921221705.6478-1-james.morse@arm.com> MIME-Version: 1.0 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) { }