Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp385518imm; Fri, 31 Aug 2018 03:10:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZklg19/+78piVI51Z3EYFgu1dgD69cUxLarWjpKgyG3Bo6CHuk8IhsAS7S1ZWAuDUtgE/Y X-Received: by 2002:a17:902:6b89:: with SMTP id p9-v6mr14456666plk.272.1535710216547; Fri, 31 Aug 2018 03:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535710216; cv=none; d=google.com; s=arc-20160816; b=BU1zSHpdSRV0GS0q98mJd0O1kkyNbqQeA7ynfpDbPL7D2obcN0uVCJJ7xk8kEoV4Sv TxD5Y9jQe3fCfaw4/mAgeT9BJ91zwpZWHpMLj900Dz8Zhdlyv2g7LQYbCRZeg5tvWdds ll0W8dTZEppduCeSOxBVVEn4urLe/iQVF13RE0RmdSYx4q8YQW3E3rKaDVRxx2Z1L1LY fbFPjsxAI2jhVPphuV0mTutk82pSlabmhU8yKTaXZsBQkbQxlR/uR7Bkf5KVfHvihuni USuA9UpuSAxue4ZfEytDNVMAgv1kw7567qocm3J/FsnCj7suos3jjoFb6KaAdzEgVFHl pbpA== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=2+gQp2hXzPWqYtMMvrN0myTR7mlusRCnV5qfGQV0HIY=; b=CzMAV8q9P4tKI6o729oD0y1WGt9jUevuLKEjj0ZE8Yo885wAY5FOjK0fvDZRCa9We9 yPZNUCZoPYqB0gsdX2HAtB9riIW2CRdtIAylZKYdmCpuqrJdePaXY0yuuW89ygRSYy+H qAvV0kexDnOwp14WvekCfGA2muAliOhQtBbrxgOmQR0TB3sVfTBeddCSf5FdJCzOjl6I vllbIsqYOkAI3ivoRcYsQMmR6wKBbITMhrXf74cCaB4hVoaNTlw62c+ZWzMMsqc/5KO3 BtlsSaC4ZDLguuDPVgw+ZonoTx6xL0C7aEtOcwFpyPzYcKFWlXTLULwWkBYGn2Y8uMYO 4T6w== 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 d8-v6si9345846pgn.382.2018.08.31.03.10.01; Fri, 31 Aug 2018 03:10:16 -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 S1728266AbeHaOMz (ORCPT + 99 others); Fri, 31 Aug 2018 10:12:55 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:42381 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727559AbeHaOMz (ORCPT ); Fri, 31 Aug 2018 10:12:55 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C343DBDA00CEC; Fri, 31 Aug 2018 18:06:07 +0800 (CST) Received: from [127.0.0.1] (10.74.184.86) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.399.0; Fri, 31 Aug 2018 18:06:01 +0800 Subject: Re: [PATCH] EDAC, ghes: use CPER module handles to locate DIMMs To: John Garry , James Morse References: <1535567632-18089-1-git-send-email-wufan@codeaurora.org> <5eab89c6-c063-cbc2-4d02-459faf87698a@arm.com> <6cc3c5e2-3827-a89c-e37b-09728a34f21f@huawei.com> CC: Zhengqiang , Fan Wu , , , , , , , Linuxarm , wanghuiqiang , Shiju Jose From: tanxiaofei Message-ID: <5B891308.40407@huawei.com> Date: Fri, 31 Aug 2018 18:06:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <6cc3c5e2-3827-a89c-e37b-09728a34f21f@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.184.86] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/8/31 0:50, John Garry wrote: > On 30/08/2018 17:34, James Morse wrote: > > Hi James, > > Zhengqiang no longer works on this topic, so I have cc'ed some more guys who should be able to help. > > John > >> Hi Zhengqiang, >> >> On 29/08/18 19:33, Fan Wu wrote: >>> The current ghes_edac driver does not update per-dimm error >>> counters when reporting memory errors, because there is no >>> platform-independent way to find DIMMs based on the error >>> information provided by firmware. This patch offers a solution >>> for platforms whose firmwares provide valid module handles >>> (SMBIOS type 17) in error records. In this case ghes_edac will >>> use the module handles to locate DIMMs and thus makes per-dimm >>> error reporting possible. >> >> Does your platform set CPER_MEM_VALID_MODULE_HANDLE in GHES Memory errors? If >> so, any chance you could test this patch on your platform? [0] >> (original patch: https://lore.kernel.org/patchwork/patch/978928/) >> Hi James, Our platform do not set CPER_MEM_VALID_MODULE_HANDLE in GHES Memory errors. Thanks, tanxiaofei >> Thanks, >> >> James >> >> [0] https://marc.info/?l=linux-edac&m=152603960002324 >> >> >>> diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c >>> index 473aeec..db527f0 100644 >>> --- a/drivers/edac/ghes_edac.c >>> +++ b/drivers/edac/ghes_edac.c >>> @@ -81,6 +81,26 @@ static void ghes_edac_count_dimms(const struct dmi_header *dh, void *arg) >>> (*num_dimm)++; >>> } >>> >>> +static int ghes_edac_dimm_index(u16 handle) >>> +{ >>> + struct mem_ctl_info *mci; >>> + int i; >>> + >>> + if (!ghes_pvt) >>> + return -1; >>> + >>> + mci = ghes_pvt->mci; >>> + >>> + if (!mci) >>> + return -1; >>> + >>> + for (i = 0; i < mci->tot_dimms; i++) { >>> + if (mci->dimms[i]->smbios_handle == handle) >>> + return i; >>> + } >>> + return -1; >>> +} >>> + >>> static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) >>> { >>> struct ghes_edac_dimm_fill *dimm_fill = arg; >>> @@ -177,6 +197,8 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) >>> entry->total_width, entry->data_width); >>> } >>> >>> + dimm->smbios_handle = entry->handle; >>> + >>> dimm_fill->count++; >>> } >>> } >>> @@ -327,12 +349,20 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err) >>> p += sprintf(p, "bit_pos:%d ", mem_err->bit_pos); >>> if (mem_err->validation_bits & CPER_MEM_VALID_MODULE_HANDLE) { >>> const char *bank = NULL, *device = NULL; >>> + int index = -1; >>> + >>> dmi_memdev_name(mem_err->mem_dev_handle, &bank, &device); >>> + p += sprintf(p, "DIMM DMI handle: 0x%.4x ", >>> + mem_err->mem_dev_handle); >>> if (bank != NULL && device != NULL) >>> p += sprintf(p, "DIMM location:%s %s ", bank, device); >>> - else >>> - p += sprintf(p, "DIMM DMI handle: 0x%.4x ", >>> - mem_err->mem_dev_handle); >>> + >>> + index = ghes_edac_dimm_index(mem_err->mem_dev_handle); >>> + if (index >= 0) { >>> + e->top_layer = index; >>> + e->enable_per_layer_report = true; >>> + } >>> + >>> } >>> if (p > e->location) >>> *(p - 1) = '\0'; >>> diff --git a/include/linux/edac.h b/include/linux/edac.h >>> index bffb978..a45ce1f 100644 >>> --- a/include/linux/edac.h >>> +++ b/include/linux/edac.h >>> @@ -451,6 +451,8 @@ struct dimm_info { >>> u32 nr_pages; /* number of pages on this dimm */ >>> >>> unsigned csrow, cschannel; /* Points to the old API data */ >>> + >>> + u16 smbios_handle; /* Handle for SMBIOS type 17 */ >>> }; >>> >>> /** >>> >> >> >> . >> > > > > . > -- best wishes 谭小飞