From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752049AbdC0SXo (ORCPT ); Mon, 27 Mar 2017 14:23:44 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:43156 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751306AbdC0SXg (ORCPT ); Mon, 27 Mar 2017 14:23:36 -0400 Date: Mon, 27 Mar 2017 18:49:52 +0100 From: Mark Brown To: Tony Lindgren Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Charles Keepax , Lee Jones , Marcel Partap , Michael Scott Message-ID: <20170327174952.jsfleql654m2h45i@sirena.org.uk> References: <20170322171052.7006-1-tony@atomide.com> <20170322171052.7006-2-tony@atomide.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ua3n4cnu66ce4dek" Content-Disposition: inline In-Reply-To: <20170322171052.7006-2-tony@atomide.com> X-Cookie: No shirt, no shoes, no service. User-Agent: NeoMutt/20161126 (1.7.1) X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH 1/4] regmap: irq: Fix lost interrupts by introducing handle_reread X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ua3n4cnu66ce4dek Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Mar 22, 2017 at 10:10:49AM -0700, Tony Lindgren wrote: > At least Motorola CPCAP PMIC needs it's device interrupts re-read > until there are no more interrupts. Otherwise the PMIC interrupt to > the SoC will eventually stop toggling. This seems to be a bug in the > CPCAP PMIC where it can stop driving the GPIO interrupt to the SoC > with pending CPCAP interrupts. > Let's allow handling issues like this by introducing a flag for > handle_reread and by splitting regmap_irq_thread() into two separate > functions for regmap_read_irq_status() and regmap_irq_handle_pending(). So, I see your use case but the fact is that as Charles observed this is exactly the code used for emulating level triggered IRQs with edge triggered interrupt controllers. This means someone is doubtless going to end up using it for precisely that. This makes me uncomfortable, we do have this open coded into various drivers already but this is more of a core thing and it feels like this should be in genirq rather than here... that said, looking at the code: > + do { > + ret = regmap_read_irq_status(data); > + if (ret) > + goto out_runtime_put; > + > + ret = regmap_irq_handle_pending(data); > + if (ret < 0) > + goto out_runtime_put; > + > + if (!ret) > + break; > + > + handled += ret; > + } while (chip->handle_reread); There's no protection against screaming interrupts here, I'd really like to see that. Also some tracing of the number of times we spin. --ua3n4cnu66ce4dek Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAljZUL8ACgkQJNaLcl1U h9ACagf/QG57ADMyUm2y4peOi1CKUIx+9actz8t7jOMCD1VOh7+Du+cGvfuEi05m l2Kq9XDcbnqZmgHl/4v3AxEMZV2o2XNek3uuWIj1B+QSdDJ5LW2kvwUyim1nLrcd FUTIq6MANpFcGPVt+XxQNbTqR6boGEnnASWXbwd6D8sVtCvSp6lzT1c1knclFZWm BWhqboieprnB+RfBp+A5eR7KUCVb/wCha5Pyf86wVXXDg+mLnpHPZQTeUhpems5R L0s+ZsV8+OyqfcGjsYrRCX2Pq5/DWUEtyLz+DChtjwaf1zPDMh/uMWouCTYva1zA JU6mw/p/QJZIJuekHz0wkO4NCw0GxA== =mrql -----END PGP SIGNATURE----- --ua3n4cnu66ce4dek--