diff mbox

[3.8.y.z,extended,stable] Patch "ALSA: seq-oss: Initialize MIDI clients asynchronously" has been added to staging queue

Message ID 1374780540-18871-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa July 25, 2013, 7:29 p.m. UTC
This is a note to let you know that I have just added a patch titled

    ALSA: seq-oss: Initialize MIDI clients asynchronously

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue

This patch is scheduled to be released in version 3.8.13.6.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.8.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

From 2e602e4007d29e182ac090df7d0c9fb72018c35f Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 16 Jul 2013 12:17:49 +0200
Subject: ALSA: seq-oss: Initialize MIDI clients asynchronously

commit 256ca9c3ad5013ff8a8f165e5a82fab437628c8e upstream.

We've got bug reports that the module loading stuck on Debian system
with 3.10 kernel.  The debugging session revealed that the initial
registration of OSS sequencer clients stuck at module loading time,
which involves again with request_module() at the init phase.  This is
triggered only by special --install stuff Debian is using, but it's
still not good to have such loops.

As a workaround, call the registration part asynchronously.  This is a
better approach irrespective of the hang fix, in anyway.

Reported-and-tested-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/core/seq/oss/seq_oss_init.c | 16 +++++++++++++---
 sound/core/seq/oss/seq_oss_midi.c |  2 +-
 2 files changed, 14 insertions(+), 4 deletions(-)

--
1.8.1.2

Comments

Takashi Iwai July 29, 2013, 2:21 p.m. UTC | #1
At Thu, 25 Jul 2013 12:29:00 -0700,
Kamal Mostafa wrote:
> 
> This is a note to let you know that I have just added a patch titled
> 
>     ALSA: seq-oss: Initialize MIDI clients asynchronously
> 
> to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
> which can be found at:
> 
>  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue
> 
> This patch is scheduled to be released in version 3.8.13.6.
> 
> If you, or anyone else, feels it should not be added to this tree, please 
> reply to this email.

This patch isn't needed for 3.8.x unless someone actually hits the
problem.  The problem was reported first for 3.10 kernel.


Takashi

