All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javi Merino <javi.merino@arm.com>
To: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Boojin Kim <boojin.kim@samsung.com>,
	"vinod.koul@intel.com" <vinod.koul@intel.com>,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	Thomas Abraham <thomas.abraham@linaro.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] ARM: pl330: Fix a race condition
Date: Sun, 11 Dec 2011 17:42:41 +0000	[thread overview]
Message-ID: <4EE4EB91.6020508@arm.com> (raw)
In-Reply-To: <CAJe_ZhcF7nMvnWxfpSROtq=8SYqG1o1TyfWty79eGM0oqntNsg@mail.gmail.com>

On 11/12/11 17:10, Jassi Brar wrote:
> On 11 December 2011 20:39, Javi Merino <javi.merino@arm.com> wrote:
>>>>
>>>> What about properly tracking what we have sent to the DMA?  Something
>>>> like the following (warning *ugly* and untested code ahead, may eat your
>>>> kitten):
>>>>
>>> Yeah, this is like I said 'marker' method. Though we can clean it up a bit.
>>> 1) Pack req_running and lstenq together. Make lsteng return invalid value
>>> should there be no buff programmed, otherwise 0 or 1.
>>
>> This can lead to starvation.  If lstenq is -1 when the DMA hasn't been
>> programmed yet, in _trigger() you don't know which buffer is the
>> "oldest", so you may end up always starting the new buffer and
>> forgetting about the other one.  lstenq as it is right now prevents that.
>>
> Sorry I don't understand. If lstenq is -1 that means there's no req programmed
> so trigger need not do anything. I didn't say we don't need to do anything else.

Currently lstenq tracks the last request that pl330_submit_req() has
enqueued.  I think we should add a req_running (or any other name) that
tracks what _trigger() has sent to the DMA.  If we pack them together we
lose some information and I don't see a way of packing them safely.

> Though it's just an idea I haven't implemented and it may not work out.

I was trying to implement it and got stuck in _trigger() thinking "ok,
so which buffer am I supposed to trigger now..."

> Just please give it a try if you can. Thanks.

I have a patch that seems to be working.  Let me test it a little bit
more and I'll send it to the list.

Cheers,
Javi

WARNING: multiple messages have this Message-ID (diff)
From: javi.merino@arm.com (Javi Merino)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: pl330: Fix a race condition
Date: Sun, 11 Dec 2011 17:42:41 +0000	[thread overview]
Message-ID: <4EE4EB91.6020508@arm.com> (raw)
In-Reply-To: <CAJe_ZhcF7nMvnWxfpSROtq=8SYqG1o1TyfWty79eGM0oqntNsg@mail.gmail.com>

On 11/12/11 17:10, Jassi Brar wrote:
> On 11 December 2011 20:39, Javi Merino <javi.merino@arm.com> wrote:
>>>>
>>>> What about properly tracking what we have sent to the DMA?  Something
>>>> like the following (warning *ugly* and untested code ahead, may eat your
>>>> kitten):
>>>>
>>> Yeah, this is like I said 'marker' method. Though we can clean it up a bit.
>>> 1) Pack req_running and lstenq together. Make lsteng return invalid value
>>> should there be no buff programmed, otherwise 0 or 1.
>>
>> This can lead to starvation.  If lstenq is -1 when the DMA hasn't been
>> programmed yet, in _trigger() you don't know which buffer is the
>> "oldest", so you may end up always starting the new buffer and
>> forgetting about the other one.  lstenq as it is right now prevents that.
>>
> Sorry I don't understand. If lstenq is -1 that means there's no req programmed
> so trigger need not do anything. I didn't say we don't need to do anything else.

Currently lstenq tracks the last request that pl330_submit_req() has
enqueued.  I think we should add a req_running (or any other name) that
tracks what _trigger() has sent to the DMA.  If we pack them together we
lose some information and I don't see a way of packing them safely.

