Skip to contentSkip to conversation

render shm-signals as standard irqs

PATCH New Gregory Haskins 1 participant 3 messages Oct 14, 2009 Network drivers

lore
Share & tools
lore
#0 lore raw

cover render shm-signals as standard irqs

This series applies to the "linux-next" branch for alacrity-vm.git:

git://git.kernel.org/pub/scm/linux/kernel/git/ghaskins/alacrityvm/linux-2.6.git

Please see the patch headers for details.

Kind Regards,
-Greg

---

Gregory Haskins (2):
vbus: register shm-signal events as standard Linux IRQ vectors
vbus: allow shmsignals to be named

 drivers/net/vbus-enet.c     |   43 ++++++++++++++++----
 drivers/vbus/Kconfig        |    4 +-
 drivers/vbus/bus-proxy.c    |    6 +--
 drivers/vbus/pci-bridge.c   |   94 ++++++++++++++++++++++++++++++++++---------
 include/linux/vbus_driver.h |    7 ++-
 5 files changed, 117 insertions(+), 37 deletions(-)
Signature · 1 line
Signature
#1 lore raw

PATCH 1/2 vbus: allow shmsignals to be named

This will allow the signals to be displayed to the end-user in some meaningful way later in the series, such as for statistics, etc.

---

 drivers/net/vbus-enet.c     |   43 ++++++++++++++++++++++++++++++++++---------
 drivers/vbus/bus-proxy.c    |    6 +++---
 drivers/vbus/pci-bridge.c   |    3 ++-
 include/linux/vbus_driver.h |    7 ++++---
 4 files changed, 43 insertions(+), 16 deletions(-)
drivers/net/vbus-enet.c +34 -9
index 6fe2241..9d48674 100644
@@ -101,14 +101,20 @@ napi_to_priv(struct napi_struct *napi)
 static int
 queue_init(struct vbus_enet_priv *priv,
 	   struct vbus_enet_queue *q,
+	   const char *name,
 	   int qid,
 	   size_t ringsize,
 	   void (*func)(struct ioq_notifier *))
 {
 	struct vbus_device_proxy *dev = priv->vdev;
 	int ret;
+	char _name[64];
 
-	ret = vbus_driver_ioq_alloc(dev, qid, 0, ringsize, &q->queue);
+	if (name)
+		snprintf(_name, sizeof(_name), "%s-%s", priv->dev->name, name);
+
+	ret = vbus_driver_ioq_alloc(dev, name ? _name : NULL, qid, 0,
+				    ringsize, &q->queue);
 	if (ret < 0)
 		panic("ioq_alloc failed: %d\n", ret);
 
@@ -396,7 +402,8 @@ tx_setup(struct vbus_enet_priv *priv)
 
 		priv->pmtd.pool = pool;
 
-		ret = dev->ops->shm(dev, shmid, 0, pool, poollen, 0, NULL, 0);
+		ret = dev->ops->shm(dev, NULL, shmid, 0, pool, poollen,
+				    0, NULL, 0);
 		BUG_ON(ret < 0);
 	}
 
@@ -1227,12 +1234,13 @@ vbus_enet_evq_negcap(struct vbus_enet_priv *priv, unsigned long count)
 
 		priv->evq.pool = pool;
 
