From: Andrew Morton <akpm@linux-foundation.org>
To: Brent Casavant <bcasavan@sgi.com>
Cc: linux-kernel@vger.kernel.org, mdr@sgi.com, rw@novell.com,
kasievers@novell.com
Subject: Re: [PATCH] ioc4: automatically load sgiioc4 subordinate module
Date: Mon, 8 Dec 2008 14:55:07 -0800 [thread overview]
Message-ID: <20081208145507.8d03834e.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.BSF.1.10.0812051601060.388@pkunk.americas.sgi.com>
On Fri, 5 Dec 2008 16:04:37 -0600 (CST)
Brent Casavant <bcasavan@sgi.com> wrote:
> The main ioc4 driver which manages ownership of the SGI IOC4 PCI device
> does not automatically load any of the ioc4 submodules (the sgiioc4 IDE
> and ioc4_serial serial drivers) during PCI device probing. This causes
> problems when the root device is a DVD-ROM attached to the IOC4 IDE
> interface (e.g. during system installation) as the sgiioc4 module
> will not be loaded and thus the DVD-ROM device will not be available.
>
> Modify ioc4 to always load the sgiioc4 IDE module if the board carrying
> the IOC4 hardware actually implements the IDE interface (not all boards
> bring this functionality off the IOC4 chip).
>
> The use of a work procedure is necessary as request_module() cannot be
> called from the device probe path as it eventually calls out to userspace.
>
This is a fairly common problem, isn't it? Other drivers handle it via
appropriate udev magic and initrd/initramfs setups.
Is there something special about ioc4 which requires that it have this
magical special handling?
> ---
> ioc4.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/misc/ioc4.c b/drivers/misc/ioc4.c
> index 6f76573..36320bd 100644
> --- a/drivers/misc/ioc4.c
> +++ b/drivers/misc/ioc4.c
> @@ -269,6 +269,16 @@ ioc4_variant(struct ioc4_driver_data *idd)
> return IOC4_VARIANT_PCI_RT;
> }
>
> +static void
> +ioc4_load_modules(struct work_struct *work)
> +{
> + /* arg just has to be freed */
> +
> + request_module("sgiioc4");
> +
> + kfree(work);
> +}
> +
> /* Adds a new instance of an IOC4 card */
> static int
> ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
> @@ -378,6 +388,22 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
> }
> mutex_unlock(&ioc4_mutex);
>
> + if (idd->idd_variant != IOC4_VARIANT_PCI_RT) {
> + struct work_struct *work;
> + work = kzalloc(sizeof(struct work_struct), GFP_KERNEL);
> + if (!work) {
> + printk(KERN_WARNING
> + "%s: IOC4 unable to allocate memory for "
> + "load of sub-modules.\n",
> + __FUNCTION__);
> + }
> + else {
> + printk(KERN_INFO "IOC4 loading ioc4 submodule\n");
> + INIT_WORK(work, ioc4_load_modules);
> + schedule_work(work);
> + }
> + }
> +
> return 0;
>
ioc4 can be compiled as a module. So if someone does an `rmmod ioc4' after
the schedule_work() and before or during the execution of the work
function, dead machine.
This race is fixable by adding a flush_scheduled_work() into
ioc4_exit(), I expect.
next prev parent reply other threads:[~2008-12-08 22:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-05 22:04 [PATCH] ioc4: automatically load sgiioc4 subordinate module Brent Casavant
2008-12-08 22:55 ` Andrew Morton [this message]
2008-12-08 23:09 ` Brent Casavant
2008-12-08 23:36 ` Kay Sievers
2008-12-08 23:41 ` Andrew Morton
2008-12-10 21:00 ` Brent Casavant
2008-12-09 2:01 ` Brent Casavant
2008-12-09 2:32 ` Andrew Morton
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=20081208145507.8d03834e.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bcasavan@sgi.com \
--cc=kasievers@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mdr@sgi.com \
--cc=rw@novell.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.