Blob Blame History Raw
From: jbeulich@novell.com
Subject: allow number of guest devices to be configurable
Patch-mainline: obsolete

... and derive NR_DYNIRQS from this (rather than having a hard-coded
value).
Similarly, allow the number of simultaneous transmits in netback to be
configurable.

--- head.orig/arch/x86/include/mach-xen/asm/irq_vectors.h	2011-11-17 16:00:04.000000000 +0100
+++ head/arch/x86/include/mach-xen/asm/irq_vectors.h	2011-11-18 16:44:59.000000000 +0100
@@ -88,9 +88,9 @@ extern int nr_pirqs;
 
 #define DYNIRQ_BASE			(PIRQ_BASE + nr_pirqs)
 #ifdef CONFIG_SPARSE_IRQ
-#define NR_DYNIRQS			CPU_VECTOR_LIMIT
+#define NR_DYNIRQS			(CPU_VECTOR_LIMIT + CONFIG_XEN_NR_GUEST_DEVICES)
 #else
-#define NR_DYNIRQS			256
+#define NR_DYNIRQS			(64 + CONFIG_XEN_NR_GUEST_DEVICES)
 #endif
 
 #define NR_IRQS				(NR_PIRQS + NR_DYNIRQS)
--- head.orig/drivers/xen/Kconfig	2012-02-17 14:37:09.000000000 +0100
+++ head/drivers/xen/Kconfig	2012-02-17 14:38:14.000000000 +0100
@@ -96,6 +96,15 @@ config XEN_NETDEV_BACKEND
 	  network devices to other guests via a high-performance shared-memory
 	  interface.
 
+config XEN_NETDEV_TX_SHIFT
+	int "Maximum simultaneous transmit requests (as a power of 2)"
+	depends on XEN_NETDEV_BACKEND
+	range 5 15
+	default 8
+	help
+	  The maximum number transmits the driver can hold pending, expressed
+	  as the exponent of a power of 2.
+
 config XEN_NETDEV_PIPELINED_TRANSMITTER
 	bool "Pipelined transmitter (DANGEROUS)"
 	depends on XEN_NETDEV_BACKEND
@@ -235,6 +244,16 @@ config XEN_DISABLE_SERIAL
 	  Disable serial port drivers, allowing the Xen console driver
 	  to provide a serial console at ttyS0.
 
+config XEN_NR_GUEST_DEVICES
+	int "Number of guest devices"
+	range 0 4032 if 64BIT
+	range 0 960
+	default 256 if XEN_BACKEND
+	default 16
+	help
+	  Specify the total number of virtual devices (i.e. both frontend
+	  and backend) that you want the kernel to be able to service.
+
 choice
 	prompt "Xen version compatibility"
 	default XEN_COMPAT_030002_AND_LATER
--- head.orig/drivers/xen/core/evtchn.c	2012-04-03 17:09:23.000000000 +0200
+++ head/drivers/xen/core/evtchn.c	2012-06-08 10:39:35.000000000 +0200
@@ -1761,7 +1761,7 @@ EXPORT_SYMBOL_GPL(nr_pirqs);
 
 int __init arch_probe_nr_irqs(void)
 {
-	int nr = 256, nr_irqs_gsi;
+	int nr = 64 + CONFIG_XEN_NR_GUEST_DEVICES, nr_irqs_gsi;
 
 	if (is_initial_xendomain()) {
 		nr_irqs_gsi = NR_IRQS_LEGACY;
--- head.orig/drivers/xen/netback/netback.c	2012-06-08 10:39:21.000000000 +0200
+++ head/drivers/xen/netback/netback.c	2012-06-08 10:39:32.000000000 +0200
@@ -76,7 +76,7 @@ static DECLARE_TASKLET(net_rx_tasklet, n
 static struct timer_list net_timer;
 static struct timer_list netbk_tx_pending_timer;
 
-#define MAX_PENDING_REQS 256
+#define MAX_PENDING_REQS (1U << CONFIG_XEN_NETDEV_TX_SHIFT)
 
 /* Discriminate from any valid pending_idx value. */
 #define INVALID_PENDING_IDX 0xffff
@@ -1265,6 +1265,7 @@ static void net_tx_action(unsigned long 
 	net_tx_action_dealloc();
 
 	mop = tx_map_ops;
+	BUILD_BUG_ON(MAX_SKB_FRAGS >= MAX_PENDING_REQS);
 	while (((NR_PENDING_REQS + MAX_SKB_FRAGS) < MAX_PENDING_REQS) &&
 		!list_empty(&net_schedule_list)) {
 		/* Get a netif from the list with work to do. */