Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp111268yba; Wed, 17 Apr 2019 20:52:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBIs8Z9mNmlnPJesP2UT70O/jcTvD9rilbt+ux09Ztzb7RNfBUiP+e1p7q9tgcU//Rfo1c X-Received: by 2002:a63:165f:: with SMTP id 31mr296026pgw.321.1555559520979; Wed, 17 Apr 2019 20:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555559520; cv=none; d=google.com; s=arc-20160816; b=VtnmhJgUz58dfEJGQBk+jI+IfFq4JPbaZwNz29lIyOzgGO4S5vQXimaOcX/7yorcfU RMQ/N3E5Zd5j2O20NA9qXOTXCsgOT9jPHSOKEZQfqI3sgaBKkK4glo3XnFCo7uc6ag8r MuyKkdV8kgHCLDy2MOL5FRBB2PvT2zNm5Fk62DRrAk006D6yCFhrvwljrbrBqgK12hKt Pr9JL0dc3zua6pSLcEGh9mD/cG7q6zEGUXqqtaLo53dbpByBkHw1TUY4TnRklgF8I3CZ ufezb2msgEDfIcO+eRPZnouuZh7BzDYBUg1tiCpQ7Qak/t33TzR8gWRxZH3VQ8CqAtxg dhyw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Fxv7lQd5LE/knAi1RqWLwdzWmXCbr3Q4JO4wGlVFHXE=; b=M0yRnV9bVtWgXjIOdbGlMs0iglq0stCLpat8bTEsDdNdQ4I4YhXYh+l14zrmPnPaFp 2qK25Yw8PSg1QkLLwYT7ziWWSVo9uaIQ01og0nitxgS+VCJ9fiZdYH0bVaaFDpL5nxfo kMyKvWDJy9erdr0DgRlzjOWOdWzTL7I+CZXRrGBB/Hid3tki4AgQYhYQ37EQmfqaLszc tSesOCp91UMNwQKbLLCqIHEahGFIKHYOMc091o/ehYGPAdeHhSUnVOyPge8cEXdLlrog bVsPpAtDWRWVGagDSpR0kFpxKOtEiLP5vHHPt4ifdWDcDMsUt6FFTiLkCWanXMIotATX Eg/A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1si1178523pfb.68.2019.04.17.20.51.44; Wed, 17 Apr 2019 20:52:00 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ucloud.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387834AbfDRDuI (ORCPT + 99 others); Wed, 17 Apr 2019 23:50:08 -0400 Received: from m9785.mail.qiye.163.com ([220.181.97.85]:21821 "EHLO m9785.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732183AbfDRDuI (ORCPT ); Wed, 17 Apr 2019 23:50:08 -0400 X-Greylist: delayed 528 seconds by postgrey-1.27 at vger.kernel.org; Wed, 17 Apr 2019 23:50:07 EDT Received: from localhost (unknown [117.48.120.186]) by m9785.mail.qiye.163.com (Hmail) with ESMTPA id EF8725C1604; Thu, 18 Apr 2019 11:41:17 +0800 (CST) From: WANG Chao To: Borislav Petkov Cc: Tony Luck , linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org Subject: [PATCH 3/3] RAS/CEC: immediate soft-offline page when count_threshold == 1 Date: Thu, 18 Apr 2019 11:41:15 +0800 Message-Id: <20190418034115.75954-3-chao.wang@ucloud.cn> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418034115.75954-1-chao.wang@ucloud.cn> References: <20190418034115.75954-1-chao.wang@ucloud.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kIGBQJHllBS1VLV1koWUFJQjdXWS1ZQUlXWQkOFx4IWUFZMjUtOjcyP0 FLVUtZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6PBw6FQw*SDgyLjBNHzQ9AwE3 E00wCxRVSlVKTk5OTk5DQ0xDS0xKVTMWGhIXVRgTGhRVDBoVHDsOGBcUDh9VGBVFWVdZEgtZQVlK SkxVT0NVSklLVUpDTVlXWQgBWUFJQkhJNwY+ X-HM-Tid: 0a6a2e88cb252087kuqyef8725c1604 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org count_threshol == 1 isn't working as expected. CEC only does soft offline the second time the same pfn is hit by a correctable error. Signed-off-by: WANG Chao --- drivers/ras/cec.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index 702e4c02c713..ac879c45377c 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -272,7 +272,22 @@ static u64 __maybe_unused del_lru_elem(void) return pfn; } +static void cec_valid_soft_offline(u64 pfn) +{ + if (!pfn_valid(pfn)) { + pr_warn("CEC: Invalid pfn: 0x%llx\n", pfn); + } else { + /* We have reached max count for this page, soft-offline it. */ + pr_err("Soft-offlining pfn: 0x%llx\n", pfn); + memory_failure_queue(pfn, MF_SOFT_OFFLINE, &cec_chain); + ce_arr.pfns_poisoned++; + } +} +/* + * Return a >0 value to denote that we've reached the offlining + * threshold. + */ int cec_add_elem(u64 pfn) { struct ce_array *ca = &ce_arr; @@ -295,6 +310,11 @@ int cec_add_elem(u64 pfn) ret = find_elem(ca, pfn, &to); if (ret < 0) { + if (count_threshold == 1) { + cec_valid_soft_offline(pfn); + ret = 1; + goto unlock; + } /* * Shift range [to-end] to make room for one more element. */ @@ -320,23 +340,9 @@ int cec_add_elem(u64 pfn) ret = 0; } else { - u64 pfn = ca->array[to] >> PAGE_SHIFT; - - if (!pfn_valid(pfn)) { - pr_warn("CEC: Invalid pfn: 0x%llx\n", pfn); - } else { - /* We have reached max count for this page, soft-offline it. */ - pr_err("Soft-offlining pfn: 0x%llx\n", pfn); - memory_failure_queue(pfn, MF_SOFT_OFFLINE); - ca->pfns_poisoned++; - } - + cec_valid_soft_offline(pfn); del_elem(ca, to); - /* - * Return a >0 value to denote that we've reached the offlining - * threshold. - */ ret = 1; goto unlock; -- 2.21.0