Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1865328pxu; Sun, 13 Dec 2020 06:01:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxjCa81KGxHWw2bOAlCJFKseSD5Zny1X7wuhb/2fD9yMlBnch747pReZCPMIm7UOcHE3VZV X-Received: by 2002:a05:6402:3049:: with SMTP id bu9mr20711895edb.127.1607868082044; Sun, 13 Dec 2020 06:01:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607868082; cv=none; d=google.com; s=arc-20160816; b=H+Qf4TPWgAMOO6u8QoemLxo5WqPFUkt6d5CJlXtqWjTCFl/3hIA8Ug5jsI/NAvEXJt sU1pOk2C2gyPCQPuiZCT6zvrEwfDdfdNfwu4y+PA+s3VZ6ZoufvM1wFx9mAZzJWirarJ vOaCz2cT3DHBT7cpdK4PCP45X49pGTSNpz8UmLy7WUF4iNNxjNITlIZ226FYf3iU/TcH B22U1f9PG7C6cwu4LhEc0jmeoJXSo/afJYMOkgRlA7a6BTGvZgtiYPcwvhl6Ti7GdMIc CBmpSRlpMiBVxPJjkUkoinKiF3jf2qm6yAIwOQLj0aDXUfsC40ivjUUpuotQIdDsZsU9 VA/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=89PR1XJOQ3AXJnqqfEc8vjhhdDtUcMjkmWKDCFEBDfA=; b=ZxIZECR7yJk3yccGiTcB3O8lTcUZHU9OVsNE1z6oj/zCMw48MEuZIPOcWeYvhRmQdV TnPjLSmxM9M+Cnz2o23LAyv+ouRsAm/tX0Q+w7Lc2WK3Po/z5/S2e/ZrbzsK1EM7XXQm AC1zoNOXwZ0+WnCMSE/HOfixA9ZmrJotiYWM2XqSdB+C2YjtIVEI8DAt+n4tPZ5G8jko I5ptlYJo264gD1JZhfeTO0yfoghilrEE2CO4GUpc7EMAFhn/uYy7YRGR/DYqR2r1LWXP iGRl2SWJHF8Iang1bQl5nFfACFuk3JmEGZbet13QOrMtm4HuBm4RX7Md5EWz4ndH1AMH BX5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KziBoxlq; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si8650860ejf.344.2020.12.13.06.00.59; Sun, 13 Dec 2020 06:01:22 -0800 (PST) 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=@chromium.org header.s=google header.b=KziBoxlq; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405261AbgLLBc5 (ORCPT + 99 others); Fri, 11 Dec 2020 20:32:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406542AbgLLBcn (ORCPT ); Fri, 11 Dec 2020 20:32:43 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA40C0613D6 for ; Fri, 11 Dec 2020 17:32:03 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id t37so8378644pga.7 for ; Fri, 11 Dec 2020 17:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=89PR1XJOQ3AXJnqqfEc8vjhhdDtUcMjkmWKDCFEBDfA=; b=KziBoxlqrygnMqkQZIsOH1IqWRTRks0E0laPSHjpnzDIsngRIIM4b/UeleALrKa3YJ 4GKyhns8nOMvfT+0LrReca3YXhaHbbqyo2LOdX7LTMywJWPTkNzg2sgUkdhM0M7sved4 soStHWAioS20Du7cAwmgPNc8A/femXn/+xkGo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=89PR1XJOQ3AXJnqqfEc8vjhhdDtUcMjkmWKDCFEBDfA=; b=aarXpgBhzxdym7XRirB4L8lT97Zx5ysfWCndzad54uYbWuFT5XFlMASP+5tAKrFYnN bKwm4iVgIVsYDgRYD8U5rDdr470jGw/8Ux07kK1oGBHYQY+CBiLCcVg8IVvaE1A9Y/uO GJCKBW+TSdkmdM/8YJRd6j+cBaapBTiIk/lRSoUBFyKURy1cwnQc+1SMn0ghBZtklDqa hrZumjd7ACBgvPxz3nzrdB7ZLMcJ+RAfHyFeFyjXVISjhq0k37k870NI7OyE7aBOsZt2 tyINKUpXUOj4YAs/h/++AXs6Oa4dgsCkOjx1KMF7dyrkZEHnz/DTMBZl70Qt9cAnfPjH PZUg== X-Gm-Message-State: AOAM532VPqSprMWtL8YZRue6rS2iFXA+2gECKo0bhAufHQpV4gKAHCbC xCbqjVQaYiKGBNQzAdPpHWF3WcxFzHPHNA== X-Received: by 2002:a63:4e58:: with SMTP id o24mr14318396pgl.322.1607736722938; Fri, 11 Dec 2020 17:32:02 -0800 (PST) Received: from chromium.org ([2620:15c:202:201:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id ci2sm10838684pjb.40.2020.12.11.17.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Dec 2020 17:32:02 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20201203074459.13078-1-rojay@codeaurora.org> <160764316821.1580929.18177257779550490986@swboyd.mtv.corp.google.com> <160764785500.1580929.4255309510717807485@swboyd.mtv.corp.google.com> <160764967649.1580929.3992720095789306793@swboyd.mtv.corp.google.com> <160765077856.1580929.643282739071441296@swboyd.mtv.corp.google.com> Subject: Re: [PATCH] spi: spi-geni-qcom: Fix NULL pointer access in geni_spi_isr From: Stephen Boyd Cc: Roja Rani Yarubandi , Mark Brown , Andy Gross , Bjorn Andersson , linux-arm-msm , linux-spi , LKML , Akash Asthana , msavaliy@qti.qualcomm.com To: Doug Anderson Date: Fri, 11 Dec 2020 17:32:00 -0800 Message-ID: <160773672053.1580929.15441111796129112926@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Doug Anderson (2020-12-10 17:51:53) > Hi, >=20 > On Thu, Dec 10, 2020 at 5:39 PM Stephen Boyd wrote: > > > > Quoting Doug Anderson (2020-12-10 17:30:17) > > > On Thu, Dec 10, 2020 at 5:21 PM Stephen Boyd wr= ote: > > > > > > > > Yeah and so if it comes way later because it timed out then what's = the > > > > point of calling synchronize_irq() again? To make the completion > > > > variable set when it won't be tested again until it is reinitialize= d? > > > > > > Presumably the idea is to try to recover to a somewhat usable state > > > again? We're not rebooting the machine so, even though this transfer > > > failed, we will undoubtedly do another transfer later. If that > > > "abort" interrupt comes way later while we're setting up the next > > > transfer we'll really confuse ourselves. > > > > The interrupt handler just sets a completion variable. What does that > > confuse? >=20 > The interrupt handler sees a "DONE" interrupt. If we've made it far > enough into setting up the next transfer that "cur_xfer" has been set > then it might do more, no? I thought it saw a cancel/abort EN bit? if (m_irq & M_CMD_CANCEL_EN) complete(&mas->cancel_done); if (m_irq & M_CMD_ABORT_EN) complete(&mas->abort_done) and only a DONE bit if a transfer happened. >=20 >=20 > > > I guess you could go the route of adding a synchronize_irq() at the > > > start of the next transfer, but I'd rather add the overhead in the > > > exceptional case (the timeout) than the normal case. In the normal > > > case we don't need to worry about random IRQs from the past transfer > > > suddenly showing up. > > > > > > > How does adding synchronize_irq() at the end guarantee that the abort is > > cleared out of the hardware though? It seems to assume that the abort is > > pending at the GIC when it could still be running through the hardware > > and not executed yet. It seems like a synchronize_irq() for that is > > wishful thinking that the irq is merely pending even though it timed > > out and possibly never ran. Maybe it's stuck in a write buffer in the > > CPU? >=20 > I guess I'm asserting that if a full second passed (because we timed > out) and after that full second no interrupts are pending then the > interrupt will never come. That seems a reasonable assumption to me. > It seems hard to believe it'd be stuck in a write buffer for a full > second? >=20 Ok, so if we don't expect an irq to come in why are we calling synchronize_irq()? I'm lost.