-		ret = dev->ops->shm(dev, query.dpid, 0,
+		ret = dev->ops->shm(dev, NULL, query.dpid, 0,
 				    pool, poollen, 0, NULL, 0);
 		if (ret < 0)
 			return ret;
 
-		queue_init(priv, &priv->evq.veq, query.qid, count, evq_isr);
+		queue_init(priv, &priv->evq.veq, "evq",
+			   query.qid, count, evq_isr);
 
 		ret = ioq_iter_init(priv->evq.veq.queue,
 				    &iter, ioq_idxtype_valid, 0);
@@ -1302,7 +1310,7 @@ vbus_enet_l4ro_negcap(struct vbus_enet_priv *priv, unsigned long count)
 		/*
 		 * pre-mapped descriptor pool
 		 */
-		ret = dev->ops->shm(dev, query.dpid, 0,
+		ret = dev->ops->shm(dev, NULL, query.dpid, 0,
 				    pool, poollen, 0, NULL, 0);
 		if (ret < 0) {
 			printk(KERN_ERR "Error registering L4RO pool: %d\n",
@@ -1317,7 +1325,8 @@ vbus_enet_l4ro_negcap(struct vbus_enet_priv *priv, unsigned long count)
 		 * one MTU frame.  All we need to do is keep it populated
 		 * with free pages.
 		 */
-		queue_init(priv, &priv->l4ro.pageq, query.pqid, count, NULL);
+		queue_init(priv, &priv->l4ro.pageq, "pageq", query.pqid,
+			   count, NULL);
 
 		priv->l4ro.pool      = pool;
 		priv->l4ro.available = true;
@@ -1395,6 +1404,16 @@ vbus_enet_probe(struct vbus_device_proxy *vdev)
 	if (!dev)
 		return -ENOMEM;
 
+	/*
+	 * establish our device-name early so we can incorporate it into
+	 * the signal-path names, etc
+	 */
+	rtnl_lock();
+
+	ret = dev_alloc_name(dev, dev->name);
+	if (ret < 0)
+		goto out_free;
+
 	priv = netdev_priv(dev);
 
 	spin_lock_init(&priv->lock);
@@ -1416,8 +1435,10 @@ vbus_enet_probe(struct vbus_device_proxy *vdev)
 
 	skb_queue_head_init(&priv->tx.outstanding);
 
-	queue_init(priv, &priv->rxq, VENET_QUEUE_RX, rx_ringlen, rx_isr);
-	queue_init(priv, &priv->tx.veq, VENET_QUEUE_TX, tx_ringlen, tx_isr);
+	queue_init(priv, &priv->rxq, "rx", VENET_QUEUE_RX, rx_ringlen,
+		   rx_isr);
+	queue_init(priv, &priv->tx.veq, "tx", VENET_QUEUE_TX, tx_ringlen,
+		   tx_isr);
 
 	rx_setup(priv);
 	tx_setup(priv);
@@ -1453,18 +1474,22 @@ vbus_enet_probe(struct vbus_device_proxy *vdev)
 
 	dev->features |= NETIF_F_HIGHDMA;
 
-	ret = register_netdev(dev);
+	ret = register_netdevice(dev);
 	if (ret < 0) {
 		printk(KERN_INFO "VENET: error %i registering device \"%s\"\n",
 		       ret, dev->name);
 		goto out_free;
 	}
 
+	rtnl_unlock();
+
 	vdev->priv = priv;
 
 	return 0;
 
  out_free:
+	rtnl_unlock();
+
 	free_netdev(dev);
 
 	return ret;
drivers/vbus/bus-proxy.c +3 -3
index 88cd904..5d34942 100644
@@ -167,8 +167,8 @@ static struct ioq_ops vbus_driver_ioq_ops = {
 };
 
 
-int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, int id, int prio,
-			  size_t count, struct ioq **ioq)
+int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, const char *name,
+			  int id, int prio, size_t count, struct ioq **ioq)
 {
 	struct ioq           *_ioq;
 	struct ioq_ring_head *head = NULL;
@@ -188,7 +188,7 @@ int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, int id, int prio,
 	head->ver	= IOQ_RING_VER;
 	head->count     = count;
 
-	ret = dev->ops->shm(dev, id, prio, head, len,
+	ret = dev->ops->shm(dev, name, id, prio, head, len,
 			    &head->signal, &signal, 0);
 	if (ret < 0)
 		goto error;
drivers/vbus/pci-bridge.c +2 -1
index 80718e6..fa77318 100644
@@ -262,7 +262,8 @@ vbus_pci_device_close(struct vbus_device_proxy *vdev, int flags)
 }
 
 static int
-vbus_pci_device_shm(struct vbus_device_proxy *vdev, int id, int prio,
+vbus_pci_device_shm(struct vbus_device_proxy *vdev, const char *name,
+		    int id, int prio,
 		    void *ptr, size_t len,
 		    struct shm_signal_desc *sdesc, struct shm_signal **signal,
 		    int flags)
include/linux/vbus_driver.h +4 -3
index 9cfbf60..2b1dac4 100644
@@ -34,7 +34,8 @@ struct vbus_driver;
 struct vbus_device_proxy_ops {
 	int (*open)(struct vbus_device_proxy *dev, int version, int flags);
 	int (*close)(struct vbus_device_proxy *dev, int flags);
-	int (*shm)(struct vbus_device_proxy *dev, int id, int prio,
+	int (*shm)(struct vbus_device_proxy *dev, const char *name,
+		   int id, int prio,
 		   void *ptr, size_t len,
 		   struct shm_signal_desc *sigdesc, struct shm_signal **signal,
 		   int flags);
@@ -74,7 +75,7 @@ void vbus_driver_unregister(struct vbus_driver *drv);
 /*
  * driver-side IOQ helper - allocates device-shm and maps an IOQ on it
  */
-int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, int id, int prio,
-			  size_t ringsize, struct ioq **ioq);
+int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, const char *name,
+			  int id, int prio, size_t ringsize, struct ioq **ioq);
 
 #endif /* _LINUX_VBUS_DRIVER_H */
#2 lore raw

PATCH 2/2 vbus: register shm-signal events as standard Linux IRQ vectors

In reply to Gregory Haskins

This will allow us to view the vector statistics in a uniform way, as well as pave the way for supporting irqbalance in the future.

The VBUS PCI-BRIDGE will present itself as an irqchip device to the kernel proper. Each shm-signal that is created by a specific driver will show up as a "VBUS-edge" IRQ in /proc/interrupts. For instane, here is example output from running a venet device as "eth1" (see vectors 28-31):

vbus-guest:/home/ghaskins # cat /proc/interrupts
CPU0

   0:         89   IO-APIC-edge      timer
   1:          6   IO-APIC-edge      i8042
   4:       1620   IO-APIC-edge      serial
   6:          2   IO-APIC-edge      floppy
   7:          0   IO-APIC-edge      parport0
   8:          0   IO-APIC-edge      rtc0
   9:          0   IO-APIC-fasteoi   acpi
  10:          0   IO-APIC-fasteoi   virtio1
  12:         90   IO-APIC-edge      i8042
  14:       3474   IO-APIC-edge      ata_piix
  15:       7778   IO-APIC-edge      ata_piix
  24:     185849   PCI-MSI-edge      vbus
  25:          0   PCI-MSI-edge      virtio0-config
  26:        210   PCI-MSI-edge      virtio0-input
  27:         28   PCI-MSI-edge      virtio0-output
  28:     167062      VBUS-edge      eth1-evq
  29:          0      VBUS-edge      eth1-pageq
  30:     161593      VBUS-edge      eth1-rx
  31:          0      VBUS-edge      eth1-tx
 NMI:          0   Non-maskable interrupts
 LOC:      72010   Local timer interrupts
 SPU:          0   Spurious interrupts
 CNT:          0   Performance counter interrupts
 PND:          0   Performance pending work
 RES:          0   Rescheduling interrupts
 CAL:          0   Function call interrupts
 TLB:          0   TLB shootdowns
 TRM:          0   Thermal event interrupts
 THR:          0   Threshold APIC interrupts
 MCE:          0   Machine check exceptions
 MCP:         20   Machine check polls

ERR: 0
MIS: 0

---

 drivers/vbus/Kconfig      |    4 +-
 drivers/vbus/pci-bridge.c |   91 ++++++++++++++++++++++++++++++++++++---------
 2 files changed, 74 insertions(+), 21 deletions(-)
drivers/vbus/Kconfig +2 -2
index 08667aa..f51cba1 100644
@@ -3,7 +3,7 @@
 #
 
 config VBUS_PROXY
-       tristate "Virtual-Bus support"
+       bool "Virtual-Bus support"
        select SHM_SIGNAL
        select IOQ
        default n
@@ -14,7 +14,7 @@ config VBUS_PROXY
 	on the backend, say Y.  If unsure, say N.
 
 config VBUS_PCIBRIDGE
-       tristate "PCI to Virtual-Bus bridge"
+       bool "PCI to Virtual-Bus bridge"
        depends on PCI
        depends on VBUS_PROXY
        select IOQ
drivers/vbus/pci-bridge.c +72 -19

146 lines not on this page · raw message