Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp450869ybz; Wed, 29 Apr 2020 03:16:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIX4Swz4kBqiG/BT3a0hwGQcqDrgcxw+C55EhLXUVHTzjQmyoCBRJ4zdHBYx1V3v8r42dFv X-Received: by 2002:a17:906:6856:: with SMTP id a22mr1965222ejs.115.1588155411017; Wed, 29 Apr 2020 03:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588155411; cv=none; d=google.com; s=arc-20160816; b=0RKoeoSvD48CbWoOJj8hVoJ56B2DbFs0y+2IAD1GbA/KEL9rtg0HS9hEvE7QG4AWmX vJcuB+aRjpfVxez6W0fkxVUM6MeRAgB5Mw5pp7M0OKNptYbRCxOEIFVL6AVAwrqXGWlL z9mRuKBWnWb7yF8+MPtthQyMc7nXIVR5I6S4xv0C9fd2M90f+TiACLcW+ez4om3UgyF0 EEpLhi3cB1iQKQTfEozwxxt5MTRKF8DwxaNZ8lAz/SpJmv7Uzv7WTec00FCkNjtu002n A4mVYPWdg9K9KtFchX44+CAVVMP5KnYFuyqZMgXF7i6GyyTe/IuCXRiDxS3f8mmvJucr aISA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=W5A8lTFTfg+9iuepDFbRf4C+euOmp/nYF0WkFVb9u5o=; b=CqN0VUc20bpKfGQMuM07g0Jg7Q/nNKJqkNV56ZcUe3XwnoVoLy1yimQ/oHvmVu8X+m sir+IyVI9MhVh6wuHo7O9pZyI9Fv9PE0OrXPu4i4F2xObiiTPYrJHWZ8DzxRGLEBU6+u 3PA8m94Wr/ULwz6uaojQTQRolA//wkVEAldtXbfmhNk61EQNVuQi6UU/L6CriBBYzss5 GTwcjgWV5lCbYTaPMbmTPnQ4DVVCkDqDQMKBAybrSA5CUAlOBvD/eimQ21djfSj8J9Xq Yrr4oxGNdUyFwujS4uFvDGiS4oGhwUwk2U0jndaCvbi1Ir5MT9yM0aARVA4+Gs4MuhUk pvGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=Alq3gBQh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si3463994ejb.235.2020.04.29.03.16.27; Wed, 29 Apr 2020 03:16:51 -0700 (PDT) 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; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=Alq3gBQh; 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=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726755AbgD2KOc (ORCPT + 99 others); Wed, 29 Apr 2020 06:14:32 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:5302 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgD2KOb (ORCPT ); Wed, 29 Apr 2020 06:14:31 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03TACTrZ017973; Wed, 29 Apr 2020 12:13:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=STMicroelectronics; bh=W5A8lTFTfg+9iuepDFbRf4C+euOmp/nYF0WkFVb9u5o=; b=Alq3gBQhIyAHVodxDf8TqfFkbAZIFn7wy2gckqe0kyMIxkOtIcLiSe+WKo9E8ar4QJ/S l948MtEbrcbq72YHY/sKwUzy7lYreyBd2NXg8nr0aKb2EtKMz6lcPheqVQAOSI1bGzsU m7fpSWzT3wNRhI7g+D9235QUsyFr71rrMtdvv2rJ5VPQBZSR33u4E5tM1ER8SHKC7II8 zknaO0+2FemsepXW9KKJEV7+jCYEDxYWNWBEVwW6EIyP917c12ZEj08oAjuvuwtd1o5i EvTYJUZpNLXsjQ+j/3a0YbpRiviWiuOvB8IsEYh5Mvrgx63xavdkJTahXKSsb7ApTovx 4Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30mhcc5nex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Apr 2020 12:13:43 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 80D2A10002A; Wed, 29 Apr 2020 12:13:42 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node2.st.com [10.75.127.17]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 48F2220B86D; Wed, 29 Apr 2020 12:13:42 +0200 (CEST) Received: from [10.211.9.35] (10.75.127.44) by SFHDAG6NODE2.st.com (10.75.127.17) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 29 Apr 2020 12:13:33 +0200 Subject: Re: [PATCH v2 06/12] mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_MS for timeouts To: Miquel Raynal CC: , , , , , , , , , , References: <1586966256-29548-1-git-send-email-christophe.kerello@st.com> <1586966256-29548-7-git-send-email-christophe.kerello@st.com> <20200427202212.0235d987@xps13> <0e2c9a6a-aa21-7814-9af8-629de6568fab@st.com> <20200429113529.5ddc3ad9@xps13> <20200429120632.7bce63e6@xps13> From: Christophe Kerello Message-ID: Date: Wed, 29 Apr 2020 12:13:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20200429120632.7bce63e6@xps13> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG6NODE2.st.com (10.75.127.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-29_03:2020-04-29,2020-04-29 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/29/20 12:06 PM, Miquel Raynal wrote: > Hi Christophe, > > Christophe Kerello wrote on Wed, 29 Apr > 2020 11:41:44 +0200: > >> On 4/29/20 11:35 AM, Miquel Raynal wrote: >>> Hi Christophe, >>> >>> Christophe Kerello wrote on Wed, 29 Apr >>> 2020 11:27:43 +0200: >>> >>>> Hi Miquèl, >>>> >>>> On 4/27/20 8:22 PM, Miquel Raynal wrote: >>>>> Hi Christophe, >>>>> >>>>> Christophe Kerello wrote on Wed, 15 Apr >>>>> 2020 17:57:30 +0200: >>>>> >>>> This patch removes the constant FMC2_TIMEOUT_US. >>>>>> FMC2_TIMEOUT_MS is set to 5 seconds and this constant is used >>>>>> each time that we need to wait (except when the timeout value >>>>>> is set by the framework) >>>>>> >>>>>> Signed-off-by: Christophe Kerello >>>>>> --- >>>>>> drivers/mtd/nand/raw/stm32_fmc2_nand.c | 11 +++++------ >>>>>> 1 file changed, 5 insertions(+), 6 deletions(-) >>>>>> >>>>>> diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c >>>>>> index ab53314..f159c39 100644 >>>>>> --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c >>>>>> +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c >>>>>> @@ -37,8 +37,7 @@ >>>>>> /* Max ECC buffer length */ >>>>>> #define FMC2_MAX_ECC_BUF_LEN (FMC2_BCHDSRS_LEN * FMC2_MAX_SG) >>>>>> >> -#define FMC2_TIMEOUT_US 1000 >>>>>> -#define FMC2_TIMEOUT_MS 1000 >>>>>> +#define FMC2_TIMEOUT_MS 5000 >>>>>> >> /* Timings */ >>>>>> #define FMC2_THIZ 1 >>>>>> @@ -525,9 +524,9 @@ static int stm32_fmc2_ham_calculate(struct nand_chip *chip, const u8 *data, >>>>>> u32 sr, heccr; >>>>>> int ret; >>>>>> >> - ret = readl_relaxed_poll_timeout(fmc2->io_base + FMC2_SR, >>>>>> - sr, sr & FMC2_SR_NWRF, 10, >>>>>> - FMC2_TIMEOUT_MS); >>>>>> + ret = readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_SR, >>>>>> + sr, sr & FMC2_SR_NWRF, 1, >>>>>> + 1000 * FMC2_TIMEOUT_MS); >>>>> >>>>> Is the _atomic suffix needed here? If yes it would deserve a separate >>>>> patch with Fixes/Stable tags. >>>>> >> >>>> I have currently not seen any issues. So, I will remove this modification as we will move to regmap_read_poll_timeout in patch 10. >>>> >>>>>> if (ret) { >>>>>> dev_err(fmc2->dev, "ham timeout\n"); >>>>>> return ret; >>>>>> @@ -1315,7 +1314,7 @@ static int stm32_fmc2_waitrdy(struct nand_chip *chip, unsigned long timeout_ms) >>>>>> /* Check if there is no pending requests to the NAND flash */ >>>>>> if (readl_relaxed_poll_timeout_atomic(fmc2->io_base + FMC2_SR, sr, >>>>>> sr & FMC2_SR_NWRF, 1, >>>>>> - FMC2_TIMEOUT_US)) >>>>>> + 1000 * FMC2_TIMEOUT_MS)) >>>>>> dev_warn(fmc2->dev, "Waitrdy timeout\n"); >>>>>> >> /* Wait tWB before R/B# signal is low */ >>>>> >>>>> You change the timeouts from 1ms to 5s. >>>>> >>>>> Maybe 5s is a little bit too much IMHO but we don't really care as this >>>>> is a timeout. However 1ms is tight. If you are changing this value >>>>> because it triggers error (eg. when the machine is loaded), then it is >>>>> a fix and should appear like it. >>>>> >>>>> Thanks, >>>>> Miquèl >>>>> >> >>>> No errors currently happens. >>>> During our stress tests, in a overloaded system, we have seen that we could be close to 1 second, even if we never met this value. >>>> So, to be safe, I have set this timeout to 5 seconds. >>>> As it is just a timeout value, I have not seen any side effect. >>>> I am using the same timeout constant to avoid to have one timeout per cases. >>> >>> Something is wrong in my mind: >>> You say you observe delays of almost up to 1 second, but the polling >>> currently happens on 1000 us = 1ms, either you had timeouts or I >>> misread something? >>> >>> Thanks, >>> Miquèl >>> >> >> Hi Miquèl, >> >> My fault. For this polling, we never met 1 ms. >> The 1 second observed was on the sequencer when we read/write a page (as it the same timeout value that is used) > > OK I get it. So perhaps you can give these details in the commit log to > explain why you use 5 seconds instead of one. > > Thanks, > Miquèl > Hi Miquèl, A proposal could also be to split this patch: - a first patch that is using only one timeout value. - a second patch that is increasing the value to 5 seconds. Regards, Christophe Kerello.