All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: linux-edac <linux-edac@vger.kernel.org>
Cc: Borislav Petkov <bp@suse.de>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>, Tony Luck <tony.luck@intel.com>,
	Tomasz Nowicki <tomasz.nowicki@linaro.org>,
	"Chen, Gong" <gong.chen@linux.intel.com>,
	Wolfram Sang <wsa@the-dreams.de>, Lv Zheng <lv.zheng@intel.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/5] GHES: Carve out error queueing in a separate function
Date: Fri, 27 Mar 2015 10:22:54 +0100	[thread overview]
Message-ID: <1427448178-20689-2-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1427448178-20689-1-git-send-email-bp@alien8.de>

From: Borislav Petkov <bp@suse.de>

Make the handler more readable.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 drivers/acpi/apei/ghes.c | 51 +++++++++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 22 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index e82d0976a5d0..fe1e41bf5609 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -797,6 +797,32 @@ static void ghes_print_queued_estatus(void)
 	}
 }
 
+/* Save estatus for further processing in IRQ context */
+static void __process_error(struct ghes *ghes)
+{
+#ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG
+	u32 len, node_len;
+	struct ghes_estatus_node *estatus_node;
+	struct acpi_hest_generic_status *estatus;
+
+	if (ghes_estatus_cached(ghes->estatus))
+		return;
+
+	len = cper_estatus_len(ghes->estatus);
+	node_len = GHES_ESTATUS_NODE_LEN(len);
+
+	estatus_node = (void *)gen_pool_alloc(ghes_estatus_pool, node_len);
+	if (!estatus_node)
+		return;
+
+	estatus_node->ghes = ghes;
+	estatus_node->generic = ghes->generic;
+	estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
+	memcpy(estatus, ghes->estatus, len);
+	llist_add(&estatus_node->llnode, &ghes_estatus_llist);
+#endif
+}
+
 static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs)
 {
 	struct ghes *ghes, *ghes_global = NULL;
@@ -832,32 +858,13 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs)
 	}
 
 	list_for_each_entry_rcu(ghes, &ghes_nmi, list) {
-#ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG
-		u32 len, node_len;
-		struct ghes_estatus_node *estatus_node;
-		struct acpi_hest_generic_status *estatus;
-#endif
 		if (!(ghes->flags & GHES_TO_CLEAR))
 			continue;
-#ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG
-		if (ghes_estatus_cached(ghes->estatus))
-			goto next;
-		/* Save estatus for further processing in IRQ context */
-		len = cper_estatus_len(ghes->estatus);
-		node_len = GHES_ESTATUS_NODE_LEN(len);
-		estatus_node = (void *)gen_pool_alloc(ghes_estatus_pool,
-						      node_len);
-		if (estatus_node) {
-			estatus_node->ghes = ghes;
-			estatus_node->generic = ghes->generic;
-			estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
-			memcpy(estatus, ghes->estatus, len);
-			llist_add(&estatus_node->llnode, &ghes_estatus_llist);
-		}
-next:
-#endif
+
+		__process_error(ghes);
 		ghes_clear_estatus(ghes);
 	}
+
 #ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG
 	irq_work_queue(&ghes_proc_irq_work);
 #endif
-- 
2.3.3

  reply	other threads:[~2015-03-27  9:22 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27  9:22 [RFC PATCH 0/5] GHES NMI handler cleanup Borislav Petkov
2015-03-27  9:22 ` Borislav Petkov [this message]
2015-03-27  9:22 ` [RFC PATCH 2/5] GHES: Carve out the panic functionality Borislav Petkov
2015-03-27  9:22 ` [RFC PATCH 3/5] GHES: Panic right after detection Borislav Petkov
2015-03-27  9:22 ` [RFC PATCH 4/5] GHES: Elliminate double-loop in the NMI handler Borislav Petkov
2015-03-27  9:22 ` [RFC PATCH 5/5] GHES: Make NMI handler have a single reader Borislav Petkov
2015-04-01  7:45   ` Jiri Kosina
2015-04-01 13:49     ` Borislav Petkov
2015-04-23  8:39       ` Jiri Kosina
2015-04-23  8:59         ` Borislav Petkov
2015-04-23 18:00           ` Luck, Tony
2015-04-23 18:00             ` Luck, Tony
2015-04-27 20:23             ` Borislav Petkov
2015-04-28 14:30     ` Don Zickus
2015-04-28 14:42       ` Don Zickus
2015-04-28 14:55       ` Borislav Petkov
2015-04-28 15:35         ` Don Zickus
2015-04-28 16:22           ` Borislav Petkov
2015-04-28 18:44             ` Don Zickus
2015-05-04 15:40               ` Borislav Petkov
2015-04-27  3:16   ` Zheng, Lv
2015-04-27  8:46     ` Borislav Petkov
2015-04-28  0:44       ` Zheng, Lv
2015-04-28  0:44         ` Zheng, Lv
2015-04-28  2:24       ` Zheng, Lv
2015-04-28  2:24         ` Zheng, Lv
2015-04-28  7:38         ` Borislav Petkov
2015-04-28 13:38   ` Zheng, Lv
2015-04-28 13:59     ` Borislav Petkov
2015-04-29  0:24       ` Zheng, Lv
2015-04-29  0:24         ` Zheng, Lv
2015-04-29  0:49       ` Zheng, Lv
2015-04-29  0:49         ` Zheng, Lv
2015-04-29  8:13         ` Borislav Petkov
2015-04-30  8:05           ` Zheng, Lv
2015-04-30  8:05             ` Zheng, Lv
2015-04-30  8:48             ` Borislav Petkov
2015-05-02  0:34               ` Zheng, Lv
2015-05-02  0:34                 ` Zheng, Lv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427448178-20689-2-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=gong.chen@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=rjw@rjwysocki.net \
    --cc=tomasz.nowicki@linaro.org \
    --cc=tony.luck@intel.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.