Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp513368ybg; Fri, 12 Jun 2020 07:29:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/1NxAPP+F1NK3wQAqxkLdN25GnJqh/Sk9+e6FjqYx0EhiDwtX/UWr+TK9qrUZ2x7ePVk1 X-Received: by 2002:a50:8307:: with SMTP id 7mr12232385edh.283.1591972166510; Fri, 12 Jun 2020 07:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591972166; cv=none; d=google.com; s=arc-20160816; b=FAoXHkObGooeFqJ+ptFB4z8q0EdDhh7YpC0Kg4+8AQNWj99W2QocVaMy4apIKVSdJs UPQo4QbmkaUWGHKSs7j07N3/K10Y9Qy6qhQZ/ODi/qLXFpHyumGSQtwV8wKQBhDB4qxK 4qYP0XryW4EzV4TcAEGC+cPldbgrTKURk9lW9j3BSGwj0NakL1Gims1b89S5zpVbmvf+ C88UrD+90g+PAxjllWiqLBJQpCAGItOp//se9io69TtUQVsxnDLJov38DK6jG+BKy9ZU byelUpJsPdRKCUekPRfA5LC61T+4Vy8ntRHUop6uQns7bdMz+oPaUcFFbyqU9TmGVKjH LsEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=6TkXm7WIXe6JmUlAyDwjFnbArqNv0j3TvAXTAuTgCHs=; b=jEjXWeFmC+SLM1bdb9syTRP5c8NoB4MHnS7mtcXpmkAQ5aoMzoDP+qk1s4pLtUR457 CQvxdJ+8+VkTzvHd4uOXMY/vT/sw0aZYVxZ+fq+U3EFQkM7ioMjaA5MFygZLVwp/O7mu xHAtGtkfwvbIlAVPC6IUm4o7sV9C0USk13YgHpTpAMusZ0Gpjuqch8zv85wP7C19KIjz M5b6FHjpUWLfXv94pPnqUukpEPAVDhox2oKLcXM/GrSxLNKHY8fyYfsXcMOLM86V5PNO i/TMxkr1pTGWCClUijLCxgoJTHwVSNCX4fncx0MVSJsP46BdEG6BWlXzHtqtwHwrdsu1 w/lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=gF7xb6WI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c28si3458991edj.317.2020.06.12.07.28.52; Fri, 12 Jun 2020 07:29:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=gF7xb6WI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726474AbgFLOZk (ORCPT + 99 others); Fri, 12 Jun 2020 10:25:40 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:11893 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgFLOZk (ORCPT ); Fri, 12 Jun 2020 10:25:40 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1591971939; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=6TkXm7WIXe6JmUlAyDwjFnbArqNv0j3TvAXTAuTgCHs=; b=gF7xb6WIQJEYfjshXzN17+T85HcLmzdvCgZH1n7LqWJenZ+AkspejnbxedSUGdLAx/J4YKA3 Cu/a0MSOn9PdfAI+ow5BnyWN360XPsrcfqKwoN5DNiiBUlrQFa+eGcQeof8GO997JRXLUn6d a3XDfdgpTYTzF8DrAY3qYPffPXU= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n11.prod.us-east-1.postgun.com with SMTP id 5ee39060356bcc26abfe7866 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 12 Jun 2020 14:25:36 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2E5F2C433CB; Fri, 12 Jun 2020 14:25:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: pillair) by smtp.codeaurora.org (Postfix) with ESMTPSA id 62898C433CA; Fri, 12 Jun 2020 14:25:35 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 12 Jun 2020 19:55:35 +0530 From: pillair@codeaurora.org To: Douglas Anderson Cc: kvalo@codeaurora.org, kuabhs@google.com, saiprakash.ranjan@codeaurora.org, linux-arm-msm@vger.kernel.org, "David S. Miller" , Jakub Kicinski , ath10k@lists.infradead.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] ath10k: Wait until copy complete is actually done before completing In-Reply-To: <20200609082015.1.Ife398994e5a0a6830e4d4a16306ef36e0144e7ba@changeid> References: <20200609082015.1.Ife398994e5a0a6830e4d4a16306ef36e0144e7ba@changeid> Message-ID: <775536279e60ccc833c481ad6ab6dab2@codeaurora.org> X-Sender: pillair@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Doug, The send callback for the CEs do check for hw_index/SRRI before trying to free the buffer. But adding a check for copy-complete (before calling the individual CE callbacks) seems to be the better approach. Hence I agree that this patch should be added. Thanks, Rakesh Pillai. On 2020-06-09 20:50, Douglas Anderson wrote: > On wcn3990 we have "per_ce_irq = true". That makes the > ath10k_ce_interrupt_summary() function always return 0xfff. The > ath10k_ce_per_engine_service_any() function will see this and think > that _all_ copy engines have an interrupt. Without checking, the > ath10k_ce_per_engine_service() assumes that if it's called that the > "copy complete" (cc) interrupt fired. This combination seems bad. > > Let's add a check to make sure that the "copy complete" interrupt > actually fired in ath10k_ce_per_engine_service(). > > This might fix a hard-to-reproduce failure where it appears that the > copy complete handlers run before the copy is really complete. > Specifically a symptom was that we were seeing this on a Qualcomm > sc7180 board: > arm-smmu 15000000.iommu: Unhandled context fault: > fsr=0x402, iova=0x7fdd45780, fsynr=0x30003, cbfrsynra=0xc1, cb=10 > > Even on platforms that don't have wcn3990 this still seems like it > would be a sane thing to do. Specifically the current IRQ handler > comments indicate that there might be other misc interrupt sources > firing that need to be cleared. If one of those sources was the one > that caused the IRQ handler to be called it would also be important to > double-check that the interrupt we cared about actually fired. > > Signed-off-by: Douglas Anderson Reviewed-by: Rakesh Pillai > --- > > drivers/net/wireless/ath/ath10k/ce.c | 30 +++++++++++++++++++--------- > 1 file changed, 21 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath10k/ce.c > b/drivers/net/wireless/ath/ath10k/ce.c > index 294fbc1e89ab..ffdd4b995f33 100644 > --- a/drivers/net/wireless/ath/ath10k/ce.c > +++ b/drivers/net/wireless/ath/ath10k/ce.c > @@ -481,6 +481,15 @@ static inline void > ath10k_ce_engine_int_status_clear(struct ath10k *ar, > ath10k_ce_write32(ar, ce_ctrl_addr + wm_regs->addr, mask); > } > > +static inline bool ath10k_ce_engine_int_status_check(struct ath10k > *ar, > + u32 ce_ctrl_addr, > + unsigned int mask) > +{ > + struct ath10k_hw_ce_host_wm_regs *wm_regs = ar->hw_ce_regs->wm_regs; > + > + return ath10k_ce_read32(ar, ce_ctrl_addr + wm_regs->addr) & mask; > +} > + > /* > * Guts of ath10k_ce_send. > * The caller takes responsibility for any needed locking. > @@ -1301,19 +1310,22 @@ void ath10k_ce_per_engine_service(struct > ath10k *ar, unsigned int ce_id) > > spin_lock_bh(&ce->ce_lock); > > - /* Clear the copy-complete interrupts that will be handled here. */ > - ath10k_ce_engine_int_status_clear(ar, ctrl_addr, > - wm_regs->cc_mask); > + if (ath10k_ce_engine_int_status_check(ar, ctrl_addr, > + wm_regs->cc_mask)) { > + /* Clear before handling */ > + ath10k_ce_engine_int_status_clear(ar, ctrl_addr, > + wm_regs->cc_mask); > > - spin_unlock_bh(&ce->ce_lock); > + spin_unlock_bh(&ce->ce_lock); > > - if (ce_state->recv_cb) > - ce_state->recv_cb(ce_state); > + if (ce_state->recv_cb) > + ce_state->recv_cb(ce_state); > > - if (ce_state->send_cb) > - ce_state->send_cb(ce_state); > + if (ce_state->send_cb) > + ce_state->send_cb(ce_state); > > - spin_lock_bh(&ce->ce_lock); > + spin_lock_bh(&ce->ce_lock); > + } > > /* > * Misc CE interrupts are not being handled, but still need