Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp442406ima; Wed, 24 Oct 2018 04:01:09 -0700 (PDT) X-Google-Smtp-Source: AJdET5cJJhPoMi6/VXCu/g7a+DEPd9zpMDXwZd8KfLuQQThmQUr7Gnm4lVV3lrZ4WMPLhMLnBKfd X-Received: by 2002:a17:902:760b:: with SMTP id k11-v6mr2099646pll.103.1540378869659; Wed, 24 Oct 2018 04:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540378869; cv=none; d=google.com; s=arc-20160816; b=JyBXm66Aff1V1lvHTtz4VDzi5wahsl1tF8434yKh8IscAmVoYSdHpa6AEGPfTnVmUG GvtAps3B9TI9aZYstAlpDFiNOdn2Z4BixkVXf+n2/EqmFXQbYvr84VTDWYkMpnaAtzfr Uug95JfCzT7VisYZlOfxv3+AzBfXcPJ9CHq6grWryOJWJ9m8l36a8Ur7iVNLAfQi9u29 YGrSlNjeAB4W1RJDseFdUotFnX5TQ0wfiObOLiqM22x+wiAae25IElo3tF/VZ4LK9KkT yFAV55ShdDZwCg4XEtl5VAdyTIj/kvBArCzH+HIk9HrlaP1SiBuj8vYZrYSCkgsK653T BVIw== 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 :references:in-reply-to:mime-version:dkim-signature; bh=S4ykQxBxfgammuCKpLpHiuFupgumeTsWJCTlk1YJ8nw=; b=EUiR9sgdoRr5ln3A4vYUKUyC7k2huCl2Vpnzc/Ex/dUW8G8I2k3h322XYgFmUr8gTX Yn+28qJC6TzH2Mc3P4G/yp5OnSMA8+2ovqWjcwG6jKoBcNrnOIv6eT9D7HDTQQmHCW8y /jfgHAngXS5Rp/Chogfyp5gqK6kg0vRCr0MTeLnCeNlUptMtPojyTcp1uNYGucaNJ+Am ruGQcYLVsj8rrSSqEmLuK8TZL+dCRNjbS+ix3KQJaXPxjfq1K0o5r/Epjpi76GyJsERz 8HOyouaSqtSrdtDxqiBQKfGmI22nhJps0y6zz46hoMBcQEMZ6d9k/m1KH8kvIZ6v0s9l 7bIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ikWuqt3x; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si4228263ple.116.2018.10.24.04.00.54; Wed, 24 Oct 2018 04:01:09 -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=@linaro.org header.s=google header.b=ikWuqt3x; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbeJXT1x (ORCPT + 99 others); Wed, 24 Oct 2018 15:27:53 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:35831 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbeJXT1x (ORCPT ); Wed, 24 Oct 2018 15:27:53 -0400 Received: by mail-it1-f195.google.com with SMTP id p64-v6so6020061itp.0 for ; Wed, 24 Oct 2018 04:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=S4ykQxBxfgammuCKpLpHiuFupgumeTsWJCTlk1YJ8nw=; b=ikWuqt3xpqn05y5RavVWpIyzO/0Nr+EaShFC7I56F5DoG9Kh/t/VKvKkwOFFwPlO0M gC7T0ZjzKcHK78fXVrgSNHZ7fqFOD3KwzEZXwAz5ZBiaRUvWGv2xHkwIJYywTYx4xnPX PZrxo7mwpfWxANgmun+aAkyJwNpFWl8aa6w0o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=S4ykQxBxfgammuCKpLpHiuFupgumeTsWJCTlk1YJ8nw=; b=VwUbSTXH9PhEgTO/UHI7Ux5BrqdGxbMRlq3MY3L3m2IEVoWM93ovVfcuSE+acDvmje keNKW5ZUYVbSgir06B1sTjkQ38jOzJNrv5HzDV4KXs9K8O2dkF3lOsqCro0Zp7jwR6y0 ZebwG1F+4asEET6mebUtzkP69xTrZkQsgEt/gKTYq2GxwVLxEW81eF/WF7A68hBPuSX0 EwTwopGP1dX3gFIUtB7NZFJZA71RbLDc9QAVHEwtaeTtm9JBSR+VQLoFDA4oR//Mpp4F 2uNY9yGzHD6v2wvRjBrBnn7KVY9sjyqzqeUY7SF0jR6TDIKRCbilrRKCdI3MyNtlMzVK 4A2Q== X-Gm-Message-State: AGRZ1gJ+Xwspp8q33gy0dfBPF0ejEvjyoFxBNebDOMtHL8zh6H7m0sm7 6tY1qeEJeGyIl32xckm2X8jVoRT+52h+gW6OLhVh9RR7 X-Received: by 2002:a24:6b4d:: with SMTP id v74-v6mr1096280itc.26.1540378813447; Wed, 24 Oct 2018 04:00:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:3941:0:0:0:0:0 with HTTP; Wed, 24 Oct 2018 03:59:33 -0700 (PDT) In-Reply-To: <20181019144024.31077-1-jonas@orbital-systems.com> References: <20181019144024.31077-1-jonas@orbital-systems.com> From: Ulf Hansson Date: Wed, 24 Oct 2018 12:59:33 +0200 Message-ID: Subject: Re: [PATCH] mmc: atmel-mci: do not assume idle after atmci_request_end To: Jonas Danielsson Cc: Linux Kernel Mailing List , Ludovic Desroches , "linux-mmc@vger.kernel.org" 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 On 19 October 2018 at 16:40, Jonas Danielsson wrote: > On our AT91SAM9260 board we use the same sdio bus for wifi and for the > sd card slot. This caused the atmel-mci to give the following splat on > the serial console: > > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 538 at drivers/mmc/host/atmel-mci.c:859 atmci_send_command+0x24/0x44 > Modules linked in: > CPU: 0 PID: 538 Comm: mmcqd/0 Not tainted 4.14.76 #14 > Hardware name: Atmel AT91SAM9 > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (__warn+0xd8/0xf4) > [] (__warn) from [] (warn_slowpath_null+0x1c/0x24) > [] (warn_slowpath_null) from [] (atmci_send_command+0x24/0x44) > [] (atmci_send_command) from [] (atmci_start_request+0x1f4/0x2dc) > [] (atmci_start_request) from [] (atmci_request+0xf0/0x164) > [] (atmci_request) from [] (mmc_start_request+0x280/0x2d0) > [] (mmc_start_request) from [] (mmc_start_areq+0x230/0x330) > [] (mmc_start_areq) from [] (mmc_blk_issue_rw_rq+0xc4/0x310) > [] (mmc_blk_issue_rw_rq) from [] (mmc_blk_issue_rq+0x118/0x5ac) > [] (mmc_blk_issue_rq) from [] (mmc_queue_thread+0xc4/0x118) > [] (mmc_queue_thread) from [] (kthread+0x100/0x118) > [] (kthread) from [] (ret_from_fork+0x14/0x34) > ---[ end trace 594371ddfa284bd6 ]--- > > This is: > WARN_ON(host->cmd); > > This was fixed on our board by letting atmci_request_end determine what > state we are in. Instead of unconditionally setting it to STATE_IDLE on > STATE_END_REQUEST. I am sure this change is just papering over much more bigger issues [1], which are present when using one host for multiple slots. In either case, as it seems to improve things, I have queued it up for 4.21, thanks! Kind regards Uffe [1] https://www.spinics.net/lists/linux-mmc/msg49815.html > > Signed-off-by: Jonas Danielsson > --- > drivers/mmc/host/atmel-mci.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c > index 0a0ebf3a0..c8a591d8a 100644 > --- a/drivers/mmc/host/atmel-mci.c > +++ b/drivers/mmc/host/atmel-mci.c > @@ -1954,13 +1954,14 @@ static void atmci_tasklet_func(unsigned long priv) > } > > atmci_request_end(host, host->mrq); > - state = STATE_IDLE; > + goto unlock; /* atmci_request_end() sets host->state */ > break; > } > } while (state != prev_state); > > host->state = state; > > +unlock: > spin_unlock(&host->lock); > } > > -- > 2.17.2 >