Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1643182ybt; Mon, 15 Jun 2020 05:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQzQT3K1yxGDRYYLcodShqaZ2KbUgKQbNgP4sIv3tIHZ17CmKmnqQHkVLM+32MkZJJxanE X-Received: by 2002:a05:6402:659:: with SMTP id u25mr19696857edx.124.1592225939861; Mon, 15 Jun 2020 05:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592225939; cv=none; d=google.com; s=arc-20160816; b=rVWRcp2cywTdEhwm9ybNjSDHop6R4SLTZFqDy65dFjJrQWJiPp+n/ARpcOIe1RHBIp 2Ap+hMVsVDYBSOsOfYFYgTGcB5Osq8rwDJE/SDcGokNk0y5fyrq2j8Q90L/lmcJJC5fm dMfGe2fm/+3pC673MoIKwGQNWMpVON1Ksasqkr+pWE9igThzxfWA8JOacw70CH0VS6WW /w7Dt92zsgRW+dC6f2izOBp7qca3rW8B/mohf1LGU62adETufYcrCbm3MQMqV17bSnCU EoMdtbLfgkJODgDBEks9ANtgeNOcBZFWnAV/n6ui8Ed/Nc6BFyD9icFGctsDbUUsCD7z sl3w== 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=qXYey5+z4XH/ze0CWdNcvFvzyDDniwsSZOKQE4KvrPA=; b=jUdUh10ZUVron9HkoJV6+Cg9fcuZb0v7EOhaITrA3iQB6zdO16NEWTi6DPFbbQKY5U uhNO4U5pEf8qwGaC1wyFTG3CajZa+sIOcFWF7jWDAzkBYllroPVGkmCZYQB7WkCYKmKC uzyrM4ly++1lALEHGTCWQF4afcHJFmjD0hWhzeovvLkHb9A+QR9bAhvM6RBIYnSOfnV/ 7rbhjlKCUvbyVKSeBKiEpS20LumJb+adIIZ0azCpkb8d9ICDB/hzDsDKOzRTKkENAo+a Ebf8mIxRRZyNkXVDzSl8BUmdr47Bc/c8WDJVdeOVWra+u35hd6ZUJkR4W0s/eTxtlId/ DWog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LWzYj+YU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si8501506ejx.323.2020.06.15.05.58.37; Mon, 15 Jun 2020 05:58:59 -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=@gmail.com header.s=20161025 header.b=LWzYj+YU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730120AbgFOM4O (ORCPT + 99 others); Mon, 15 Jun 2020 08:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729977AbgFOM4O (ORCPT ); Mon, 15 Jun 2020 08:56:14 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8103C061A0E; Mon, 15 Jun 2020 05:56:13 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id w16so16779760ejj.5; Mon, 15 Jun 2020 05:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qXYey5+z4XH/ze0CWdNcvFvzyDDniwsSZOKQE4KvrPA=; b=LWzYj+YUZE5h3uCy+V+oKermAdgPdGS6C8qL9LwMjPW6ITfnP0y2Dgs05yw/ayjMJu RgJGJgRKxJtjJsprQaWp+UM3lJME/REUZLhE9zN06FpCC3UFkmHHEJrFrmCe7NeTfb6P 4viYgcN2myPkYCNOsbzttBX+tLoaW9BysLcBm6es9LK4wCQeyy8bmdhxBERMvuPilICH NJANq3gd8DooJJODqZF5xLp8nWmuka+rLmFf2vfjj2VkOSVTvqyB2mUMzkytFygDICaj etrCk9Km4O4ORHSnyhRPAlXYC5wu2pPYjB7Rc/jlmQdZ/xOxJFX2yNYUBlzYXyqSo+oY goBg== 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=qXYey5+z4XH/ze0CWdNcvFvzyDDniwsSZOKQE4KvrPA=; b=CjEsxxm55eC0ZxoYho8VfsBOy74pIXDF49Sc7OwWyZtZQZc++i/R1vaWrtBw+QL5To qEWJZAxwrX6X1iYSOkZfRiw4hN2M+ZjZEPd8o1lVCTUQ4VBP5N/xsjScUxqFuFa+BG5N bNWvVFLsgiTZQvIWGEJj/fDgQ8f2TC4tZ1cjs3wX+C5jF/vw137w0jdKLs2oZLS+OEr2 rYl5Miqy4UGMbNqsPHP0EfWOrCet6rC4e+dL2lzKWuNtyRulCAKynzeDycMaKMyA/3kY kCtS/h5ZAD5/FgGlwcIOAI4EHJdc2kvYDUio1NLCFuewVxxysLkQlVBPSfwBsWBaETCP LlNw== X-Gm-Message-State: AOAM530FhIG2cDYRukDKdZmm/4W47/csOXzHIQjMPdse08Ab8MtNn+BK zzrkoAfdsK6MUAad5v1xiYQXXMewO63+mBzac2E= X-Received: by 2002:a17:906:851:: with SMTP id f17mr24343551ejd.396.1592225772600; Mon, 15 Jun 2020 05:56:12 -0700 (PDT) MIME-Version: 1.0 References: <1592208439-17594-1-git-send-email-krzk@kernel.org> <20200615123052.GO4447@sirena.org.uk> In-Reply-To: <20200615123052.GO4447@sirena.org.uk> From: Vladimir Oltean Date: Mon, 15 Jun 2020 15:56:01 +0300 Message-ID: Subject: Re: [PATCH v2 1/3] spi: spi-fsl-dspi: Fix external abort on interrupt in exit paths To: Mark Brown Cc: Marc Kleine-Budde , Krzysztof Kozlowski , Thomas Gleixner , Vladimir Oltean , linux-spi , lkml , Wolfram Sang , stable@vger.kernel.org, Pengutronix Kernel Team 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 Mon, 15 Jun 2020 at 15:35, Mark Brown wrote: > > > Indeed. The upshot of all this is that the interrupt needs to be freed > not disabled before the clocks are disabled, or some other mechanism > needs to be used to ensure that the interrupt handler won't attempt to > access the hardware when it shouldn't. As Vladimir says there are > serious issues using devm for interrupt handlers (or anything else that > might cause code to be run) due to problems like this. And the down-shot is that whatever is done in dspi_remove (free_irq) also needs to be done in dspi_suspend, but with extra care in dspi_resume not only to request the irq again, but also to flush the module's FIFOs and clear interrupts, because there might have been nasty stuff uncaught during sleep: regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR); So it's pretty messy. -Vladimir