From: Takashi Iwai <tiwai@suse.de>
To: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: alsa-devel@alsa-project.org, Paul Mundt <lethal@linux-sh.org>,
Lee Revell <rlrevell@joe-job.com>,
linux-kernel@vger.kernel.org,
linux-sh <linuxsh-dev@lists.sourceforge.net>
Subject: Re: [linuxsh-dev] [PATCH] Add support for Yamaha AICA sound on SEGA Dreamcast
Date: Thu, 08 Jun 2006 12:35:42 +0200 [thread overview]
Message-ID: <s5hlks82av5.wl%tiwai@suse.de> (raw)
In-Reply-To: <1149704202.5087.6.camel@localhost.localdomain>
At Wed, 07 Jun 2006 19:16:42 +0100,
Adrian McMenamin wrote:
>
> On Wed, 2006-06-07 at 11:51 +0200, Takashi Iwai wrote:
> > At Wed, 07 Jun 2006 00:10:48 +0100,
> > Adrian McMenamin wrote:
> > >
> > > On Tue, 2006-06-06 at 12:25 +0200, Takashi Iwai wrote:
> > >
> > > > Another big concern is that spu_dma_work is initialized/rewritten
> > > > dynamically in spu_begin_dma() and aica_period_elapsed() via
> > > > INIT_WORK() and PREPARE_WOR(). This looks pretty strange and may be
> > > > racy.
> > >
> > > Actually, the two macros INIT_WORK and PREPARE_WORK use the same work
> > > queue but ask it to schedule the execution of two different (if very
> > > similar) functions start_spu_dma() - which does the initial transfer and
> > > more_spu_dma - which tops up the dma transfers.
> > >
> > > So I think I've got that right.
> >
> > What's wrong with using two individual work struct so that you
> > initialize them only once?
> > I wonder it because you already have unused fields work and work2...
> >
> They've gone actually.
>
> I need to initialise them because every call is a discrete processing
> job - ie I send one thing to go, then when a period has elapsed I
> schedule another transfer to run on the kernel thread.
>
> Isn't this the way it is meant to work?
It's uncoventional that a work struct is re-initialized on the fly.
IMO, it's better to introduce a flag indicating the stream is already
running and use a single function/work struct. For example,
static void do_first_event(struct stream *str)
{
...
str->running = 1;
}
static void do_more_event(struct stream *str)
{
...
}
static void work_event(void *data)
{
struct stream *str = data;
if (str->running)
do_more_event(str);
else
do_first_event(str);
}
trigger_start()
{
queue_work(queue, &this_work);
}
interrupt_handler()
{
...
queue_work(queue, &this_work);
...
}
initialization()
{
...
queue = create_workqueue("xxx");
INIT_WORK(&this_work, work_event, str);
...
}
WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: alsa-devel@alsa-project.org, Paul Mundt <lethal@linux-sh.org>,
Lee Revell <rlrevell@joe-job.com>,
linux-kernel@vger.kernel.org,
linux-sh <linuxsh-dev@lists.sourceforge.net>
Subject: Re: [Alsa-devel] [linuxsh-dev] [PATCH] Add support for Yamaha AICA sound on SEGA Dreamcast
Date: Thu, 08 Jun 2006 12:35:42 +0200 [thread overview]
Message-ID: <s5hlks82av5.wl%tiwai@suse.de> (raw)
In-Reply-To: <1149704202.5087.6.camel@localhost.localdomain>
At Wed, 07 Jun 2006 19:16:42 +0100,
Adrian McMenamin wrote:
>
> On Wed, 2006-06-07 at 11:51 +0200, Takashi Iwai wrote:
> > At Wed, 07 Jun 2006 00:10:48 +0100,
> > Adrian McMenamin wrote:
> > >
> > > On Tue, 2006-06-06 at 12:25 +0200, Takashi Iwai wrote:
> > >
> > > > Another big concern is that spu_dma_work is initialized/rewritten
> > > > dynamically in spu_begin_dma() and aica_period_elapsed() via
> > > > INIT_WORK() and PREPARE_WOR(). This looks pretty strange and may be
> > > > racy.
> > >
> > > Actually, the two macros INIT_WORK and PREPARE_WORK use the same work
> > > queue but ask it to schedule the execution of two different (if very
> > > similar) functions start_spu_dma() - which does the initial transfer and
> > > more_spu_dma - which tops up the dma transfers.
> > >
> > > So I think I've got that right.
> >
> > What's wrong with using two individual work struct so that you
> > initialize them only once?
> > I wonder it because you already have unused fields work and work2...
> >
> They've gone actually.
>
> I need to initialise them because every call is a discrete processing
> job - ie I send one thing to go, then when a period has elapsed I
> schedule another transfer to run on the kernel thread.
>
> Isn't this the way it is meant to work?
It's uncoventional that a work struct is re-initialized on the fly.
IMO, it's better to introduce a flag indicating the stream is already
running and use a single function/work struct. For example,
static void do_first_event(struct stream *str)
{
...
str->running = 1;
}
static void do_more_event(struct stream *str)
{
...
}
static void work_event(void *data)
{
struct stream *str = data;
if (str->running)
do_more_event(str);
else
do_first_event(str);
}
trigger_start()
{
queue_work(queue, &this_work);
}
interrupt_handler()
{
...
queue_work(queue, &this_work);
...
}
initialization()
{
...
queue = create_workqueue("xxx");
INIT_WORK(&this_work, work_event, str);
...
}
next prev parent reply other threads:[~2006-06-08 10:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1149201071.9032.13.camel@localhost.localdomain>
2006-06-03 11:39 ` [linuxsh-dev] [PATCH] Add support for Yamaha AICA sound on SEGA Dreamcast Adrian McMenamin
2006-06-03 15:16 ` Lee Revell
2006-06-03 15:16 ` Lee Revell
2006-06-03 16:38 ` Adrian McMenamin
2006-06-03 16:38 ` Adrian McMenamin
2006-06-06 10:25 ` [Alsa-devel] " Takashi Iwai
2006-06-06 23:10 ` Adrian McMenamin
2006-06-06 23:10 ` [linuxsh-dev] [Alsa-devel] " Adrian McMenamin
2006-06-07 9:51 ` [linuxsh-dev] " Takashi Iwai
2006-06-07 9:51 ` [linuxsh-dev] [Alsa-devel] " Takashi Iwai
2006-06-07 18:16 ` [linuxsh-dev] " Adrian McMenamin
2006-06-07 18:16 ` [Alsa-devel] " Adrian McMenamin
2006-06-08 10:35 ` Takashi Iwai [this message]
2006-06-08 10:35 ` Takashi Iwai
2006-06-08 18:16 ` Adrian McMenamin
2006-06-08 18:16 ` [linuxsh-dev] [Alsa-devel] " Adrian McMenamin
2006-06-06 10:25 ` [linuxsh-dev] " Takashi Iwai
2006-06-03 11:39 ` Adrian McMenamin
2006-06-05 9:53 ` Paul Mundt
2006-06-05 9:59 ` Adrian McMenamin
2006-06-05 9:59 ` Adrian McMenamin
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=s5hlks82av5.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=adrian@mcmen.demon.co.uk \
--cc=alsa-devel@alsa-project.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxsh-dev@lists.sourceforge.net \
--cc=rlrevell@joe-job.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.