> 
> For more information about the 3.8.y.z tree, see
> https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
> 
> Thanks.
> -Kamal
> 
> ------
> 
> >From 2e602e4007d29e182ac090df7d0c9fb72018c35f Mon Sep 17 00:00:00 2001
> From: Takashi Iwai <tiwai@suse.de>
> Date: Tue, 16 Jul 2013 12:17:49 +0200
> Subject: ALSA: seq-oss: Initialize MIDI clients asynchronously
> 
> commit 256ca9c3ad5013ff8a8f165e5a82fab437628c8e upstream.
> 
> We've got bug reports that the module loading stuck on Debian system
> with 3.10 kernel.  The debugging session revealed that the initial
> registration of OSS sequencer clients stuck at module loading time,
> which involves again with request_module() at the init phase.  This is
> triggered only by special --install stuff Debian is using, but it's
> still not good to have such loops.
> 
> As a workaround, call the registration part asynchronously.  This is a
> better approach irrespective of the hang fix, in anyway.
> 
> Reported-and-tested-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  sound/core/seq/oss/seq_oss_init.c | 16 +++++++++++++---
>  sound/core/seq/oss/seq_oss_midi.c |  2 +-
>  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
> index e3cb46f..b3f39b5 100644
> --- a/sound/core/seq/oss/seq_oss_init.c
> +++ b/sound/core/seq/oss/seq_oss_init.c
> @@ -31,6 +31,7 @@
>  #include <linux/export.h>
>  #include <linux/moduleparam.h>
>  #include <linux/slab.h>
> +#include <linux/workqueue.h>
> 
>  /*
>   * common variables
> @@ -60,6 +61,14 @@ static void free_devinfo(void *private);
>  #define call_ctl(type,rec) snd_seq_kernel_client_ctl(system_client, type, rec)
> 
> 
> +/* call snd_seq_oss_midi_lookup_ports() asynchronously */
> +static void async_call_lookup_ports(struct work_struct *work)
> +{
> +	snd_seq_oss_midi_lookup_ports(system_client);
> +}
> +
> +static DECLARE_WORK(async_lookup_work, async_call_lookup_ports);
> +
>  /*
>   * create sequencer client for OSS sequencer
>   */
> @@ -85,9 +94,6 @@ snd_seq_oss_create_client(void)
>  	system_client = rc;
>  	debug_printk(("new client = %d\n", rc));
> 
> -	/* look up midi devices */
> -	snd_seq_oss_midi_lookup_ports(system_client);
> -
>  	/* create annoucement receiver port */
>  	memset(port, 0, sizeof(*port));
>  	strcpy(port->name, "Receiver");
> @@ -115,6 +121,9 @@ snd_seq_oss_create_client(void)
>  	}
>  	rc = 0;
> 
> +	/* look up midi devices */
> +	schedule_work(&async_lookup_work);
> +
>   __error:
>  	kfree(port);
>  	return rc;
> @@ -160,6 +169,7 @@ receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic
>  int
>  snd_seq_oss_delete_client(void)
>  {
> +	cancel_work_sync(&async_lookup_work);
>  	if (system_client >= 0)
>  		snd_seq_delete_kernel_client(system_client);
> 
> diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
> index 677dc84..862d8489 100644
> --- a/sound/core/seq/oss/seq_oss_midi.c
> +++ b/sound/core/seq/oss/seq_oss_midi.c
> @@ -72,7 +72,7 @@ static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
>   * look up the existing ports
>   * this looks a very exhausting job.
>   */
> -int __init
> +int
>  snd_seq_oss_midi_lookup_ports(int client)
>  {
>  	struct snd_seq_client_info *clinfo;
> --
> 1.8.1.2
>
Kamal Mostafa July 29, 2013, 5:32 p.m. UTC | #2
On Mon, 2013-07-29 at 16:21 +0200, Takashi Iwai wrote:
> At Thu, 25 Jul 2013 12:29:00 -0700,
> Kamal Mostafa wrote:
> > 
> > This is a note to let you know that I have just added a patch titled
> > 
> >     ALSA: seq-oss: Initialize MIDI clients asynchronously
> > 
> > to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
> > which can be found at:
> > 
> >  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue
> > 
> > This patch is scheduled to be released in version 3.8.13.6.
> > 
> > If you, or anyone else, feels it should not be added to this tree, please 
> > reply to this email.
> 
> This patch isn't needed for 3.8.x unless someone actually hits the
> problem.  The problem was reported first for 3.10 kernel.


Hi Takashi-

This one looks to me like a good fix for 3.8 anyway -- is there a reason
why it specifically shouldn't go into 3.8.y-stable?

Per your request, I have dropped it from the linux-3.8.y-queue, but I'd
be happy to re-apply it if you change your mind.  :-)

Thanks,

 -Kamal



> > ------
> > 
> > >From 2e602e4007d29e182ac090df7d0c9fb72018c35f Mon Sep 17 00:00:00 2001
> > From: Takashi Iwai <tiwai@suse.de>
> > Date: Tue, 16 Jul 2013 12:17:49 +0200
> > Subject: ALSA: seq-oss: Initialize MIDI clients asynchronously
> > 
> > commit 256ca9c3ad5013ff8a8f165e5a82fab437628c8e upstream.
> > 
> > We've got bug reports that the module loading stuck on Debian system
> > with 3.10 kernel.  The debugging session revealed that the initial
> > registration of OSS sequencer clients stuck at module loading time,
> > which involves again with request_module() at the init phase.  This is
> > triggered only by special --install stuff Debian is using, but it's
> > still not good to have such loops.
> > 
> > As a workaround, call the registration part asynchronously.  This is a
> > better approach irrespective of the hang fix, in anyway.
> > 
> > Reported-and-tested-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > ---
> >  sound/core/seq/oss/seq_oss_init.c | 16 +++++++++++++---
> >  sound/core/seq/oss/seq_oss_midi.c |  2 +-
> >  2 files changed, 14 insertions(+), 4 deletions(-)
> > 
> > diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
> > index e3cb46f..b3f39b5 100644
> > --- a/sound/core/seq/oss/seq_oss_init.c
> > +++ b/sound/core/seq/oss/seq_oss_init.c
> > @@ -31,6 +31,7 @@
> >  #include <linux/export.h>
> >  #include <linux/moduleparam.h>
> >  #include <linux/slab.h>
> > +#include <linux/workqueue.h>
> > 
> >  /*
> >   * common variables
> > @@ -60,6 +61,14 @@ static void free_devinfo(void *private);
> >  #define call_ctl(type,rec) snd_seq_kernel_client_ctl(system_client, type, rec)
> > 
> > 
> > +/* call snd_seq_oss_midi_lookup_ports() asynchronously */
> > +static void async_call_lookup_ports(struct work_struct *work)
> > +{
> > +	snd_seq_oss_midi_lookup_ports(system_client);
> > +}
> > +
> > +static DECLARE_WORK(async_lookup_work, async_call_lookup_ports);
> > +
> >  /*
> >   * create sequencer client for OSS sequencer
> >   */
> > @@ -85,9 +94,6 @@ snd_seq_oss_create_client(void)
> >  	system_client = rc;
> >  	debug_printk(("new client = %d\n", rc));
> > 
> > -	/* look up midi devices */
> > -	snd_seq_oss_midi_lookup_ports(system_client);
> > -
> >  	/* create annoucement receiver port */
> >  	memset(port, 0, sizeof(*port));
> >  	strcpy(port->name, "Receiver");
> > @@ -115,6 +121,9 @@ snd_seq_oss_create_client(void)
> >  	}
> >  	rc = 0;
> > 
> > +	/* look up midi devices */
> > +	schedule_work(&async_lookup_work);
> > +
> >   __error:
> >  	kfree(port);
> >  	return rc;
> > @@ -160,6 +169,7 @@ receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic
> >  int
> >  snd_seq_oss_delete_client(void)
> >  {
> > +	cancel_work_sync(&async_lookup_work);
> >  	if (system_client >= 0)
> >  		snd_seq_delete_kernel_client(system_client);
> > 
> > diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
> > index 677dc84..862d8489 100644
> > --- a/sound/core/seq/oss/seq_oss_midi.c
> > +++ b/sound/core/seq/oss/seq_oss_midi.c
> > @@ -72,7 +72,7 @@ static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
> >   * look up the existing ports
> >   * this looks a very exhausting job.
> >   */
> > -int __init
> > +int
> >  snd_seq_oss_midi_lookup_ports(int client)
> >  {
> >  	struct snd_seq_client_info *clinfo;
> > --
> > 1.8.1.2
> > 
>
Takashi Iwai July 30, 2013, 5:49 a.m. UTC | #3
At Mon, 29 Jul 2013 10:32:01 -0700,
Kamal Mostafa wrote:
> 
> On Mon, 2013-07-29 at 16:21 +0200, Takashi Iwai wrote:
> > At Thu, 25 Jul 2013 12:29:00 -0700,
> > Kamal Mostafa wrote:
> > > 
> > > This is a note to let you know that I have just added a patch titled
> > > 
> > >     ALSA: seq-oss: Initialize MIDI clients asynchronously
> > > 
> > > to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
> > > which can be found at:
> > > 
> > >  http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.8.y-queue
> > > 
> > > This patch is scheduled to be released in version 3.8.13.6.
> > > 
> > > If you, or anyone else, feels it should not be added to this tree, please 
> > > reply to this email.
> > 
> > This patch isn't needed for 3.8.x unless someone actually hits the
> > problem.  The problem was reported first for 3.10 kernel.
> 
> 
> Hi Takashi-
> 
> This one looks to me like a good fix for 3.8 anyway -- is there a reason
> why it specifically shouldn't go into 3.8.y-stable?

Because there is no problem to fix in 3.8 kernel :)


Takashi

> Per your request, I have dropped it from the linux-3.8.y-queue, but I'd
> be happy to re-apply it if you change your mind.  :-)
> 
> Thanks,
> 
>  -Kamal
> 
> 
> 
> > > ------
> > > 
> > > >From 2e602e4007d29e182ac090df7d0c9fb72018c35f Mon Sep 17 00:00:00 2001
> > > From: Takashi Iwai <tiwai@suse.de>
> > > Date: Tue, 16 Jul 2013 12:17:49 +0200
> > > Subject: ALSA: seq-oss: Initialize MIDI clients asynchronously
> > > 
> > > commit 256ca9c3ad5013ff8a8f165e5a82fab437628c8e upstream.
> > > 
> > > We've got bug reports that the module loading stuck on Debian system
> > > with 3.10 kernel.  The debugging session revealed that the initial
> > > registration of OSS sequencer clients stuck at module loading time,
> > > which involves again with request_module() at the init phase.  This is
> > > triggered only by special --install stuff Debian is using, but it's
> > > still not good to have such loops.
> > > 
> > > As a workaround, call the registration part asynchronously.  This is a
> > > better approach irrespective of the hang fix, in anyway.
> > > 
> > > Reported-and-tested-by: Philipp Matthias Hahn <pmhahn@pmhahn.de>
> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > > ---
> > >  sound/core/seq/oss/seq_oss_init.c | 16 +++++++++++++---
> > >  sound/core/seq/oss/seq_oss_midi.c |  2 +-
> > >  2 files changed, 14 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
> > > index e3cb46f..b3f39b5 100644
> > > --- a/sound/core/seq/oss/seq_oss_init.c
> > > +++ b/sound/core/seq/oss/seq_oss_init.c
> > > @@ -31,6 +31,7 @@
> > >  #include <linux/export.h>
> > >  #include <linux/moduleparam.h>
> > >  #include <linux/slab.h>
> > > +#include <linux/workqueue.h>
> > > 
> > >  /*
> > >   * common variables
> > > @@ -60,6 +61,14 @@ static void free_devinfo(void *private);
> > >  #define call_ctl(type,rec) snd_seq_kernel_client_ctl(system_client, type, rec)
> > > 
> > > 
> > > +/* call snd_seq_oss_midi_lookup_ports() asynchronously */
> > > +static void async_call_lookup_ports(struct work_struct *work)
> > > +{
> > > +	snd_seq_oss_midi_lookup_ports(system_client);
> > > +}
> > > +
> > > +static DECLARE_WORK(async_lookup_work, async_call_lookup_ports);
> > > +
> > >  /*
> > >   * create sequencer client for OSS sequencer
> > >   */
> > > @@ -85,9 +94,6 @@ snd_seq_oss_create_client(void)
> > >  	system_client = rc;
> > >  	debug_printk(("new client = %d\n", rc));
> > > 
> > > -	/* look up midi devices */
> > > -	snd_seq_oss_midi_lookup_ports(system_client);
> > > -
> > >  	/* create annoucement receiver port */
> > >  	memset(port, 0, sizeof(*port));
> > >  	strcpy(port->name, "Receiver");
> > > @@ -115,6 +121,9 @@ snd_seq_oss_create_client(void)
> > >  	}
> > >  	rc = 0;
> > > 
> > > +	/* look up midi devices */
> > > +	schedule_work(&async_lookup_work);
> > > +
> > >   __error:
> > >  	kfree(port);
> > >  	return rc;
> > > @@ -160,6 +169,7 @@ receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic
> > >  int
> > >  snd_seq_oss_delete_client(void)
> > >  {
> > > +	cancel_work_sync(&async_lookup_work);
> > >  	if (system_client >= 0)
> > >  		snd_seq_delete_kernel_client(system_client);
> > > 
> > > diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
> > > index 677dc84..862d8489 100644
> > > --- a/sound/core/seq/oss/seq_oss_midi.c
> > > +++ b/sound/core/seq/oss/seq_oss_midi.c
> > > @@ -72,7 +72,7 @@ static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
> > >   * look up the existing ports
> > >   * this looks a very exhausting job.
> > >   */
> > > -int __init
> > > +int
> > >  snd_seq_oss_midi_lookup_ports(int client)
> > >  {
> > >  	struct snd_seq_client_info *clinfo;
> > > --
> > > 1.8.1.2
> > > 
> > 
>
diff mbox

Patch

diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index e3cb46f..b3f39b5 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -31,6 +31,7 @@ 
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 #include <linux/slab.h>
+#include <linux/workqueue.h>

 /*
  * common variables
@@ -60,6 +61,14 @@  static void free_devinfo(void *private);
 #define call_ctl(type,rec) snd_seq_kernel_client_ctl(system_client, type, rec)


+/* call snd_seq_oss_midi_lookup_ports() asynchronously */
+static void async_call_lookup_ports(struct work_struct *work)
+{
+	snd_seq_oss_midi_lookup_ports(system_client);
+}
+
+static DECLARE_WORK(async_lookup_work, async_call_lookup_ports);
+
 /*
  * create sequencer client for OSS sequencer
  */
@@ -85,9 +94,6 @@  snd_seq_oss_create_client(void)
 	system_client = rc;
 	debug_printk(("new client = %d\n", rc));

-	/* look up midi devices */
-	snd_seq_oss_midi_lookup_ports(system_client);
-
 	/* create annoucement receiver port */
 	memset(port, 0, sizeof(*port));
 	strcpy(port->name, "Receiver");
@@ -115,6 +121,9 @@  snd_seq_oss_create_client(void)
 	}
 	rc = 0;

+	/* look up midi devices */
+	schedule_work(&async_lookup_work);
+
  __error:
 	kfree(port);
 	return rc;
@@ -160,6 +169,7 @@  receive_announce(struct snd_seq_event *ev, int direct, void *private, int atomic
 int
 snd_seq_oss_delete_client(void)
 {
+	cancel_work_sync(&async_lookup_work);
 	if (system_client >= 0)
 		snd_seq_delete_kernel_client(system_client);

diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index 677dc84..862d8489 100644
--- a/sound/core/seq/oss/seq_oss_midi.c
+++ b/sound/core/seq/oss/seq_oss_midi.c
@@ -72,7 +72,7 @@  static int send_midi_event(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
  * look up the existing ports
  * this looks a very exhausting job.
  */
-int __init
+int
 snd_seq_oss_midi_lookup_ports(int client)
 {
 	struct snd_seq_client_info *clinfo;