Received: by 10.223.176.46 with SMTP id f43csp627521wra; Fri, 26 Jan 2018 04:27:52 -0800 (PST) X-Google-Smtp-Source: AH8x2251MpaEavPaz7tndsyh1A5q3Va0v0RFJBMT3y+WWYvXVQEgvUOwkbOrQ4NFVgFbH7di4sSR X-Received: by 10.101.80.69 with SMTP id k5mr4641414pgo.443.1516969672350; Fri, 26 Jan 2018 04:27:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516969672; cv=none; d=google.com; s=arc-20160816; b=ZeXZtJIrdgnieVMt1NHzydetSuCCTkQE0BAgEtv44qnHRn7KhSYlXBVZW+nEdx+llN N172zkh3EriwZ5psQGisFofzPtYoWn4BusWeYl9lNQf7vlSNbbJjAyuIfhT2retvUNZS lVJtMJZlJaI26d1I7EpaKKS+l7P2g4LOpJXQWW5Ol3Q6KgR+7qvxnob6juh048r3Jw+U Lg55INnu4mDERDKR6ByD3mClyyTos3uVIaQ52VodTTn9X04mwLq4JsbSZ9AjQhJE/A7F 6ZSRpCifvXp9zOIR9tQy53aSTwkPQoIjxbQeOpmwdUNm3SjgqCf8hXap8TGxo1rvP0yE MUzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=JQ5++8FTt/UcVj9rI9P1ta8ONjvKojVpCL5ZZLg3+mI=; b=FR6lG/JZn6aRrwT4fRtK/vpsUdF3sg8fB2Kkvmb7rQ0QYzAx327ONrPfoSx+zLkPz7 EGHbm9ZflW0ZXgmSZ73UkKKm6VThN9wYAmeh+X7f8ry6fudjTMYznkryTPUV8/agdPSW 7I75pVw8qpflVCiQgblHE9N5rjGxQvsjRI/rCe7Xv24VCuIQfUNgQgYgIKeNU8Lwq5gV /l8Qis4wcdDLvKvbI6OJhw+kLixsOp3If1l69yvNteYQu+f3UieGJO4c2BJMlvFevIEr DBwiehkVqL9GXwiQI3TXmc+gaLZQIChLGbYgeJK2wMBXhyXfJhV9qk1P+fFJOkVkry9j yX4Q== ARC-Authentication-Results: i=1; mx.google.com; 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 64-v6si3663283ply.277.2018.01.26.04.27.37; Fri, 26 Jan 2018 04:27:52 -0800 (PST) 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; 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 S1751927AbeAZMZU (ORCPT + 99 others); Fri, 26 Jan 2018 07:25:20 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:42097 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751804AbeAZMZS (ORCPT ); Fri, 26 Jan 2018 07:25:18 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E36433963CE1E; Fri, 26 Jan 2018 20:25:04 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Fri, 26 Jan 2018 20:25:00 +0800 From: Xie XiuQi To: , , , , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v5 2/3] GHES: add a notify chain for process memory section Date: Fri, 26 Jan 2018 20:31:24 +0800 Message-ID: <1516969885-150532-3-git-send-email-xiexiuqi@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516969885-150532-1-git-send-email-xiexiuqi@huawei.com> References: <1516969885-150532-1-git-send-email-xiexiuqi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a notify chain for process memory section, with which other modules might do error recovery. Signed-off-by: Xie XiuQi Tested-by: Wang Xiongfeng Tested-by: Tyler Baicar --- drivers/acpi/apei/ghes.c | 10 ++++++++++ include/acpi/ghes.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index cff671d..1f0ebfb 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -109,6 +109,9 @@ static inline bool is_hest_type_generic_v2(struct ghes *ghes) static LIST_HEAD(ghes_hed); static DEFINE_MUTEX(ghes_list_mutex); +ATOMIC_NOTIFIER_HEAD(ghes_mem_err_chain); +EXPORT_SYMBOL(ghes_mem_err_chain); + /* * Because the memory area used to transfer hardware error information * from BIOS to Linux can be determined only in NMI, IRQ or timer @@ -441,6 +444,13 @@ static void ghes_do_proc(struct ghes *ghes, if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata); + struct ghes_mem_err mem; + + mem.notify_type = ghes->generic->notify.type; + mem.severity = gdata->error_severity; + mem.mem_err = mem_err; + + atomic_notifier_call_chain(&ghes_mem_err_chain, 0, &mem); ghes_edac_report_mem_error(ghes, sev, mem_err); diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h index d626367..921ebf1 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -124,4 +124,12 @@ static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata) extern void ghes_arm_process_error(struct ghes *ghes, struct cper_sec_proc_arm *err); +struct ghes_mem_err { + int notify_type; + int severity; + struct cper_sec_mem_err *mem_err; +}; + +extern struct atomic_notifier_head ghes_mem_err_chain; + #endif /* GHES_H */ -- 1.8.3.1