Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4802694ioa; Wed, 27 Apr 2022 11:26:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhvyXWGGIAJxqQ+/wKfeOkG29k9YGOrOHoEHZ/rHrLrIjDAWHFobOnQlqVam4kvfyvJnOQ X-Received: by 2002:a17:90a:d584:b0:1b8:7864:1735 with SMTP id v4-20020a17090ad58400b001b878641735mr34550564pju.126.1651083966361; Wed, 27 Apr 2022 11:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651083966; cv=none; d=google.com; s=arc-20160816; b=uXd2NAxctkiKU6DO9EnFy3LwV3HmH4FJaJ+aIIt1bkKS0wde3BnF5usmrXofgd3VBc bH6VY21m/0vuRDaKWH84n2ERypiZ1g5gMXknAa4RPUMcTXmlQDM2K3EVCc9eGJ7b0syT n2CPE4ELSY/DSYhaXvoAwHJ9U8Fjs+jYJbaVtNfj4czevEKjLa7y1RRVviMLUe1Y4aJo 4q5cm0zaoUiA7tjADpDjx+vFpTuXLu8UfihMPYj5gY+qNh3xrIIKhR86RtCBJ0do0tIl VBcsFd9iVo+EFuSdbfyfCQKh99rxwJNfR09mzjaez5K2T9PW+FVmYZ7u419sx1dbTcAd eCdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=FJH0JbTzDrexvwBEjtyYYCArMWh7H9g91PDqOzt1hlU=; b=wL3/SzzdUUAavxsX2h9DM7yg2lGDfTVjTT6oxKQSCfOl0cYWJyPSwWLlSYru7l9bVx u+4Qhbzo/3dBbIkfmmI9Yj5Ol/E4drFgyyohmHinxtFG3jxvlT5EDYpBg8rIqvzPURAf efAvqgzBOHbTtiwCxa9RY+vNA4C5Ub+mCTa9HA46v7QgaA8sCh5nnRYxTF7lYYWylFgF w6xq1ECvY6WM56QxTR1d7fDR9U8GOh8asJ7/bLxo3kPHzp1QgvbfspHvzJe7DAGL00J4 v8Khz2o7TM4QNDfNTN/eh4kFdelStEV9IS5GCF5MFHJ/fTkpuJS+ICM8qRsqe2ashLbJ NChQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pw11-20020a17090b278b00b001cd44931fa4si2373384pjb.17.2022.04.27.11.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 11:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FD9132DC55; Wed, 27 Apr 2022 10:57:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244523AbiD0SA6 (ORCPT + 99 others); Wed, 27 Apr 2022 14:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244483AbiD0SA5 (ORCPT ); Wed, 27 Apr 2022 14:00:57 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2483632A9F3; Wed, 27 Apr 2022 10:57:45 -0700 (PDT) Received: from fraeml739-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KpRGm2GrZz67D4J; Thu, 28 Apr 2022 01:54:56 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml739-chm.china.huawei.com (10.206.15.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 27 Apr 2022 19:57:43 +0200 Received: from localhost (10.81.200.74) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.24; Wed, 27 Apr 2022 18:57:42 +0100 Date: Wed, 27 Apr 2022 18:57:40 +0100 From: Jonathan Cameron To: CC: Dan Williams , Bjorn Helgaas , Alison Schofield , "Vishal Verma" , Ben Widawsky , , , Subject: Re: [PATCH V8 09/10] cxl/mem: Retry reading CDAT on failure Message-ID: <20220427185740.00001ea5@Huawei.com> In-Reply-To: <20220414203237.2198665-10-ira.weiny@intel.com> References: <20220414203237.2198665-1-ira.weiny@intel.com> <20220414203237.2198665-10-ira.weiny@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.81.200.74] X-ClientProxiedBy: lhreml709-chm.china.huawei.com (10.201.108.58) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 14 Apr 2022 13:32:36 -0700 ira.weiny@intel.com wrote: > From: Ira Weiny > > The CDAT read may fail for a number of reasons but mainly it is possible > to get different parts of a valid state. The checksum in the CDAT table > protects against this. > > Now that the cdat data is validated issue a retries if the CDAT read validated, retry if the CDAT read fails. > fails. For now 5 retries are implemented. > > Signed-off-by: Ira Weiny Reviewed-by: Jonathan Cameron > > --- > Changes from V6 > Move to pci.c > Fix retries count > Change to 5 retries > > Changes from V5: > New patch -- easy to push off or drop. > --- > drivers/cxl/pci.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c > index d7952156dd02..43cbc297079d 100644 > --- a/drivers/cxl/pci.c > +++ b/drivers/cxl/pci.c > @@ -940,7 +940,7 @@ static void cxl_initialize_cdat_callbacks(struct cxl_dev_state *cxlds) > cxlds->cdat_read_table = cxl_cdat_read_table; > } > > -static int read_cdat_data(struct cxl_dev_state *cxlds) > +static int __read_cdat_data(struct cxl_dev_state *cxlds) > { > struct device *dev = cxlds->dev; > size_t cdat_length; > @@ -962,6 +962,21 @@ static int read_cdat_data(struct cxl_dev_state *cxlds) > return ret; > } > > +static void read_cdat_data(struct cxl_dev_state *cxlds) > +{ > + int retries = 5; > + int rc; > + > + while (retries--) { > + rc = __read_cdat_data(cxlds); > + if (!rc) > + break; > + dev_err(cxlds->dev, > + "CDAT data read error rc=%d (retries %d)\n", > + rc, retries); > + } > +} > + > static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) > { > struct cxl_register_map map; > @@ -1035,9 +1050,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) > cxl_initialize_cdat_callbacks(cxlds); > > /* Cache the data early to ensure is_visible() works */ > - rc = read_cdat_data(cxlds); > - if (rc) > - dev_err(&pdev->dev, "CDAT data read error (%d)\n", rc); > + read_cdat_data(cxlds); > > cxl_dvsec_ranges(cxlds); >