Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp470939imm; Thu, 31 May 2018 04:02:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIUXQckJj2XoqkiZiG1EXTUVTazOswgR02s1mgwtSsxOMkEBLet7CmPXdpE6lX6R9HXJdCk X-Received: by 2002:a65:6101:: with SMTP id z1-v6mr5199466pgu.23.1527764550265; Thu, 31 May 2018 04:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527764550; cv=none; d=google.com; s=arc-20160816; b=XcRpeVY1uBoWZ/oHFKq3oORoF1T2M8CzT5AFHzDpwgsg5TxKthdU2D8V55JsKZPcgP gAhYKzdiXuaMtagqovciY/j/YdXvXNDeG+ioHjPldfL1B5P6zJM4rkyHKl+PXJHg7XU7 Cr17aGZ4tUlDt0+8bpGrJbbN41fmqNuaHGJAzPAD5PNR5jfoD/MvlOi/XPHL7V4/g6W8 uS6pNO4hcoCIM54ZJFNOwJuCICdXlwDSPDFax6Td4BQmOft8GqLwnngH1Kw5bl5MNXGt dwdeGNWRWyyV/9ecz5MZ0BSUoI38XisVYQcNQZCrpI5MZJ89EoeXQFO8q5Pe/lr9OZPV DL+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=wLvXo/Y6xLNoWPO/qACV+rywc64aiWoXWtPL6ueaGxQ=; b=rKnmbbeDQUyoVG+NuyrRSnvSfg4AjBxr35b51qnDVLX6lx7dy2wLj8apb869PqmsFU dfhOHmWs9vDDXtPLSwY6490q3s0B93rxB+a9kj5ShXsfWAPberBFSTKW/QjlPytkxH5F 2nu0ulKaqMLS0xq7EQOYPoFPqBV+Heic6Hwjgjv5kc//hH+J8/xeIuOgEgzPi5Aogn9a l2UNlaU8OjeuA4TZVR9ngoVNctyRF/r+TIzFOG0RyXmvXtsGHSDILsfZrtzqfWvWUjEX Rr+dyGgEXcoURgu1U/hgyAVDR0HXq+LsUd5ulWSlf3y4ERcgqhk4MXgpgjdeyuSobUFE mcGw== 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 r5-v6si29335218pgp.379.2018.05.31.04.02.16; Thu, 31 May 2018 04:02:30 -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; 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 S1754734AbeEaLB0 (ORCPT + 99 others); Thu, 31 May 2018 07:01:26 -0400 Received: from foss.arm.com ([217.140.101.70]:39766 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754504AbeEaLBU (ORCPT ); Thu, 31 May 2018 07:01:20 -0400 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 6E80B1529; Thu, 31 May 2018 04:01:20 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E747F3F24A; Thu, 31 May 2018 04:01:17 -0700 (PDT) Date: Thu, 31 May 2018 12:01:15 +0100 From: Mark Rutland To: Dongjiu Geng , james.morse@arm.com Cc: catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, tony.luck@intel.com, bp@alien8.de, robert.moore@intel.com, erik.schmauss@intel.com, dave.martin@arm.com, ard.biesheuvel@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: Re: [PATCH v1 2/2] arm64: handle NOTIFY_SEI notification by the APEI driver Message-ID: <20180531110115.uglmicy3nzwfoyx3@lakrids.cambridge.arm.com> References: <1527770506-8076-1-git-send-email-gengdongjiu@huawei.com> <1527770506-8076-3-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527770506-8076-3-git-send-email-gengdongjiu@huawei.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 31, 2018 at 08:41:46PM +0800, Dongjiu Geng wrote: > When kernel or KVM gets the NOTIFY_SEI notification, it firstly > calls the APEI driver to handle this notification. > > Signed-off-by: Dongjiu Geng > --- > arch/arm64/kernel/traps.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > --- > change since https://www.spinics.net/lists/kvm/msg168919.html > > 1. Remove the handle_guest_sei() helper > > > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > index 8bbdc17..676e40c 100644 > --- a/arch/arm64/kernel/traps.c > +++ b/arch/arm64/kernel/traps.c > @@ -50,6 +50,7 @@ > #include > #include > #include > +#include Nit: please place newline before the new include, since it comes from a different directory (and we do so in fault.c). > static const char *handler[]= { > "Synchronous Abort", > @@ -701,6 +702,20 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr) > bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned int esr) > { > u32 aet = arm64_ras_serror_get_severity(esr); > + int ret = -ENOENT; > + > + if (IS_ENABLED(CONFIG_ACPI_APEI_SEI)) { > + if (interrupts_enabled(regs)) > + nmi_enter(); > + > + ret = ghes_notify_sei(); > + > + if (interrupts_enabled(regs)) > + nmi_exit(); > + > + if (!ret) > + return false; > + } In do_serror() we already handle nmi_{enter,exit}(), so there's no need for that here. TBH, I don't understand why do_sea() does that conditionally today. Unless there's some constraint I'm missing, I think it would make more sense to do that regardless of whether the interrupted context had interrupts enabled. James -- does that make sense to you? If you update the prior patch with a stub for !CONFIG_ACPI_APEI_SEI, you can simplify all of the above additions down to: if (!ghes_notify_sei()) return; ... which would look a lot nicer. Thanks, Mark.