Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp105811yba; Wed, 17 Apr 2019 20:43:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxysZnPw3Vbz/uxY7143mfc+XGTgzQ6WHMEn5osLkp+Ka4LxgXx1oCdMkOa583TEes+UdDB X-Received: by 2002:a05:6a00:dc:: with SMTP id e28mr59495903pfj.186.1555559019485; Wed, 17 Apr 2019 20:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555559019; cv=none; d=google.com; s=arc-20160816; b=zrXAVaTI7VvAwRPqz/KECQ464tcmncgAkQyYbPbp1kOTsMbSLyZBNg7gN67JKXbnYv c/kX5Syc6Sy8GhgD+NFCZCoKmETO/nwnYI0j6QJ/yTRPjbhd+ETC/KnqwJjhJ+4xoDuf 7L3yMctHsscXQHCJtQyRp5kkG6H6PLut+lFji82wNuVAASoF4iSQqqnpYgCwWN+9PkDF aYvQtS//eXn43gfPf7fAs6APhDk2YNVmFMJwQ03guraNGwQ5x1aIQLDTqhur5HuENlIN X2S34crta5hcrEqSj0o03uabmFa0Zqyg3HbujD4PhkYipEjhMr7cW1i00uBslBw1ZLIQ qqHg== 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=paUmstcpzS7zpUG/I1EbOWPHrZ2l1hiKFGrr6McPBTI=; b=oBiUj13XhndR0y4IkhNPk1EJsP58mym7zKJLQCLJnLSPH7nsyxZvSSSFTE/FJnHGLX JR64yJteO8ECnyU/xThVshlepByndKvFtTGnYaDwPqsiMZEO9v5YUrfxBKNSbtmBa4a5 HCxAlkR/+OOXp79QXpZImX3JqiyrcbqxRrxuJJBkO40jrN0f9W79QMp5om/vvA0eJ4NL 0zl8nIWXvkxDaFtoWWpOQEf6lqMtuM5PVklnBPtV8115U2xUICP1I2EIpZToqWuZ4v9A 8mF2xKzG7OxmC9hCpktJjitJWJsFQVG0qRvlxwWsZJV/ks5G+zMxsGg40kOpIzBMyDPf VTow== 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 r7si968547ple.70.2019.04.17.20.43.24; Wed, 17 Apr 2019 20:43:39 -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 S2387981AbfDRDlX (ORCPT + 99 others); Wed, 17 Apr 2019 23:41:23 -0400 Received: from m97179.mail.qiye.163.com ([220.181.97.179]:23286 "EHLO m97179.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387949AbfDRDlU (ORCPT ); Wed, 17 Apr 2019 23:41:20 -0400 Received: from localhost (unknown [117.48.120.186]) by m97179.mail.qiye.163.com (Hmail) with ESMTPA id AA732E0193A; 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 2/3] RAS/CEC: make ces_entered smp safe Date: Thu, 18 Apr 2019 11:41:14 +0800 Message-Id: <20190418034115.75954-2-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: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6K0k6URw6Izg8NjBRDykQCTNC P0NPCxJVSlVKTk5OTk5DQ0xMTENDVTMWGhIXVRgTGhRVDBoVHDsOGBcUDh9VGBVFWVdZEgtZQVlK SkxVT0NVSklLVUpDTVlXWQgBWUFKTk5LNwY+ X-HM-Tid: 0a6a2e88ca2120bdkuqyaa732e0193a Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ces_entered should be put in a critical section to avoid race condition. Signed-off-by: WANG Chao --- drivers/ras/cec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index 2e0bf1269c31..702e4c02c713 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -286,10 +286,10 @@ int cec_add_elem(u64 pfn) if (!ce_arr.array || ce_arr.disabled) return -ENODEV; - ca->ces_entered++; - mutex_lock(&ce_mutex); + ca->ces_entered++; + if (ca->n == MAX_ELEMS) WARN_ON(!del_lru_elem_unlocked(ca)); -- 2.21.0