From patchwork Fri Mar 27 09:22:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 6104551 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9508B9FB9E for ; Fri, 27 Mar 2015 09:25:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C1D97203F7 for ; Fri, 27 Mar 2015 09:25:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D172F203ED for ; Fri, 27 Mar 2015 09:25:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753103AbbC0JYz (ORCPT ); Fri, 27 Mar 2015 05:24:55 -0400 Received: from mail.skyhub.de ([78.46.96.112]:58647 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753139AbbC0JYv (ORCPT ); Fri, 27 Mar 2015 05:24:51 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1427448289; bh=1P9JCOazIUKfloomCqYTDuyB238R17v6cRolDp2Hm/o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=CDNg GYiayQ3hIKf1EfRX0A7aqpvpnynC4/ZxdHQHpJLO1xJHsKSeTrrIhE6LFuXoZQKuHYm uQdS3NpimeyBLq9iWT4nzpnpNgZ8eJ0p8+pKdfd2XH7JIun61ryBl2YqhIhEe28VRoQ 8rtz1mBwQ2riV3eElWTQIg7EP1Z+mL9gQ= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 53l1QvqkyDGj; Fri, 27 Mar 2015 10:24:49 +0100 (CET) Received: from pd.tnic (p5DDC6BAA.dip0.t-ipconnect.de [93.220.107.170]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 6BFD81D9966; Fri, 27 Mar 2015 10:24:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1427448289; bh=1P9JCOazIUKfloomCqYTDuyB238R17v6cRolDp2Hm/o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=CDNg GYiayQ3hIKf1EfRX0A7aqpvpnynC4/ZxdHQHpJLO1xJHsKSeTrrIhE6LFuXoZQKuHYm uQdS3NpimeyBLq9iWT4nzpnpNgZ8eJ0p8+pKdfd2XH7JIun61ryBl2YqhIhEe28VRoQ 8rtz1mBwQ2riV3eElWTQIg7EP1Z+mL9gQ= Received: by pd.tnic (Postfix, from userid 1000) id 2411B1617AE; Fri, 27 Mar 2015 10:23:01 +0100 (CET) From: Borislav Petkov To: linux-edac Cc: Borislav Petkov , "Rafael J. Wysocki" , Len Brown , Tony Luck , Tomasz Nowicki , "Chen, Gong" , Wolfram Sang , Lv Zheng , Naoya Horiguchi , 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 Message-Id: <1427448178-20689-2-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1427448178-20689-1-git-send-email-bp@alien8.de> References: <1427448178-20689-1-git-send-email-bp@alien8.de> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Borislav Petkov Make the handler more readable. No functionality change. Signed-off-by: Borislav Petkov --- 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