Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3022574pxb; Mon, 6 Sep 2021 10:22:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjE4rfkId9H+ySE8ypwJysHvPZdOfHBtWwlM1Q9QgzqW0MIn7crbXENhJpeJQ/+BKGC0to X-Received: by 2002:a17:907:2d2b:: with SMTP id gs43mr14654900ejc.437.1630948973160; Mon, 06 Sep 2021 10:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630948973; cv=none; d=google.com; s=arc-20160816; b=LhE4I5jeknJZgKvGWoovLuCJEZ6qSIJl/x9dpmSJSoAOXih9lFp0fq/I3LiRylSbrk DhBUh39D8PrXGauUAaKpm2bK9qlrUNkZowBAA7G7cATJp6lGY0t2nlHo+nw6jy5nzJZP jGwsr6zuwvt3e4gXnlwIt9TJ5XPIsicBFaSYodMhT+KJWFOmRWgUClu45gCOqFu323Kn KFCN7Dy7BZJAXp72rqxgyk41v6p0AnkPjeABRNSErqf9Emyim1v5a5dzIqJdSQgaYzGV IIQzNqLxsGXgcX77DmEywOfEIbX2zv+Peyk3r5D20thoZnABwgvhYAld6fFbumm/AfCD uC3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kPdYFCV+vKZ4TQdTslv8+T4RJlQzhCm6iqn6XOsBv64=; b=VSpu4ENO5T7YI9P0/sMBA3LmfVGrmYuLDXgFSP2h4OHOODPloUlgdoeQzPhQjapKY/ Og2X1WMjR83Hinyl+gXrhOzh8hq39xZqV6uwKEXt5ddOA9x6BuxjmN0x8Jn9b1j7F5yp 4FKyj8JB0RPmJ9drfhO3io7AY27UL03cLYst0m9LBNRkJS088DPQmGYTkIAfE1aMBgXI nPq5PlIpUFrNz4QqKZu8WfHzUOqUxXq/t72k4lJxsnNQhppVX60wXwKuz7zICzr7nf6n +R+6i0vroVsZ0ZWp4ijBU37nhlzhiYBRsY6f8NFEuvuLQZFLwPMND1lQlLKpeDrQzDJf BW/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OYSxCqfR; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si8630487edw.260.2021.09.06.10.22.29; Mon, 06 Sep 2021 10:22:53 -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=@linaro.org header.s=google header.b=OYSxCqfR; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbhIFRKw (ORCPT + 99 others); Mon, 6 Sep 2021 13:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbhIFRKv (ORCPT ); Mon, 6 Sep 2021 13:10:51 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD965C061575 for ; Mon, 6 Sep 2021 10:09:46 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id d16so12321754ljq.4 for ; Mon, 06 Sep 2021 10:09:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kPdYFCV+vKZ4TQdTslv8+T4RJlQzhCm6iqn6XOsBv64=; b=OYSxCqfRQPO7YuRvad5pqw6YM1aCXkOGH8vEqm3zzlUUAU6NsJUK5b5gq5ejQ5/eEn LcVxLUm0M/11/KBEKvZbSRZEZkSlKo1jaGCG9Z+q+wbRqGtMoyXd2/LpHRy5nzsZ/2Ml eYwVEJtMxKWdHXGyRtmVNf5VCWPfrJxUNyVQsjroF/cji+mg10DUjsIFM6Yto0/xssKM b2CVQZIej6IHmGIRd0kSqSKUGtLPNt54K88fw7Rtywt6KSDPVOXY3UF/nR6MGcwKLgox ZvYpLTKC3rPcxA5VdYKCPjin+sRYe2b5tGq5a9u3ZHLf4dd3qexhXSJRrF2Ub5qdVPRY diGQ== 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=kPdYFCV+vKZ4TQdTslv8+T4RJlQzhCm6iqn6XOsBv64=; b=eM0dUWEzjwKtSskAr3kfFSDBGZupnHMX/y91sJMziQ203VKURWVXE2NEPcWaNchJxY ZlanlSJYx994FzGhw1fPdPCy1Deza/ddhk3BIjpNWxkgn/7KWm4q8WxXid+89VFM+wpP tYl9Ja074EmqCPNKjeUeyyyZ5DxjGXudlSKPoWs0PcJJxavv5QOhAhyLcCEWx2dVdfVs mOa9lO2o93Z8Go+pzVRmVbTqjd1CNBym/OqQuOb39TyKYJmKqTb/mQy3ETESAH1lonId BT7YCuZhToMsYKvbmj878Q2PFBRDYESPsA8jYvkcQSeij70lY4cuYSwvBTNQYolpd4n6 CQXA== X-Gm-Message-State: AOAM530t3Oml3V3Sl+xItj5zpGovGV+Ht9nRSnQdHhLaRlaoGpVKlpV0 T7/5MjQSr6cAA8u1OMHqdLgLU2R9r+u7akx2k6cJqqb3Jx4= X-Received: by 2002:a05:651c:1b3:: with SMTP id c19mr11753747ljn.16.1630948185017; Mon, 06 Sep 2021 10:09:45 -0700 (PDT) MIME-Version: 1.0 References: <20210825114213.7429-1-vincent.whitchurch@axis.com> In-Reply-To: <20210825114213.7429-1-vincent.whitchurch@axis.com> From: Ulf Hansson Date: Mon, 6 Sep 2021 19:09:08 +0200 Message-ID: Subject: Re: [PATCH] mmc: dw_mmc: Only inject fault before done/error To: Vincent Whitchurch Cc: Jaehoon Chung , kernel , linux-mmc , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Aug 2021 at 13:42, Vincent Whitchurch wrote: > > The fault injection function can set EVENT_DATA_ERROR but skip the > setting of ->data_status to an error status if it hits just after a data > over interrupt. This confuses the tasklet which can later end up > triggering the WARN_ON(host->cmd || ..) in dw_mci_request_end() since > dw_mci_data_complete() would return success. > > Prevent the fault injection function from doing this since this is not a > real case, and ensure that the fault injection doesn't race with a real > error either. > > Signed-off-by: Vincent Whitchurch Applied for fixes and by adding a fixes tag, thanks! Kind regards Uffe > --- > drivers/mmc/host/dw_mmc.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c > index 6578cc64ae9e..380f9aa56eb2 100644 > --- a/drivers/mmc/host/dw_mmc.c > +++ b/drivers/mmc/host/dw_mmc.c > @@ -1802,10 +1802,15 @@ static enum hrtimer_restart dw_mci_fault_timer(struct hrtimer *t) > > spin_lock_irqsave(&host->irq_lock, flags); > > - if (!host->data_status) > + /* > + * Only inject an error if we haven't already got an error or data over > + * interrupt. > + */ > + if (!host->data_status) { > host->data_status = SDMMC_INT_DCRC; > - set_bit(EVENT_DATA_ERROR, &host->pending_events); > - tasklet_schedule(&host->tasklet); > + set_bit(EVENT_DATA_ERROR, &host->pending_events); > + tasklet_schedule(&host->tasklet); > + } > > spin_unlock_irqrestore(&host->irq_lock, flags); > > @@ -2721,12 +2726,16 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) > } > > if (pending & DW_MCI_DATA_ERROR_FLAGS) { > + spin_lock(&host->irq_lock); > + > /* if there is an error report DATA_ERROR */ > mci_writel(host, RINTSTS, DW_MCI_DATA_ERROR_FLAGS); > host->data_status = pending; > smp_wmb(); /* drain writebuffer */ > set_bit(EVENT_DATA_ERROR, &host->pending_events); > tasklet_schedule(&host->tasklet); > + > + spin_unlock(&host->irq_lock); > } > > if (pending & SDMMC_INT_DATA_OVER) { > -- > 2.28.0 >