linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Shubhrajyoti Datta <omaplinuxkernel@gmail.com>
Cc: "Strashko, Grygorii" <grygorii.strashko@ti.com>,
	Kalle Jokiniemi <kalle.jokiniemi@jollamobile.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"w.sang@pengutronix.de" <w.sang@pengutronix.de>,
	"ben-linux@fluff.org" <ben-linux@fluff.org>,
	"tony@atomide.com" <tony@atomide.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"Datta, Shubhrajyoti" <shubhrajyoti@ti.com>,
	"Kankroliwala, Huzefa" <huzefank@ti.com>
Subject: Re: [PATCH v3] ARM: OMAP: i2c: fix interrupt flood during resume
Date: Fri, 12 Oct 2012 12:04:36 -0700	[thread overview]
Message-ID: <87txtzy0jf.fsf@deeprootsystems.com> (raw)
In-Reply-To: <CAM=Q2csQ7dVWUi2vrRMCQ653t_GxtXqH2yGMjY9YAkvA+_i9WA@mail.gmail.com> (Shubhrajyoti Datta's message of "Fri, 12 Oct 2012 23:41:23 +0530")

Shubhrajyoti Datta <omaplinuxkernel@gmail.com> writes:

> On Fri, Oct 12, 2012 at 10:13 PM, Kevin Hilman
> <khilman@deeprootsystems.com> wrote:
>> "Strashko, Grygorii" <grygorii.strashko@ti.com> writes:
>>
>>> Hi Kevin,
>>>
>>> yep, [1] is the same fix - thanks.
>>
>>> Hi Kalle,
>>>
>>> i've applied these changes and PM runtime fix on top of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git (omap2plus_defconfig)
>>> Could you check it with your use case, pls? (just to be sure that idea is right)
>>
>> I think the ideas is right, but [1] introduces more potential problems
>> since it disables the IRQ at the INTC well before being disabled at the
>> device.
> I fail to see this point. Current driver supports master mode only.
> So unless there is a msg queued by the core. May be no interrupts should fire.
>
> what I mean
>
> msg -> conf -> intr -> completion/error  -> autosuspend.
>
>>  With runtime PM autosuspend timeouts, that means any IRQs
>> firing during the autosuspend delay will be lost, which basically
>> nullifies the use of autosuspend.
>
> so I do not expect any interrupts between completion/error -> autosuspend.

Runtime PM is designed for concurrent users (hence the usecounting.)
The I2C driver may not fully support this, since there is a single bus
to share, but the usage of runtime PM currently allows multiple users to
do runtime PM get/put (though in this driver they will block in the
wait_for_bb.)

So the fundamental problem in doing the enable/disable IRQ in the xfer
function, and not the runtime PM callbacks is that you're ignoring the
runtime PM usecount.  You're assuming that the 'get' is *always*
incrementing the usecount from zero to 1, and the 'put' is *always* a
transition from 1 to zero.  This may be the case in current usage and
tests, but does not have to be the case.

Even if that never happens in practice, it can in theory, and to me
leads to confusing code.  It simply doesn't make sense in terms of
readability to disable the IRQ at the INTC in xfer, and disable IRQs at
the device level in the runtime PM callback.

To put it more simply: anything that needs to be done when the I2C is
about to be idled/enabled should be done in the runtime PM callbacks.

Please have a look at the patch I just sent[1].  In addition to making
it more readable (IMO), it elminates the need for an extra disable_irq()
in probe.

Kevin

[1] http://marc.info/?l=linux-omap&m=135006723121147&w=2

  reply	other threads:[~2012-10-12 19:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 12:18 [PATCH v3] ARM: OMAP: i2c: fix interrupt flood during resume Kalle Jokiniemi
     [not found] ` <1349871480-25182-1-git-send-email-kalle.jokiniemi-4y2FMlU5MS8onNqTyK5kxQ@public.gmane.org>
2012-10-11  7:59   ` Shubhrajyoti Datta
2012-10-11 21:08   ` Kevin Hilman
     [not found]     ` <87ipag90om.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2012-10-12 10:18       ` Strashko, Grygorii
2012-10-12 11:33         ` Shubhrajyoti
     [not found]           ` <5077FFEC.5040407-l0cyMroinI0@public.gmane.org>
2012-10-12 12:55             ` Kankroliwala, Huzefa
2012-10-12 13:28         ` Kalle Jokiniemi
     [not found]         ` <902E09E6452B0E43903E4F2D568737AB2C87B0-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-10-12 14:17           ` Kevin Hilman
2012-10-12 14:34         ` Kevin Hilman
     [not found]           ` <87d30n7o9q.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2012-10-12 14:46             ` Strashko, Grygorii
2012-10-12 16:43               ` Kevin Hilman
     [not found]                 ` <87r4p363ps.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2012-10-12 18:11                   ` Shubhrajyoti Datta
2012-10-12 19:04                     ` Kevin Hilman [this message]
     [not found]                       ` <87txtzy0jf.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2012-10-12 19:15                         ` shubhro
     [not found]               ` <902E09E6452B0E43903E4F2D568737AB2C8C9F-bXo5r3zvlxeIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-10-15  6:21                 ` Kalle Jokiniemi
2012-10-15  9:16                   ` Kalle Jokiniemi
2012-10-15 10:11                     ` Shubhrajyoti Datta
     [not found]                       ` <CAM=Q2cuJ-0VSgkBme_Cg8YD2cBG5NZcO6aBeTsPZ_PQGMwJ=bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-15 14:10                         ` Kalle Jokiniemi
2012-10-17 16:02       ` Felipe Balbi
     [not found]         ` <20121017160200.GA6567-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2012-10-18  6:51           ` Kalle Jokiniemi
2012-10-18  7:11             ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txtzy0jf.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=ben-linux@fluff.org \
    --cc=grygorii.strashko@ti.com \
    --cc=huzefank@ti.com \
    --cc=kalle.jokiniemi@jollamobile.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=omaplinuxkernel@gmail.com \
    --cc=shubhrajyoti@ti.com \
    --cc=tony@atomide.com \
    --cc=w.sang@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).