From patchwork Mon Dec 3 18:05:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 10710223 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 442661057 for ; Mon, 3 Dec 2018 18:07:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 386FD2B47E for ; Mon, 3 Dec 2018 18:07:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B55F2B48F; Mon, 3 Dec 2018 18:07:11 +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 BE82C2B47E for ; Mon, 3 Dec 2018 18:07:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B42AE6B6A7B; Mon, 3 Dec 2018 13:07:05 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AF3196B6A7C; Mon, 3 Dec 2018 13:07:05 -0500 (EST) 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 A0CFD6B6A7D; Mon, 3 Dec 2018 13:07:05 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by kanga.kvack.org (Postfix) with ESMTP id 74F756B6A7B for ; Mon, 3 Dec 2018 13:07:05 -0500 (EST) Received: by mail-oi1-f197.google.com with SMTP id p131so1297616oig.10 for ; Mon, 03 Dec 2018 10:07:05 -0800 (PST) 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=1h3n0IWtDadO1PFfu0yti7m1Cb4M4Vp3Bsov6nNlZVc=; b=c3GTzFWQgl4/oo4zO0i4HznqMFkGgbrtCZ3VgBnrYFtRh8w1ls4RRkisp4gzBLf/Bk 4ZY2Wb+Re4Z0xls5fodBgngpFtjPn2rIdW4wWtDqssYZ58bmytE7kvETYejSse7qPyE0 PeDMV4+W/JZNS1xQIbd0d1SPsUclXHxJKLWYVCRrqPxo8e8XRFt8vXaWMr+XgiDTKBC7 ZHnezOjLaQ0HMeJdUD88YVabGiCLVDjzZ9iLRK3pNRCuHIbBlD6UoqSGl/vffZ8W7vBU opR30FiLT7BLQm1ZpN0I7RHvNyS17JzTc2gHJMT2gfPpOyv/MYSUZtNZDfZSOejIupWe F5CQ== 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: AA+aEWZTJb5U316ok3GIEUz+Ct4gCpGnnrTqAguZHa6jBT1A2glk5Ept GhlMsiIR9OMI98js9stjV+2aaYTMyge+YMmowGzKHRp5De06tAXdckogjpr1pf17nzl3CaoYWRz ber+5/jg6OPlO0/bKuPp+w6C/FZQeSbEaKFdJ1MKayp7+DmgGyyu8E3oitY6nR5wQLQ== X-Received: by 2002:a9d:620a:: with SMTP id g10mr10238376otj.249.1543860425179; Mon, 03 Dec 2018 10:07:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/X2XiImt5VBvn5o1gSpVNaNiN7KgykOpU6ZYZA+LFHUN55LXo2zAZGHAt6a7ReELqrQfDy3 X-Received: by 2002:a9d:620a:: with SMTP id g10mr10238345otj.249.1543860424489; Mon, 03 Dec 2018 10:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543860424; cv=none; d=google.com; s=arc-20160816; b=zjywdJ2jkDLJHiw8iX2bP3mDH9yAS8X4ylsHFPzKFNR4BfboKa1RmPXXfykHO75y61 1KYKdyMMNnDDANmAX+SesQpIEoGPdB0JcwTvTQyHGWT4aSbpgLzFPTCzyvCytnLJO9h1 /cBLqIwUSxeacGP7tBPu3T5MumlUnryDzYhxN1F181+lV7wQh/DiiincZR6P02ktQSJ0 Ey5QHlGHcMU6QOxzVUphlihCTxbMqzcbBNxMBPBAfaA0+rAihpQh0vzOVTB2+DpukarW yhkn+RRXr+HHIiJh+Bvr6kur+IKL9Qz6hCcraMKhaPF2nqaprlchsj6HoMNao5ANDZaN kcXw== 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=1h3n0IWtDadO1PFfu0yti7m1Cb4M4Vp3Bsov6nNlZVc=; b=EqMsfklduhZroK/qC8RiIc8nSIlMoW+V/JoWFAO4s2pm39EnpKIzqfPUqiSRTaRUYs SD7+TMjISgVt7t4gUDCd6LNVQKseElOHIZOwVjQ+pccpmWGdYsgSs03vWuSRf3Hwcqu6 luLq0j9gvxDdSr67qUBUACWpmxEoTDx4A/JgTXGfDIvbsK8/ConmyS0QanudGDmNsJMP 01dWyesSMAmvd3wG/z5WM5OnUIeg3EgTFak2Q0Ud3r4rnQQpFR9UwSIcPrmCBIiEa+W/ I9FTUq6rDJn+erH9XSbrEVGYeUyv/WafXacSbcfht3gEXxeJWOCQQkQYy2kAC8KmHsaz LArA== 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 v7si5802576otk.268.2018.12.03.10.07.04 for ; Mon, 03 Dec 2018 10:07:04 -0800 (PST) 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 14E741713; Mon, 3 Dec 2018 10:07:04 -0800 (PST) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 44BA93F719; Mon, 3 Dec 2018 10:07:01 -0800 (PST) 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 , Dongjiu Geng , Xie XiuQi , Fan Wu , James Morse Subject: [PATCH v7 08/25] ACPI / APEI: Don't update struct ghes' flags in read/clear estatus Date: Mon, 3 Dec 2018 18:05:56 +0000 Message-Id: <20181203180613.228133-9-james.morse@arm.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181203180613.228133-1-james.morse@arm.com> References: <20181203180613.228133-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 ghes_read_estatus() sets a flag in struct ghes if the buffer of CPER records needs to be cleared once the records have been processed. This flag value is a problem if a struct ghes can be processed concurrently, as happens at probe time if an NMI arrives for the same error source. The NMI clears the flag, meaning the interrupted handler may never do the ghes_estatus_clear() work. The GHES_TO_CLEAR flags is only set at the same time as buffer_paddr, which is now owned by the caller and passed to ghes_clear_estatus(). Use this value as the flag. A non-zero buf_paddr returned by ghes_read_estatus() means ghes_clear_estatus() should clear this address. ghes_read_estatus() already checks for a read of error_status_address being zero, so CPER records cannot be written here. Signed-off-by: James Morse Reviewed-by: Borislav Petkov --- Changes since v6: * Added Boris' RB, then: * Moved earlier in the series, * Tinkered with the commit message, * Always cleared buf_paddr on errors in the previous patch, which was previously in here. --- drivers/acpi/apei/ghes.c | 8 +------- include/acpi/ghes.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index f7a0ff1c785a..d06456e60318 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -329,8 +329,6 @@ static int ghes_read_estatus(struct ghes *ghes, u64 *buf_paddr) return -ENOENT; } - ghes->flags |= GHES_TO_CLEAR; - rc = -EIO; len = cper_estatus_len(ghes->estatus); if (len < sizeof(*ghes->estatus)) @@ -357,13 +355,9 @@ static int ghes_read_estatus(struct ghes *ghes, u64 *buf_paddr) static void ghes_clear_estatus(struct ghes *ghes, u64 buf_paddr) { ghes->estatus->block_status = 0; - if (!(ghes->flags & GHES_TO_CLEAR)) - return; - if (buf_paddr) { + if (buf_paddr) ghes_copy_tofrom_phys(ghes->estatus, buf_paddr, sizeof(ghes->estatus->block_status), 0); - ghes->flags &= ~GHES_TO_CLEAR; - } } static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int sev) diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h index f82f4a7ddd90..e3f1cddb4ac8 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -13,7 +13,6 @@ * estatus: memory buffer for error status block, allocated during * HEST parsing. */ -#define GHES_TO_CLEAR 0x0001 #define GHES_EXITING 0x0002 struct ghes {