Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5385264pxb; Wed, 26 Jan 2022 10:41:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSzYIQMdknYv4kp6Bp58ZugL7LG+w+d7eLggpOksWxgwMeQfP5sU7GXrmdycH+r/L+MDtm X-Received: by 2002:a17:906:4f97:: with SMTP id o23mr8534eju.439.1643222505142; Wed, 26 Jan 2022 10:41:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643222505; cv=none; d=google.com; s=arc-20160816; b=vB2u9AeDJRE4J5l2vA7q6u/4owPiRNUeYewHzpbJfKi8n2lXq1ONQ9aEYfLdCmQLty fmesJIhT4jTfxhalKS1voLkl1g1TdTLGMGXJCNlTivIAue/5GBcci72aleFId8Z+/u1O Zc5W4z9j77Ulwj6/l2NWNL7nl3JpzXaShQfT5/D0LKJS25OkasrJiwnwWHXf+oWWTJDh DV4/TfyaVucueqv5rKnf6q7GDlD+LFWsixAaPuHlt8d2xhWGdRkjsy3y8LnrmWF7tCqt r1H1FvQumOrgRLHFWMCD62+hpSGAaXn/SqYB42wxru3y/4Jnio2VrSuS6uGo/fWkjnCa 99dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=NvFXtf9rdXQOnJXdcMQYBEZzNUDGEvys9bQ3XtUbhKE=; b=OhzBU35k1++tCEGC08wvLsSnt89AG2Qg/0887+IMEyrlPRu9OjiGCUiqt7grE1OKW5 M9lCWdegNlgzX6w11tBwmEdIqWbOT1nIAsfbZfBJfZx5pvi0ABjIXTYfl5PU88dZL7k3 jdEJ/BuR5wx0tZCm8msOfBkzqLQCpdGut5MlwJgRAcYeSizTARMtpXA6f/eWh85oAk/b GS63cBhrhZQONKDMvKkXlVoTEqlI4OYzwY7/i8Bd501cJKuskt7FJI2V5tWgz2BhQCnr z79/ffk+58elKNoGtf6cAbxQ4PcmGt7hzWTKuThXNErGgCMeHwu2YuZyozf+G4veIogg 8OYQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si8771785ejm.908.2022.01.26.10.41.18; Wed, 26 Jan 2022 10:41:45 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232654AbiAZFZg (ORCPT + 99 others); Wed, 26 Jan 2022 00:25:36 -0500 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:48753 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232517AbiAZFZf (ORCPT ); Wed, 26 Jan 2022 00:25:35 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0V2u0NHN_1643174730; Received: from 30.240.122.215(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0V2u0NHN_1643174730) by smtp.aliyun-inc.com(127.0.0.1); Wed, 26 Jan 2022 13:25:31 +0800 Message-ID: Date: Wed, 26 Jan 2022 13:25:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 1/2] efi/cper: add cper_mem_err_status_str to decode error description Content-Language: en-US To: Borislav Petkov Cc: rric@kernel.org, mchehab@kernel.org, tony.luck@intel.com, james.morse@arm.com, ardb@kernel.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, zhangliguang@linux.alibaba.com, zhuo.song@linux.alibaba.com References: <20211210134019.28536-1-xueshuai@linux.alibaba.com> <20220125024939.30635-2-xueshuai@linux.alibaba.com> From: Shuai Xue In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Borislav, Thank you for your comments. 在 2022/1/26 AM3:08, Borislav Petkov 写道: > On Tue, Jan 25, 2022 at 10:49:38AM +0800, Shuai Xue wrote: >> Introduce a new helper function cper_mem_err_status_str() which is used to >> decode the description of error status, and the cper_print_mem() will call >> it and report the details of error status. >> >> Signed-off-by: Shuai Xue >> --- >> drivers/firmware/efi/cper.c | 29 ++++++++++++++++++++++++++++- >> include/linux/cper.h | 1 + >> 2 files changed, 29 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c >> index 6ec8edec6329..7f08d4ea906e 100644 >> --- a/drivers/firmware/efi/cper.c >> +++ b/drivers/firmware/efi/cper.c >> @@ -211,6 +211,31 @@ const char *cper_mem_err_type_str(unsigned int etype) >> } >> EXPORT_SYMBOL_GPL(cper_mem_err_type_str); >> >> +const char *cper_mem_err_status_str(u64 status) >> +{ >> + switch ((status >> 8) & 0xff) { >> + case 1: return "Error detected internal to the component"; >> + case 4: return "Storage error in DRAM memory"; >> + case 5: return "Storage error in TLB"; >> + case 6: return "Storage error in cache"; >> + case 7: return "Error in one or more functional units"; >> + case 8: return "component failed self test"; > > Well, at least start them all with capital letters: "Component... " And > yes, I know this is how it is in the spec but the spec has typos and > other problems - doesn't mean we have to copy them too. You are right, I will fix it in next version. >> + case 9: return "Overflow or undervalue of internal queue"; >> + case 16: return "Error detected in the bus"; >> + case 17: return "Virtual address not found on IO-TLB or IO-PDIR"; >> + case 18: return "Improper access error"; >> + case 19: return "Access to a memory address which is not mapped to any component"; >> + case 20: return "Loss of Lockstep"; >> + case 21: return "Response not associated with a request"; >> + case 22: return "Bus parity error - must also set the A, C, or D Bits"; >> + case 23: return "Detection of a PATH_ERROR "; > > Trailing space here. Sorry, will delete it. > Also what is PATH_ERROR? > > That "PATH_ERROR" is nowhere else explained in that big fat UEFI spec. > 2558 pages and they can't explain *that*. Geez. I don't know either. A related item I found is "iSCSI Device Path error". Section 10 defines the device path protocol, but I don't know if "PATH_ERROR" means the path of the device is not found, or something else. >> + case 25: return "Bus operation timeout"; >> + case 26: return "A read was issued to data that has been poisoned"; >> + default: return "reserved"; >> + } >> +} >> +EXPORT_SYMBOL_GPL(cper_mem_err_status_str); >> + >> static int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg) >> { >> u32 len, n; >> @@ -334,7 +359,9 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem, >> return; >> } >> if (mem->validation_bits & CPER_MEM_VALID_ERROR_STATUS) >> - printk("%s""error_status: 0x%016llx\n", pfx, mem->error_status); >> + printk("%s""error_status: %s (0x%016llx)\n", > > Why do you insist on having two back-to-back strings instead of one > here? > > (And don't tell me it is because the other function calls here do it > too.) > > FWIW, even checkpatch complains here: > > WARNING: Consecutive strings are generally better as a single string > #87: FILE: drivers/firmware/efi/cper.c:362: > + printk("%s""error_status: %s (0x%016llx)\n", > > Btw, please integrate scripts/checkpatch.pl into your patch creation > workflow. Some of the warnings/errors *actually* make sense. Sorry, I did integrate scripts/checkpatch.pl before sending patch. And as you see, other function calls here do the same, so I ignored the warnings. I will change as your comments in next version: - printk("%s""error_status: 0x%016llx\n", pfx, mem->error_status); + printk("%s error_status: %s (0x%016llx)\n", Best regards, Shuai