Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1473180pxb; Fri, 24 Sep 2021 05:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZNjQWc1uzTLfCCsjjtdyJhg6Bi8rOa+qCHp2hxuSOx/+P13a8DbillJSwo0MuU7QPKJ+g X-Received: by 2002:a5d:8ac1:: with SMTP id e1mr385418iot.40.1632486489388; Fri, 24 Sep 2021 05:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632486489; cv=none; d=google.com; s=arc-20160816; b=hxm4wwugAdwXQWeapTDi1vn3X/88Jt5JPA0g/TtCtQFsXxlxKaEO+8fbon3fRuX/fi 3taski8hmMzPfi5JKjJT7SI+vQMzG7EYHz0o47YRUxdyCxlovV/8YH7PlXcwvDP8ZPwa QCUOiJw1k1k+wdCTn+BCP00knve9iZg75wmVLn6ypnP/SwfmASBVzXbKfV3ZljeAGB6X ZWl2x3NY9/9aSbxEWuAXdKFKdyylnOhSxkkHPXYCewpjzE9JoNTNBotgLcGnOkw2DFOy zOV+KwvoyZ+LtmUEEmNRuPpm8u09I5CYvFqa+OsjdxChST29oegDW1IkRtK8EpZ/pASr ln7w== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=/0j9nbgsdZbL0omEY1qL679LVqCMTV/VffKv5oBSsjU=; b=kKVNRU4mYjlv8izOn8biABeUAtiY3PCZ5UsNRpBChUQXxMayvBj3e5w66JED813uVV xjYV7m80B0hM9a0aEx7dGCpg+M3q5bysxOZxEi4GN7f0y5IhKByf52kmnaDuNXV8Wn5T 8vhri1h6uJhvZLU/PPgeFg1pMrJYakZ1TluezTBUoWbTJyMvWG5HgaISIDiv5sV15QBY kYPYxVUjdk+ETBjLeW/+laVmm6tRclsjESliGHtXaxtTKyua8oiVVWfQlhjx5Z2i5QwH +gXM8pMaqJ5SMp4M+RX57uF6neGMB50BguyVyCUoS4cwuBkF3vXJCrYG6PoRdUG72/4M 8GBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aSa45hd+; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f26si9284111iog.53.2021.09.24.05.27.50; Fri, 24 Sep 2021 05:28:09 -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=@gmail.com header.s=20210112 header.b=aSa45hd+; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343590AbhIXLrc (ORCPT + 99 others); Fri, 24 Sep 2021 07:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343592AbhIXLra (ORCPT ); Fri, 24 Sep 2021 07:47:30 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBF31C061756; Fri, 24 Sep 2021 04:45:56 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id i23so26701848wrb.2; Fri, 24 Sep 2021 04:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=/0j9nbgsdZbL0omEY1qL679LVqCMTV/VffKv5oBSsjU=; b=aSa45hd+S3Fv4JUSFQ+a3kgyKy5NX9AGa0CJIDVYWneSLwqkbiGb/QdRzY0bbT5fCx I5O4NVZz0Uu5SXECHchsCiEDV+0pF1h0jDRjGsHHd/MMUIcEO2XWJ0sgaG+TVFCHJlbA LLN0zDYzeBL8vywSI/Lv/8QqoeQIQxcLsdqRdvAYHEs8WJggfxFMXa4dFgl4w4H1sZ1E x/gqlahyDWoB8y9TvhZM5C6tp7AK5IHa3ZR+468h9O+WQjC1vNg+c+pJH31tebmvMgir RkFo3J81bVSyJa2ikn2M/7W76P6DXmnBIoUh/vomkTMw77kg74sfka5XJ4newu0u3Kvo F/gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=/0j9nbgsdZbL0omEY1qL679LVqCMTV/VffKv5oBSsjU=; b=yxJLI5/irlzxY5WDCwWHocLWI6EP+5B5thoRGTGDKYPgEd31kZv3dYWdDqEr9FEk2u TAWyfqLUv9A39Gn0mPGmK/L7QP5L/mXvswQugSHM7eRfw06gZXn4aJrtME/0d+Re4ozj B9pXLnokHdQCxAbD0y/clkBy/TorALK5fbqNlHySsQBi2CFPkT5w6cIQEo2jU2XX4pHC P2VyPsW/OjN/WF22a6+c2VyD21gvnKB8W/5eUGaExDpx8ebroXOn1nX7PNdLxdk4uUjS jwfM+zisZA5iaAuJLieUdiaR4xeraU3IgHzgllgOme+AygEdIE9vW+JsTbrIe1adFNps Y0Lg== X-Gm-Message-State: AOAM533o3+2ITK6K5cm5tthd48oKCmxpGFZZvccGnHx1nHCZgy3KcIoO 5bGRqDBuOn9NkS1Zf6GTJXOz45LHOtnaiQ== X-Received: by 2002:a05:600c:298:: with SMTP id 24mr1645157wmk.116.1632483955458; Fri, 24 Sep 2021 04:45:55 -0700 (PDT) Received: from p200300e94717cfc52fe6da3ec1ed0822.dip0.t-ipconnect.de (p200300e94717cfc52fe6da3ec1ed0822.dip0.t-ipconnect.de. [2003:e9:4717:cfc5:2fe6:da3e:c1ed:822]) by smtp.googlemail.com with ESMTPSA id c4sm8157259wrt.23.2021.09.24.04.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 04:45:55 -0700 (PDT) Message-ID: <40e525300cd656dd17ffc89e1fcbc9a47ea90caf.camel@gmail.com> Subject: Re: [PATCH v1 2/2] mmc: sdhci: Use the SW timer when the HW timer cannot meet the timeout value required by the device From: Bean Huo To: Adrian Hunter , Ulf Hansson Cc: Bean Huo , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 24 Sep 2021 13:45:54 +0200 In-Reply-To: <93292ef4-8548-d2ba-d803-d3b40b7e6c1d@intel.com> References: <20210917172727.26834-1-huobean@gmail.com> <20210917172727.26834-3-huobean@gmail.com> <93292ef4-8548-d2ba-d803-d3b40b7e6c1d@intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-09-24 at 13:07 +0300, Adrian Hunter wrote: > On 24/09/21 12:17 pm, Bean Huo wrote: > > On Fri, 2021-09-24 at 08:29 +0300, Adrian Hunter wrote: > > > > If the data transmission timeout value required by the device > > > > exceeds > > > > the maximum timeout value of the host HW timer, we still use > > > > the HW > > > > timer with the maximum timeout value of the HW timer. This > > > > setting > > > > is > > > > suitable for most R/W situations. But sometimes, the device > > > > will > > > > complete > > > > the R/W task within its required timeout value (greater than > > > > the HW > > > > timer). > > > > In this case, the HW timer for data transmission will time out. > > > > Currently, in this condition, we disable the HW timer and use > > > > the > > > > SW > > > > timer only when the SDHCI_QUIRK2_DISABLE_HW_TIMEOUT quirk is > > > > set by > > > > the > > > > host driver. The patch is to remove this if statement > > > > restriction > > > > and > > > > allow data transmission to use the SW timer when the hardware > > > > timer > > > > cannot > > > > meet the required timeout value. > > > > > > The reason it is a quirk is because it does not work for all > > > hardware. > > > > > > For some controllers the timeout cannot really be disabled, only > > > the > > > > > > interrupt is disabled, and then the controller never indicates > > > completion > > > > > > if the timeout is exceeded. > > > > Hi Adrian, > > Thanks for your review. > > > > Yes, you are right. But this quirk prevents disabling the hardware > > timeoutIRQ. The purpose of this patch is to disable the hardware > > timeout IRQ and > > select the software timeout. > > > > void __sdhci_set_timeout(struct sdhci_host *host, struct > > mmc_command > > *cmd) > > { > > bool too_big = false; > > u8 count = sdhci_calc_timeout(host, cmd, &too_big); > > > > if (too_big) { > > sdhci_calc_sw_timeout(host, cmd); > > sdhci_set_data_timeout_irq(host, false); // disable > > IRQ > > } else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) { > > sdhci_set_data_timeout_irq(host, true); > > } > > > > sdhci_writeb(host, count, SDHCI_TIMEOUT_CONTROL); > > } > > > > > > The driver has detected that the hardware timer cannot meet the > > timeout > > requirements of the device, but we still use the hardware timer, > > which will > > allow potential timeout issuea . Rather than allowing a potential > > problem to exist, why can’t software timing be used to avoid this > > problem? > > Timeouts aren't that accurate. The maximum is assumed still to work. > mmc->max_busy_timeout is used to tell the core what the maximum is. > mmc->max_busy_timeout is still a representation of Host HW timer maximum timeout count, isn't it? Bean