Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3712092imm; Mon, 4 Jun 2018 08:06:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLaccBmS2jHRyvQTjOWBaNnJVx+kxDM9LNHxsW5j3KRlpGUPdNm4dpxoyxf4j+7LjtcbKWY X-Received: by 2002:a63:79c5:: with SMTP id u188-v6mr1102574pgc.111.1528124785351; Mon, 04 Jun 2018 08:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528124785; cv=none; d=google.com; s=arc-20160816; b=UXtEq5/m17r63MQCv+4t5H60mJNGecbgQJUM1IvrB/jozwhsZ/Jr4lTYVbxImGLKlU TrX4ENaehN56tAA77GKwpoffs880D9mP07wNXPb/BizWxq1Y32q/xjw8KfUAiYRGWKQ1 lpImACTjhk7F3+wQEtufIsJ+FoKc6OESmAE2KOlN9lvdAmeTna4pnZv0aasgOHGqi5UH KVVcixSkI4Jh3IUSy0GfzIJt+AJYgbLwUU49c5cRHh4da1laLiHjCezftKnZAUPNta4a EFaumhx89GAiTzsM6OvQV8SLrEZnjrHZGhvrUac+XxnGlnZooJS+s3Kp+2XtFdTapeql aVnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=rYdyg5AvJFz+WhLnWVt9GaZWfHKTGVW6Xqjt8TV6meg=; b=LXNVwRJvtg0i++79usTiIJTDCZHjbjAk8ve04Btoq4/tXsEy9WakBMLiI9cqVCCC/q W2p/ERX1lJMspPqVLZ0+Uty8zzTps8hXelCy/oIO3EvqORrx0OzVr0kZ7Z4nYQfsU9h4 p+0qV31JWY4dHEFD7jIV7ww9+gjelX9s8l9PA7Co9OmD+pmnfdzUiImxFIrbffCO2P0R xcct45dpBFIONRE/o69Oht/1iPxlTrvNDICMcLTGpIcHreFZP0flqtkF/qsqPZR6oSME TDhXSSW8fM34aS9/ShlvzSbRmvowlUFXKfYIVCwzxoO2ljHN+zMeu544qrvziHEj9GCk JUtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n2YhD5JY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n18-v6si12926432pgd.541.2018.06.04.08.06.11; Mon, 04 Jun 2018 08:06:25 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=n2YhD5JY; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753908AbeFDPFd (ORCPT + 99 others); Mon, 4 Jun 2018 11:05:33 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:45796 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753784AbeFDPFP (ORCPT ); Mon, 4 Jun 2018 11:05:15 -0400 Received: by mail-ot0-f193.google.com with SMTP id a5-v6so6899000otf.12; Mon, 04 Jun 2018 08:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rYdyg5AvJFz+WhLnWVt9GaZWfHKTGVW6Xqjt8TV6meg=; b=n2YhD5JYBNm4fAsGsaKP5JDTTtczI+ngkNZg2bghi6oYqivFjP9j9RXl57Bd4gaz+S R62s79alAfL6O6oyKr3I96AlyNJpH/JPNg4YZGRwv0Zl6ywF/VLdmB6aqjf53Da0FMSC 1aPkD2clj8pa2J6HwR4ojPJC9WDS3AiC0sjAuPCVGWpodE7JViDdrtjPVl/QPd/Dm1fw zi6Qe0q3NSCjtxHE9TqgL7PZtNtWP02PHea1mvRJfmieLbZ/k7TSShs1umdtzPdXBrIl MBDiT37AvXXLMIQo004ZiHwqKRK7buDfyusv03p44fE1jkgW4V/pS22wpTmDSYrwkDJt taGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rYdyg5AvJFz+WhLnWVt9GaZWfHKTGVW6Xqjt8TV6meg=; b=KgES7BRaClG8++WhgjYn0WatvL7dFEu8dr2rf/J7yXthv7WbgCl/+S9+k5p7FcqSiz 6LWkjSNtper9knZxjlpai1hOs7RtynTLZL7a4IPl/k7mOlEfHdhLylVPw24GMUP2babV g6ctMiNSnczUWnP01HJ1GCk4EfqpJkk06xq1cA0qHhhr/2fnMcQaLY7R7tuIs+c6Hv3u x3pgudy+tecyJkZX+EG7a2ZO77xTdig4wBY1e3Y6bqDO2dSejrUlp6eRS0rfOPSnBKwO dPwG2wSMPsIB6D/MuKZPj7HZVhfF1RHXZSo2BNyQTL+hgS8ABbKC5mr7XZglxfmW8eYA T0Ag== X-Gm-Message-State: APt69E1NxihIVk09EN7iUTZCKQh52a9kCGQ08VlP+MtLauYYchhn6Q/o Mq7n/Yg8eAgrZGsQV7PtSVAw23Pw X-Received: by 2002:a9d:2b64:: with SMTP id f33-v6mr9035986otd.342.1528124710132; Mon, 04 Jun 2018 08:05:10 -0700 (PDT) Received: from austins740xd.raid.adc.delllabs.net ([143.166.81.254]) by smtp.gmail.com with ESMTPSA id n72-v6sm3878332oig.6.2018.06.04.08.05.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jun 2018 08:05:09 -0700 (PDT) From: mrnuke X-Google-Original-From: mrnuke To: linux-acpi@vger.kernel.org, tony.luck@intel.com Cc: alex_gagniuc@dellteam.com, austin_bolen@dell.com, shyam_iyer@dell.com, Alexandru Gagniuc , Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, "Rafael J. Wysocki" , Len Brown , Mauro Carvalho Chehab , Robert Moore , Erik Schmauss , Tyler Baicar , Will Deacon , James Morse , "Jonathan (Zhixiong) Zhang" , Dongjiu Geng , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org Subject: [PATCH v8 3/3] acpi: apei: Do not panic() on PCIe errors reported through GHES Date: Mon, 4 Jun 2018 10:04:40 -0500 Message-Id: <20180604150443.1265-4-mrnuke@austins740xd.dell> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180604150443.1265-1-mrnuke@austins740xd.dell> References: <20180604150443.1265-1-mrnuke@austins740xd.dell> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexandru Gagniuc As previously noted, the policy to panic on any "Fatal" GHES error is not suitable for several classes of errors. The most notable is error containment. The correct policy is to achieve identical behavior to native error handling -- i.e. when not reported through GHES. This, in special cases, may not be possible, as we have to exit NMIs, which requires these special considerations PCIe AER errors are contained and reported at the root port. On DPC capable hardware, containment can be done by all downstream ports. DPC also has the added advantage of preventing future errors. Since these errors stop at the root port, we can do all the work we need to exit NMI and reach the error handler. This patch does away with the mindless crashing of the system, and correctly invokes the AER handler. When AER is not enabled, or the firmware doesn't provide sufficient information to identify the source of the error, the original panic() behavior is maintained. Signed-off-by: Alexandru Gagniuc --- drivers/acpi/apei/ghes.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 1b22e18168f5..f7126f6d8d52 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -425,7 +425,7 @@ static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int * GHES_SEV_RECOVERABLE -> AER_NONFATAL * GHES_SEV_RECOVERABLE && CPER_SEC_RESET -> AER_FATAL * These both need to be reported and recovered from by the AER driver. - * GHES_SEV_FATAL does not make it to this handler + * GHES_SEV_FATAL -> AER_FATAL */ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) { @@ -837,6 +837,45 @@ static inline void ghes_sea_remove(struct ghes *ghes) { } static struct llist_head ghes_estatus_llist; static struct irq_work ghes_proc_irq_work; +/* PCIe AER errors are safe if AER section contains enough info. */ +static int ghes_pcie_has_safe_handler(struct acpi_hest_generic_data *gdata) +{ + struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); + + if (pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID && + pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO && + IS_ENABLED(CONFIG_ACPI_APEI_PCIEAER)) + return true; + + return false; +} + +/* + * Do we have an error handler that we can safely reach? We're concerned with + * being able to notify an error handler by crossing the NMI/IRQ boundary, + * being able to schedule_work, and so forth. + */ +static int ghes_has_fatal_handler(struct ghes *ghes) +{ + int worst_sev, sec_sev; + bool safe = true; + struct acpi_hest_generic_data *gdata; + const guid_t *section_type; + const struct acpi_hest_generic_status *estatus = ghes->estatus; + + apei_estatus_for_each_section(estatus, gdata) { + section_type = (guid_t *)gdata->section_type; + + if (guid_equal(section_type, &CPER_SEC_PCIE)) + safe = ghes_pcie_has_safe_handler(gdata); + + if (!safe) + break; + } + + return safe; +} + /* * NMI may be triggered on any CPU, so ghes_in_nmi is used for * having only one concurrent reader. @@ -944,7 +983,7 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) } sev = ghes_cper_severity(ghes->estatus->error_severity); - if (sev >= GHES_SEV_FATAL) { + if ((sev >= GHES_SEV_FATAL) && !ghes_has_fatal_handler(ghes)) { oops_begin(); ghes_print_queued_estatus(); __ghes_panic(ghes); -- 2.14.3