* [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
@ 2005-02-07 18:27 Matt Domsch
2005-02-07 18:29 ` Matt Domsch
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Matt Domsch @ 2005-02-07 18:27 UTC (permalink / raw)
To: linux-scsi, linux-hotplug-devel
Below is a patch to add some hotplug infrastructure to the Linux SCSI
subsystem.
New files:
include/scsi/scsi_hotplug.h
drivers/scsi/scsi_hotplug.c
implements a new exported function:
extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int channel,
unsigned int id, unsigned int lun, enum scsi_topology_action action);
which invokes kobject_hotplug() on a temporary "scsi_topology"
device. This device represents a target that exists on a topology
(i.e. was just inserted into a hot plug enclosure, or was just created
by a RAID controller management application) but is not yet hooked
into the kernel.
Modified files:
drivers/scsi/Kconfig
drivers/scsi/Makefile
drivers/scsi/megaraid/megaraid_mbox.c
(will follow in a separate patch)
is the user of this new function.
In addition, two more infrastructure pieces are necessary:
udev-050-scsi_topology.patch - adds the subsystem name "scsi_topology"
to the list of devices *not* to wait for the creation of files in
sysfs for - scsi_topology devices aren't to be registered in sysfs.
/etc/hotplug/scsi_topology.agent
handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
The flow is as follows:
# echo "2" > /sys/class/scsi_host/host2/logical_drive_created
(to be done by a management application that knows it just created
logical drive #2 on the controller)
megaraid_mbox.c sysfs method converts logical drive number to HCTL
value, calls scsi_topology_hctl_action().
scsi_topology_hctl_action() invokes kobject_hotplug() with a
scsi_topology subsystem device.
kobject_hotplug() calls /sbin/hotplug or /sbin/udevsend (more likely
the latter), which invokes /etc/hotplug/scsi_topology.agent with the
ACTION={add,remove}.
scsi_topology.agent invokes /sys/class/scsi_host/hostX/scan or
/sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
From this point, we're back into known territory, with the device
being made known, or deleted from, the kernel's view.
Thoughts?
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
=== drivers/scsi/Kconfig 1.95 vs edited ==--- 1.95/drivers/scsi/Kconfig 2005-01-28 11:14:29 -06:00
+++ edited/drivers/scsi/Kconfig 2005-02-05 13:58:45 -06:00
@@ -185,6 +185,16 @@
there should be no noticeable performance impact as long as you have
logging turned off.
+config SCSI_HOTPLUG
+ bool "Hot Plug SCSI devices"
+ depends on SCSI && EXPERIMENTAL
+ default y
+ help
+ If your driver or management applications know about
+ device hot plugging (insertion/removal of physical disks in
+ a topology, or creation/deletion of logical disks on a RAID
+ controller), say Y here. Otherwise, say N.
+
menu "SCSI Transport Attributes"
depends on SCSI
=== drivers/scsi/Makefile 1.72 vs edited ==--- 1.72/drivers/scsi/Makefile 2004-11-20 14:26:17 -06:00
+++ edited/drivers/scsi/Makefile 2005-02-05 13:58:15 -06:00
@@ -147,6 +147,7 @@
scsi_devinfo.o
scsi_mod-$(CONFIG_SYSCTL) += scsi_sysctl.o
scsi_mod-$(CONFIG_SCSI_PROC_FS) += scsi_proc.o
+scsi_mod-$(CONFIG_SCSI_HOTPLUG) += scsi_hotplug.o
sd_mod-objs := sd.o
sr_mod-objs := sr.o sr_ioctl.o sr_vendor.o
--- /dev/null Thu Apr 11 09:25:15 2002
+++ include/scsi/scsi_hotplug.h Sun Feb 6 23:29:51 2005
@@ -0,0 +1,41 @@
+/*
+ * SCSI Hotplug
+ *
+ * Copyright (c) 2005 Dell, Inc <Matt_Domsch@dell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef _SCSI_SCSI_HOTPLUG_H
+#define _SCSI_SCSI_HOTPLUG_H
+
+#include <linux/config.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_device.h>
+
+enum scsi_topology_action {
+ SCSI_TOPOLOGY_ADDED = 1, /* device added in the topology */
+ SCSI_TOPOLOGY_REMOVED = 2, /* device removed from the topology */
+};
+
+#if defined (CONFIG_SCSI_HOTPLUG) || defined(CONFIG_SCSI_HOTPLUG_MODULE)
+extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int channel,
+ unsigned int id, unsigned int lun, enum scsi_topology_action action);
+#else
+static inline int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int channel,
+ unsigned int id, unsigned int lun, enum scsi_topology_action action)
+{return -ENOSYS;}
+#endif
+
+#endif /* _SCSI_SCSI_HOTPLUG_H */
--- /dev/null Thu Apr 11 09:25:15 2002
+++ drivers/scsi/scsi_hotplug.c Sun Feb 6 23:42:21 2005
@@ -0,0 +1,138 @@
+/*
+ * SCSI Hotplug
+ *
+ * Copyright (c) 2005 Dell, Inc <Matt_Domsch@dell.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kobject.h>
+#include <scsi/scsi_hotplug.h>
+
+/*
+ * TODO:
+ * - if CONFIG_SCSI_HOTPLUG=y and CONFIG_SCSI=y, then the exported
+ * functions here get dropped by the vmlinux linker, as there are no
+ * vmlinux users of them (only modules).
+ *
+ */
+
+/* This belongs in include/device.h, as drivers/base/core.c defines it too */
+#define to_dev(obj) container_of(obj, struct device, kobj)
+
+static int scsi_topology_device_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
+ int num_envp, char *buffer, int buffer_size)
+{
+
+ struct device *dev = to_dev(kobj);
+ struct device *parent_dev = dev->parent;
+ struct scsi_device *sdev = to_scsi_device(dev);
+ struct Scsi_Host *shost = dev_to_shost(parent_dev);
+ int length = 0;
+ int i = 0;
+
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "SCSI_TOPOLOGY_EVENT=1");
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "SCSI_TOPOLOGY_EVENT_HCTL=1");
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "SCSI_HOST=%u", shost->host_no);
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "SCSI_CHANNEL=%u", sdev->channel);
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "SCSI_ID=%u", sdev->id);
+ add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+ "SCSI_LUN=%u", sdev->lun);
+
+ envp[i] = NULL;
+ return 0;
+}
+
+static struct kset_hotplug_ops scsi_topology_device_kset_ops +{
+ .hotplug = scsi_topology_device_hotplug,
+};
+
+static struct kset scsi_topology_device_kset = {
+ .hotplug_ops = &scsi_topology_device_kset_ops,
+ .kobj = {
+ .name = "scsi_topology",
+ },
+};
+
+static void scsi_topology_device_release(struct device *dev)
+{
+ put_device(dev->parent);
+}
+
+static int scsi_topology_device_init(struct scsi_device *sdev,
+ struct Scsi_Host *shost,
+ unsigned int channel,
+ unsigned int id,
+ unsigned int lun)
+{
+ struct device *dev;
+ memset(sdev, 0, sizeof(*sdev));
+ dev = &sdev->sdev_gendev;
+ snprintf(dev->bus_id, BUS_ID_SIZE, "topology-%u:%u:%u:%u",
+ shost->host_no, channel, id, lun);
+ dev->parent = get_device(&shost->shost_gendev);
+ dev->release = scsi_topology_device_release;
+ sdev->channel = channel;
+ sdev->id = id;
+ sdev->lun = lun;
+ device_initialize(dev);
+ kobject_set_name(&dev->kobj, "%s", dev->bus_id);
+ dev->kobj.parent = &dev->parent->kobj;
+ dev->kobj.kset = &scsi_topology_device_kset;
+ return 0;
+}
+
+static inline enum kobject_action scsi_topology_action_to_kobject_action(enum scsi_topology_action action)
+{
+ enum kobject_action kaction = KOBJ_CHANGE; /* should there be a KOBJ_NOOP? */
+ switch (action) {
+ case SCSI_TOPOLOGY_ADDED:
+ kaction = KOBJ_ADD;
+ break;
+ case SCSI_TOPOLOGY_REMOVED:
+ kaction = KOBJ_REMOVE;
+ break;
+ }
+ return kaction;
+}
+
+
+int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int channel,
+ unsigned int id, unsigned int lun, enum scsi_topology_action action)
+{
+ struct scsi_device *sdev;
+ enum kobject_action kaction;
+ int error;
+
+ sdev = kmalloc(sizeof(*sdev), GFP_KERNEL);
+ if (!sdev)
+ return -ENOMEM;
+ error = scsi_topology_device_init(sdev, shost, channel, id, lun);
+ if (error)
+ return error;
+ kaction = scsi_topology_action_to_kobject_action(action);
+ kobject_hotplug(&sdev->sdev_gendev.kobj, kaction);
+ kfree(sdev);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(scsi_topology_hctl_action);
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
@ 2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:29 ` Matt Domsch
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Matt Domsch @ 2005-02-07 18:29 UTC (permalink / raw)
To: linux-scsi, linux-hotplug-devel
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
> Modified files:
> drivers/scsi/megaraid/megaraid_mbox.c
> (will follow in a separate patch)
> is the user of this new function.
For example. I will rework this to follow the patch submitted last
week by LSI to accomplish something similar in their driver.
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
=== drivers/scsi/megaraid/megaraid_mbox.c 1.12 vs edited ==--- 1.12/drivers/scsi/megaraid/megaraid_mbox.c 2005-01-31 00:33:46 -06:00
+++ edited/drivers/scsi/megaraid/megaraid_mbox.c 2005-02-06 23:35:08 -06:00
@@ -70,6 +70,7 @@
* For history of changes, see Documentation/ChangeLog.megaraid
*/
+#include <scsi/scsi_hotplug.h>
#include "megaraid_mbox.h"
static int megaraid_init(void);
@@ -455,6 +456,100 @@
/*
+ * sysfs class device support
+ * creates three files:
+ * /sys/class/scsi_host
+ * |-- host0
+ * | |-- logical_drive_created
+ * | |-- logical_drive_destroyed
+ *
+ * These make the midlayer invoke /sbin/hotplug, which then calls back into sysfs
+ * /sys/class/scsi_host
+ * |-- host0
+ * | |-- scan
+ *
+ * and
+ *
+ * /sys/devices/pci0000:0x/0000:0x:0x.0/host0
+ * |-- 0:0:0:0
+ * | |-- delete
+ *
+ * respectively. This allows userspace applications to work
+ * using their logical drive number, and lets the driver translate
+ * that into host, channel, id, and lun values which the other
+ * mechanisms require. This is similar to how hot plug CPU works.
+ */
+
+/**
+ * lda_to_hcil()
+ * @adapter
+ * @lda - logical drive address
+ * @host_no
+ * @channel
+ * @id
+ * @lun
+ *
+ * converts a logical drive address into a host, channel id, lun tuple.
+ */
+
+static inline int megaraid_lda_to_hcil(struct Scsi_Host *shost, u32 lda,
+ u32 *host_no, u32 *channel, u32 *id, u32 *lun)
+{
+ if (lda > MAX_LOGICAL_DRIVES_40LD)
+ return -EINVAL;
+ *host_no = shost->host_no;
+ *channel = shost->max_channel;
+ *id = (lda < shost->this_id) ? lda : lda + 1;
+ *lun = 0;
+ return 0;
+}
+
+static int megaraid_host_store(struct class_device *class_dev, const char *buf, size_t count,
+ enum scsi_topology_action action)
+{
+ struct Scsi_Host *shost = class_to_shost(class_dev);
+ int fields=0, rc=-EINVAL;
+ u32 lda=0, host_no=0, channel=0, id=0, lun=0;
+ fields = sscanf(buf, "%u", &lda);
+ if (fields != 1)
+ return rc;
+ if (lda > MAX_LOGICAL_DRIVES_40LD)
+ return rc;
+ rc = megaraid_lda_to_hcil(shost, lda, &host_no, &channel, &id, &lun);
+ if (rc)
+ return rc;
+
+ rc = scsi_topology_hctl_action(shost, channel, id, lun, action);
+
+ if (rc)
+ return rc;
+ return count;
+}
+
+static ssize_t megaraid_host_store_ld_created(struct class_device *class_dev, const char *buf, size_t count)
+{
+ return megaraid_host_store(class_dev, buf, count, SCSI_TOPOLOGY_ADDED);
+}
+static ssize_t megaraid_host_store_ld_destroyed(struct class_device *class_dev, const char *buf, size_t count)
+{
+ return megaraid_host_store(class_dev, buf, count, SCSI_TOPOLOGY_REMOVED);
+}
+
+
+#define MEGARAID_HOST_WOATTR(_name,_store) \
+CLASS_DEVICE_ATTR(_name, S_IWUSR|S_IWGRP, NULL, _store)
+
+static MEGARAID_HOST_WOATTR(logical_drive_created, megaraid_host_store_ld_created);
+static MEGARAID_HOST_WOATTR(logical_drive_destroyed, megaraid_host_store_ld_destroyed);
+
+/* Host attributes initializer */
+static struct class_device_attribute *megaraid_host_attrs[] = {
+ &class_device_attr_logical_drive_created,
+ &class_device_attr_logical_drive_destroyed,
+ NULL,
+};
+
+/*
* Scsi host template for megaraid unified driver
*/
static struct scsi_host_template megaraid_template_g = {
@@ -467,6 +562,7 @@
.eh_bus_reset_handler = megaraid_reset_handler,
.eh_host_reset_handler = megaraid_reset_handler,
.use_clustering = ENABLE_CLUSTERING,
+ .shost_attrs = megaraid_host_attrs,
};
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
2005-02-07 18:29 ` Matt Domsch
@ 2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:30 ` Matt Domsch
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Matt Domsch @ 2005-02-07 18:29 UTC (permalink / raw)
To: linux-scsi, linux-hotplug-devel
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
> In addition, two more infrastructure pieces are necessary:
> udev-050-scsi_topology.patch - adds the subsystem name "scsi_topology"
> to the list of devices *not* to wait for the creation of files in
> sysfs for - scsi_topology devices aren't to be registered in sysfs.
Patch follows.
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
--- udev-050/udev_sysfs.c.~1~ 2004-12-17 23:53:07.000000000 -0600
+++ udev-050/udev_sysfs.c 2005-02-07 10:58:45.000000000 -0600
@@ -56,6 +56,7 @@
{ .subsystem = "fc_host", .file = "port_id" },
{ .subsystem = "spi_transport", .file = "width" },
{ .subsystem = "spi_host", .file = "width" },
+ { .subsystem = "scsi_topology", .file = NULL },
{ NULL, NULL }
};
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:29 ` Matt Domsch
@ 2005-02-07 18:30 ` Matt Domsch
2005-02-07 19:22 ` Brian King
2005-02-08 23:19 ` Matt Domsch
4 siblings, 0 replies; 7+ messages in thread
From: Matt Domsch @ 2005-02-07 18:30 UTC (permalink / raw)
To: linux-scsi, linux-hotplug-devel
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
> /etc/hotplug/scsi_topology.agent
> handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
> and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
And here's scsi_topology.agent.
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
#!/bin/bash
#
# SCSI Topology hotplug agent.
# Copyright (C) 2005 Dell, Inc. <Matt_Domsch@dell.com>
#
# This is invoked when a device, not currently known to the system, is
# added or removed from a SCSI topology. This includes creation of a
# logical drive on a RAID controller, or manually inserting a disk
# into a SCSI disk enclosure. This script then invokes the scan
# method of the scsi_host, or the delete method of the scsi_device, to
# inform the kernel of the change made on the topology.
#
# SCSI_TOPOLOGY_EVENT_HCTL is used to know that the data to pass to
# scan is a Host:Controller:Target ID:LUN tuple. This is to provide
# for future SCSI implmentations that may use a native addressing
# scheme rather than only HCTL.
[ ${SCSI_TOPOLOGY_EVENT} != "1" ] && exit
[ ${SCSI_TOPOLOGY_EVENT_HCTL} != "1" ] && exit
if [ "${ACTION}" = "add" ]; then
MYPATH=/sys/class/scsi_host/host${SCSI_HOST}/scan
[ -f ${MYPATH} ] && echo "${SCSI_CHANNEL} ${SCSI_ID} ${SCSI_LUN}" > ${MYPATH}
fi
if [ "${ACTION}" = "remove" ]; then
MYPATH=/sys/class/scsi_device/${SCSI_HOST}:${SCSI_CHANNEL}:${SCSI_ID}:${SCSI_LUN}/device/delete
[ -f ${MYPATH} ] && echo "1" > ${MYPATH}
fi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
` (2 preceding siblings ...)
2005-02-07 18:30 ` Matt Domsch
@ 2005-02-07 19:22 ` Brian King
2005-02-07 19:40 ` Matt Domsch
2005-02-08 23:19 ` Matt Domsch
4 siblings, 1 reply; 7+ messages in thread
From: Brian King @ 2005-02-07 19:22 UTC (permalink / raw)
To: Matt Domsch; +Cc: linux-scsi, linux-hotplug-devel
Matt Domsch wrote:
> Below is a patch to add some hotplug infrastructure to the Linux SCSI
> subsystem.
>
> New files:
> include/scsi/scsi_hotplug.h
> drivers/scsi/scsi_hotplug.c
> implements a new exported function:
>
> extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int channel,
> unsigned int id, unsigned int lun, enum scsi_topology_action action);
>
> which invokes kobject_hotplug() on a temporary "scsi_topology"
> device. This device represents a target that exists on a topology
> (i.e. was just inserted into a hot plug enclosure, or was just created
> by a RAID controller management application) but is not yet hooked
> into the kernel.
>
>
> In addition, two more infrastructure pieces are necessary:
> udev-050-scsi_topology.patch - adds the subsystem name "scsi_topology"
> to the list of devices *not* to wait for the creation of files in
> sysfs for - scsi_topology devices aren't to be registered in sysfs.
>
> /etc/hotplug/scsi_topology.agent
> handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
> and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
>
>
> The flow is as follows:
>
> # echo "2" > /sys/class/scsi_host/host2/logical_drive_created
> (to be done by a management application that knows it just created
> logical drive #2 on the controller)
>
> megaraid_mbox.c sysfs method converts logical drive number to HCTL
> value, calls scsi_topology_hctl_action().
>
> scsi_topology_hctl_action() invokes kobject_hotplug() with a
> scsi_topology subsystem device.
>
> kobject_hotplug() calls /sbin/hotplug or /sbin/udevsend (more likely
> the latter), which invokes /etc/hotplug/scsi_topology.agent with the
> ACTION={add,remove}.
>
> scsi_topology.agent invokes /sys/class/scsi_host/hostX/scan or
> /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
>
> From this point, we're back into known territory, with the device
> being made known, or deleted from, the kernel's view.
>
> Thoughts?
Just curious why the following flow would not work/be preferred:
1. echo "2" > /sys/class/scsi_host/host2/logical_drive_created
2. megaraid_mbox.c sysfs method converts logical drive number to HCTL
value, calls scsi_add_device.
3. scsi_add_device works as it does today and generates hotplug events
-Brian
--
Brian King
eServer Storage I/O
IBM Linux Technology Center
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
2005-02-07 19:22 ` Brian King
@ 2005-02-07 19:40 ` Matt Domsch
0 siblings, 0 replies; 7+ messages in thread
From: Matt Domsch @ 2005-02-07 19:40 UTC (permalink / raw)
To: Brian King; +Cc: linux-scsi, linux-hotplug-devel
On Mon, Feb 07, 2005 at 01:22:29PM -0600, Brian King wrote:
> Just curious why the following flow would not work/be preferred:
>
> 1. echo "2" > /sys/class/scsi_host/host2/logical_drive_created
> 2. megaraid_mbox.c sysfs method converts logical drive number to HCTL
> value, calls scsi_add_device.
> 3. scsi_add_device works as it does today and generates hotplug events
>
> -Brian
This direction was what came out of this thread back in December.
http://marc.theaimsgroup.com/?l=linux-kernel&m\x110314267629902&w=2
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
` (3 preceding siblings ...)
2005-02-07 19:22 ` Brian King
@ 2005-02-08 23:19 ` Matt Domsch
4 siblings, 0 replies; 7+ messages in thread
From: Matt Domsch @ 2005-02-08 23:19 UTC (permalink / raw)
To: linux-scsi, linux-hotplug-devel
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
> Below is a patch to add some hotplug infrastructure to the Linux SCSI
> subsystem.
I've added and reworked the megaraid_mbox driver to make use of this
new infrastructure. I'll send that patch next. The rest is unchanged
from yesterday.
I've put this work into a bkbits repo. This is a clone of Linus's
linux-2.6, not of James' scsi-misc-2.6.
bk pull http://mdomsch.bkbits.net/linux-2.6-scsi-hotplug
This will update the following files:
Documentation/scsi/ChangeLog.megaraid | 130 ++++++++
drivers/scsi/Kconfig | 10
drivers/scsi/Makefile | 1
drivers/scsi/megaraid/Kconfig.megaraid | 1
drivers/scsi/megaraid/mega_common.h | 3
drivers/scsi/megaraid/megaraid_ioctl.h | 1
drivers/scsi/megaraid/megaraid_mbox.c | 500 +++++++++++++++++++++++++++++++--
drivers/scsi/megaraid/megaraid_mbox.h | 28 +
drivers/scsi/megaraid/megaraid_mm.c | 39 ++
drivers/scsi/megaraid/megaraid_mm.h | 5
drivers/scsi/scsi_hotplug.c | 138 +++++++++
include/scsi/scsi_hotplug.h | 41 ++
12 files changed, 867 insertions, 30 deletions
through these ChangeSets:
<Matt_Domsch@dell.com> (05/02/08 1.2132.2.3)
Release Date : Tue Feb 08 12:27:22 EST 2005 - Matt Domsch <Matt_Domsch@dell.com>
Current Version : 2.20.4.6 (scsi module), 2.20.2.5 (cmm module)
Older Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
1. Added two new megaraid_shost_attrs
/sys/class/scsi_host
|-- host0
| |-- logical_drive_created
| |-- logical_drive_destroyed
and helper functions for them. Written to from userspace by
a management application, these invoke SCSI hotplug
infrastructure for informing the kernel that a logical drive
has been created, or will be destroyed quite soon.
echo "2" > logical_drive_created
after creating logical drive #2 in the management app
echo "4" > logical_drive_destroyed
immediately before destroying logical drive #4 in the
management app. Eventually these functions should be called
directly from the management app.
2. Made class_device_megaraid_mbox_app_hndl and
dev_attr_megaraid_mbox_ld static.
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
<Matt_Domsch@dell.com> (05/02/08 1.2132.2.2)
megaraid_2.20.4.5.patch
<Matt_Domsch@dell.com> (05/02/07 1.2048.2.1)
Below is a patch to add some hotplug infrastructure to the Linux SCSI
subsystem.
New files:
include/scsi/scsi_hotplug.h
drivers/scsi/scsi_hotplug.c
implements a new exported function:
extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int channel,
unsigned int id, unsigned int lun, enum scsi_topology_action action);
which invokes kobject_hotplug() on a temporary "scsi_topology"
device. This device represents a target that exists on a topology
(i.e. was just inserted into a hot plug enclosure, or was just created
by a RAID controller management application) but is not yet hooked
into the kernel.
In addition, two more infrastructure pieces are necessary:
udev-050-scsi_topology.patch - adds the subsystem name "scsi_topology"
to the list of devices *not* to wait for the creation of files in
sysfs for - scsi_topology devices aren't to be registered in sysfs.
/etc/hotplug/scsi_topology.agent
handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
The flow is as follows:
# echo "2" > /sys/class/scsi_host/host2/logical_drive_created
(to be done by a management application that knows it just created
logical drive #2 on the controller)
megaraid_mbox.c sysfs method converts logical drive number to HCTL
value, calls scsi_topology_hctl_action().
scsi_topology_hctl_action() invokes kobject_hotplug() with a
scsi_topology subsystem device.
kobject_hotplug() calls /sbin/hotplug or /sbin/udevsend (more likely
the latter), which invokes /etc/hotplug/scsi_topology.agent with the
ACTION={add,remove}.
scsi_topology.agent invokes /sys/class/scsi_host/hostX/scan or
/sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
From this point, we're back into known territory, with the device
being made known, or deleted from, the kernel's view.
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-02-08 23:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:30 ` Matt Domsch
2005-02-07 19:22 ` Brian King
2005-02-07 19:40 ` Matt Domsch
2005-02-08 23:19 ` Matt Domsch
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).