> Though it's just an idea I haven't implemented and it may not work out.

I was trying to implement it and got stuck in _trigger() thinking "ok,
so which buffer am I supposed to trigger now..."

> Just please give it a try if you can. Thanks.

I have a patch that seems to be working.  Let me test it a little bit
more and I'll send it to the list.

Cheers,
Javi

  reply	other threads:[~2011-12-11 17:42 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 17:11 [PATCH] ARM: pl330: Fix a race condition Javi Merino
2011-09-19 18:07 ` Jassi Brar
2011-09-20 13:36   ` Javi Merino
2011-10-05 12:57     ` Javi Merino
2011-10-06  9:10       ` [PATCH v2] " Javi Merino
2011-11-05 19:05         ` Thomas Abraham
2011-11-05 19:05           ` Thomas Abraham
2011-11-07 10:48           ` Javi Merino
2011-11-07 10:48             ` Javi Merino
2011-11-07 11:03             ` Thomas Abraham
2011-11-07 11:03               ` Thomas Abraham
2011-11-28  8:23             ` Boojin Kim
2011-11-28  8:23               ` Boojin Kim
2011-11-28 16:36               ` Javi Merino
2011-11-28 16:36                 ` Javi Merino
2011-11-29  3:41                 ` Boojin Kim
2011-11-29  3:41                   ` Boojin Kim
2011-11-29  9:53                   ` Javi Merino
2011-11-29  9:53                     ` Javi Merino
2011-11-29 10:37                     ` Jassi Brar
2011-11-29 10:37                       ` Jassi Brar
2011-12-07  7:52                       ` Kukjin Kim
2011-12-07  7:52                         ` Kukjin Kim
2011-12-07 10:01                         ` Javi Merino
2011-12-07 10:01                           ` Javi Merino
2011-12-07 20:54                           ` Javi Merino
2011-12-07 20:54                             ` Javi Merino
2011-12-09 11:58                             ` Javi Merino
2011-12-09 11:58                               ` Javi Merino
2011-12-09 13:04                               ` Jassi Brar
2011-12-09 13:04                                 ` Jassi Brar
2011-12-09 13:41                                 ` Javi Merino
2011-12-09 13:41                                   ` Javi Merino
2011-12-09 14:15                                   ` Jassi Brar
2011-12-09 14:15                                     ` Jassi Brar
2011-12-09 14:52                                     ` Javi Merino
2011-12-09 14:52                                       ` Javi Merino
2011-12-09 16:50                                       ` Jassi Brar
2011-12-09 16:50                                         ` Jassi Brar
2011-12-09 19:50                                         ` Javi Merino
2011-12-09 19:50                                           ` Javi Merino
2011-12-11 10:51                                           ` Jassi Brar
2011-12-11 10:51                                             ` Jassi Brar
2011-12-11 15:09                                             ` Javi Merino
2011-12-11 15:09                                               ` Javi Merino
2011-12-11 17:10                                               ` Jassi Brar
2011-12-11 17:10                                                 ` Jassi Brar
2011-12-11 17:42                                                 ` Javi Merino [this message]
2011-12-11 17:42                                                   ` Javi Merino
2011-12-11 19:27                                                   ` [PATCH] ARM: PL330: Fix driver freeze Javi Merino
2011-12-11 19:27                                                     ` Javi Merino
2011-12-15 17:48                                                     ` Javi Merino
2011-12-15 17:48                                                       ` Javi Merino
2011-12-16  9:01                                                       ` Tushar Behera
2011-12-16  9:01                                                         ` Tushar Behera
2011-12-16  6:27                                                     ` Jassi Brar
2011-12-16  6:27                                                       ` Jassi Brar

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=4EE4EB91.6020508@arm.com \
    --to=javi.merino@arm.com \
    --cc=boojin.kim@samsung.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=thomas.abraham@linaro.org \
    --cc=vinod.koul@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.