Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7340046ybi; Wed, 5 Jun 2019 15:54:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyi8M8NC/EH+aKdXrwHmyW+NZ77j6LVKCjFWHsbziUTAGCyyvkkl3XOni5VRz1NyxctpiqF X-Received: by 2002:a17:90a:8d0d:: with SMTP id c13mr28840805pjo.137.1559775287964; Wed, 05 Jun 2019 15:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559775287; cv=none; d=google.com; s=arc-20160816; b=CsqyTxd28id1ypzH/1kjND6We9Am5F1WmDOhDtNigdSOUdBzOUGQX2NRcOMQiwv5// JIwApD1PCq3w6OA4zOaZkXUn9Mx/cKHNtAO3CTq76tdWevY6nFkndvoOI4wj66FYqP0I Scz3yzk0PSKM1RifSwiCdQ+S40/B9zazB0oxAtrm6UQQ/vF9q500nyMzptHzU/MjZBka eciufYomwmzJ29eRXwkvyy3o/bxKPIDhZp50NSVVZE+ng4Ju6sL5UYfVGxYnvBbxOynU 7GpYIJDy+e1KWlitsqP2gB/HzGhGro9fDBmz5NCmuWo3oHn3PWM/1krYacMnwwbHWfFI p7Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5exRdrUtbUyeCW9OHOiVQExue5bAGFVKBlO3hebfXgU=; b=D4IlvK1l0tIZ2agQJfSAd9nh7+F374gXoLT3oRQUstrrXOZvzZCqzHyg4fpqfZZK+3 WpjoH2Ym6mY9Ps5KMBjI8p+tCuSsltDFUvww+U+ODkPx3W05Mo2T4j2sITCY+V/Y5S8n 6jFYZcJV6BxuT9RnnBsIaJUPOMB92fnNNH3iHjVvQ1A+yvui9+gZDuUcAQLu1q7l1IrP uTFCMHzMIHQHqB0CoIljb+AhZCN9NBjlp8siHLZW8Ss6aROURNBTYasS/FrzhrtCCqn3 ASSDpry4TH7jgMzVknYsadqAqWlHpD6PT7zLG/3IGTUQsZ6VCx22rQt9LSXfSQdBDH+j KaNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Dk9RMmCt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si261696pgb.30.2019.06.05.15.54.30; Wed, 05 Jun 2019 15:54:47 -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; dkim=pass header.i=@chromium.org header.s=google header.b=Dk9RMmCt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726776AbfFEWve (ORCPT + 99 others); Wed, 5 Jun 2019 18:51:34 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:36615 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726732AbfFEWvd (ORCPT ); Wed, 5 Jun 2019 18:51:33 -0400 Received: by mail-it1-f196.google.com with SMTP id r135so195130ith.1 for ; Wed, 05 Jun 2019 15:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5exRdrUtbUyeCW9OHOiVQExue5bAGFVKBlO3hebfXgU=; b=Dk9RMmCtQVXIS7madhd1BjIGxlHFetVfq7sbOV3EWXN3IwSUE/DPrHYpsPphGlpZdp BHeovziL9pxxS+tTeP0xK6McUug95q9Bg8Y37gyXYPKSOVcLIUnCYGxCzJPSw9Vl+yKo zIUCOhcg+0KFEG0qvEm7ONy/Tn4TbWmjqw05s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5exRdrUtbUyeCW9OHOiVQExue5bAGFVKBlO3hebfXgU=; b=SgoMPIdJl8RKaPKqtJkGcnZmptfiU1q/WpcxIKWHX+zBPyzT0pZULHMqiL4ddmsfI9 Y45szx/5C7LLlXlqYisIfpzjfIIri0QbAdoRv3iLTZmSw7yDelZqnXRGgGfsB7zPpGp9 4WvonL2rUilw7NGfvHQV8htIkCdHu3UVzBTH2Ioogpa3YBVK2V6osFyZ7H8JG0kfnxQu XJMZbZlMTKmdNUnWRS5fHtbtyLaOv+7eLakv9LtsKJgmcTiUr1AssbdqB19OTNG6cBES o7nbwNexrtpIwPZej8s/8C8hXZ5UWe/Qp7V7Rkp0gzRl9hLSRjzNd7UyrgaBmMhpSToD aiNw== X-Gm-Message-State: APjAAAUFiobwv/Jj4/UAl3qcbGR0v9jD0zFqbaB6dZvCa4LWGBtktnQB NQCZRLRLVKv+hCLJxSSGrK90bTg2ks0= X-Received: by 2002:a24:7fcf:: with SMTP id r198mr26781179itc.145.1559775092850; Wed, 05 Jun 2019 15:51:32 -0700 (PDT) Received: from mail-it1-f171.google.com (mail-it1-f171.google.com. [209.85.166.171]) by smtp.gmail.com with ESMTPSA id z17sm27963iol.73.2019.06.05.15.51.30 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 15:51:31 -0700 (PDT) Received: by mail-it1-f171.google.com with SMTP id r135so194978ith.1 for ; Wed, 05 Jun 2019 15:51:30 -0700 (PDT) X-Received: by 2002:a24:5a06:: with SMTP id v6mr14776129ita.160.1559775090284; Wed, 05 Jun 2019 15:51:30 -0700 (PDT) MIME-Version: 1.0 References: <20190603183740.239031-1-dianders@chromium.org> <20190603183740.239031-3-dianders@chromium.org> <25fe1725-76fa-2739-1427-b0e8823ea4ae@broadcom.com> In-Reply-To: <25fe1725-76fa-2739-1427-b0e8823ea4ae@broadcom.com> From: Doug Anderson Date: Wed, 5 Jun 2019 15:51:19 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/3] mmc: core: API for temporarily disabling auto-retuning due to errors To: Arend Van Spriel Cc: Ulf Hansson , Kalle Valo , Adrian Hunter , brcm80211-dev-list.pdl@broadcom.com, "open list:ARM/Rockchip SoC..." , Double Lo , Brian Norris , linux-wireless , Naveen Gupta , Madhan Mohan R , Matthias Kaehlcke , Wright Feng , Chi-Hsien Lin , netdev , brcm80211-dev-list , Linux MMC List , LKML , Shawn Lin , Wolfram Sang , Avri Altman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Jun 5, 2019 at 12:54 AM Arend Van Spriel wrote: > > On 6/3/2019 8:37 PM, Douglas Anderson wrote: > > Normally when the MMC core sees an "-EILSEQ" error returned by a host > > controller then it will trigger a retuning of the card. This is > > generally a good idea. > > > > However, if a command is expected to sometimes cause transfer errors > > then these transfer errors shouldn't cause a re-tuning. This > > re-tuning will be a needless waste of time. One example case where a > > transfer is expected to cause errors is when transitioning between > > idle (sometimes referred to as "sleep" in Broadcom code) and active > > state on certain Broadcom WiFi cards. Specifically if the card was > > already transitioning between states when the command was sent it > > could cause an error on the SDIO bus. > > > > Let's add an API that the SDIO card drivers can call that will > > temporarily disable the auto-tuning functionality. Then we can add a > > call to this in the Broadcom WiFi driver and any other driver that > > might have similar needs. > > > > NOTE: this makes the assumption that the card is already tuned well > > enough that it's OK to disable the auto-retuning during one of these > > error-prone situations. Presumably the driver code performing the > > error-prone transfer knows how to recover / retry from errors. ...and > > after we can get back to a state where transfers are no longer > > error-prone then we can enable the auto-retuning again. If we truly > > find ourselves in a case where the card needs to be retuned sometimes > > to handle one of these error-prone transfers then we can always try a > > few transfers first without auto-retuning and then re-try with > > auto-retuning if the first few fail. > > > > Without this change on rk3288-veyron-minnie I periodically see this in > > the logs of a machine just sitting there idle: > > dwmmc_rockchip ff0d0000.dwmmc: Successfully tuned phase to XYZ > > > > Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors") > > Signed-off-by: Douglas Anderson > > --- > > Note that are are a whole boatload of different ways that we could > > provide an API for the Broadcom WiFi SDIO driver. This patch > > illustrates one way but if maintainers feel strongly that this is too > > ugly and have a better idea then I can give it a shot too. From a > > purist point of view I kinda felt that the "expect errors" really > > belonged as part of the mmc_request structure, but getting it into > > there meant changing a whole pile of core SD/MMC APIs. Simply adding > > it to the host seemed to match the current style better and was a less > > intrusive change. > > Hi Doug, > > Sorry for bringing this up, but there used to be an issue with retuning > in general, ie. the device handled tuning command 19 only once after > startup. I guess that is no longer an issue given your results. Right. It definitely used to just happen once at bootup and you were out of luck if that value was bad for some reason or if conditions changed. In cases in my own personal experience it was actually fine to just tune once at bootup once all the tuning bugs in the controller were fixed. ...but I can imagine that some controllers could use delay elements that drift more. ...and in any case if you're getting CRC errors trying a re-tuning seems a sensible thing to do anyway (unless the CRC error was expected). Looking at commit bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors") you can definitely see evidence that tuning can happen again after bootup. > I guess > the problem goes away when you disable device sleep functionality. No > what you want in terms of power consumption, but would be good to know. > You can disable it with below patch. I can try testing this if it's useful, but I'm not sure what it will prove. I definitely don't want to disable device sleep, so it's not a long term solution. Are you just looking for extra evidence that this is indeed my problem? I don't think I need any extra evidence, do I? The fact that patch #3 in this series fixes my problems (plus debugging I did to arrive at that patch) means we absolutely know that brcmf_sdio_kso_control() is responsible for the CRC errors that caused the unneeded tuning. Setting BRCMF_IDLE_INTERVAL to 0 will effectively prevent brcmf_sdio_kso_control() from doing anything useful (except in full system suspend, but that's not the case I was testing anyway). -Doug