Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2958280pxa; Tue, 25 Aug 2020 07:55:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysxXAm1o6M7o4j9Y6NIjQPF1h+mX58538BEArP4YZAJh7eCvgl988BLiaFLO5LJUducm9F X-Received: by 2002:a05:6402:3da:: with SMTP id t26mr5526336edw.213.1598367313556; Tue, 25 Aug 2020 07:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598367313; cv=none; d=google.com; s=arc-20160816; b=mKrCzUM8P5KFiftqL5c8omFcGcJXycFY+IZ3JxjLqpGdWvLfvm+i0bSXfbcwpmWdJt PYMVvX98Bpe/08cKJ7l6jMNQXn0qRmisnzM2XuhxIZ/9G0abeIfUR1Fi4/dXWkaGvvHs +T7vB7YWx57PTn2XoIGjQLor44ITZeuRQIUoEgN1MwKubPamh/9Ex/IbdrGqAuBJ4Hy8 6kdHZHbnU/rV4NtqD6Mq5LmGqObIiPRLcq5IRegbzaR896ZkqXQPfMO4qXSXujYoncb/ iRgwMe20VATGSpsE5pjHQCGUR1C/OsxG8N2dUPUgdhdpPVzgDOkYXI0ME0ahSsm6Fja5 z8PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IUwhfwSnHMFSktZFuBhsmgHbQmCVef09osJjhCN2BBc=; b=gymvibtH8xPz4l9EW1u8j1Kb+dL+nOXV8b5z2Py9cDPfsQZv8uy54tuEo8CaMJ/heA xixgq1TbWSSeqk/jvpmRkO+jECouSB88aBGpu0Xl4OqdST3XytYtih6G2jE0856E1Pt3 Ruajj2tzMUJagPzDKWOXYR2iiX+/k5w6RnoaEUjai1P5L3tUni+8Ce5wKee3jU5um9/S ukxHWDjhzXdTi9slNmhl6kR8xR7JOlsfA+RJT6+2T8/363bvjLy8r5Nb+K+eqitG3kpr vApIw8eEFGKxMde6hXpgBbaSwU303tNt9HKvUPTk5T76dXfMBjbx1aV2WH1nqWkgDOfO FYdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j1si2832114edr.464.2020.08.25.07.54.50; Tue, 25 Aug 2020 07:55:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726784AbgHYOwD (ORCPT + 99 others); Tue, 25 Aug 2020 10:52:03 -0400 Received: from foss.arm.com ([217.140.110.172]:60504 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbgHYOvz (ORCPT ); Tue, 25 Aug 2020 10:51:55 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3125130E; Tue, 25 Aug 2020 07:51:54 -0700 (PDT) Received: from [172.16.1.113] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60CCC3F71F; Tue, 25 Aug 2020 07:51:53 -0700 (PDT) Subject: Re: [PATCH] arm64: traps: clean up arm64_ras_serror_get_severity() To: Liguang Zhang Cc: Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20200812110918.18575-1-zhangliguang@linux.alibaba.com> From: James Morse Message-ID: Date: Tue, 25 Aug 2020 15:51:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200812110918.18575-1-zhangliguang@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zhang, On 12/08/2020 12:09, Liguang Zhang wrote: > Function arm64_is_fatal_ras_serror() is always called after > arm64_is_ras_serror(), so we should remove some needless > arm64_is_ras_serror() call in function arm64_ras_serror_get_severity(). > diff --git a/arch/arm64/include/asm/traps.h b/arch/arm64/include/asm/traps.h > index cee5928e1b7d..287b4d64dc67 100644 > --- a/arch/arm64/include/asm/traps.h > +++ b/arch/arm64/include/asm/traps.h > @@ -79,13 +79,6 @@ static inline bool arm64_is_ras_serror(u32 esr) > */ > static inline u32 arm64_ras_serror_get_severity(u32 esr) > { > - u32 aet = esr & ESR_ELx_AET; > - > - if (!arm64_is_ras_serror(esr)) { > - /* Not a RAS error, we can't interpret the ESR. */ > - return ESR_ELx_AET_UC; > - } I agree this can go, it looks like I had it here as a sanity check while the KVM bits were sorted out. Please also remove the comment that says it does this: | * Non-RAS SError's are reported as Uncontained/Uncategorized. This becomes the callers problem. > /* > * AET is RES0 if 'the value returned in the DFSC field is not > * [ESR_ELx_FSC_SERROR]' > diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c > index 13ebd5ca2070..635d4cca0a4b 100644 > --- a/arch/arm64/kernel/traps.c > +++ b/arch/arm64/kernel/traps.c > @@ -913,7 +913,7 @@ bool arm64_is_fatal_ras_serror(struct pt_regs *regs, unsigned int esr) > case ESR_ELx_AET_UC: /* Uncontainable or Uncategorized error */ > default: > /* Error has been silently propagated */ > - arm64_serror_panic(regs, esr); > + return true; KVM depends on this, please don't remove it. What does 'fatal' mean? To the arch code it means panic(), as we don't (yet) have the information to fix the error. But to KVM 'fatal' means kill-the-guest. KVM does this as without user-space's involvement, there is very little else it can do. KVM can only do this if the error is contained. As it must have been contained by stage2, so the host can keep running. But if the error was reported as uncontained, KVM would need to panic() the host. (An example of an Uncontained error is a store that went to the wrong address due to corruption that wasn't caught in time. We can't trust any value in memory once we've seen one of these.) I agree it looks funny, but it was simpler for the arch code helper to do this, instead of having an 'arm64_is_uncontained_ras_serror(), as now you'd always have to check three things. > } > } Thanks, James