From: BitKeeper B. <ri...@su...> - 2004-09-16 14:01:20
|
ChangeSet 1.1317, 2004/09/16 14:11:34+01:00, ka...@fr... Improve configuration of virtual device drivers in XenLinux. arch/xen/Kconfig | 67 ++++++++++++++++++++++++++++++++++--- arch/xen/configs/xen0_defconfig | 5 ++ arch/xen/configs/xenU_defconfig | 5 ++ arch/xen/i386/mm/ioremap.c | 5 -- drivers/xen/Makefile | 8 ++-- drivers/xen/netfront/netfront.c | 23 ++++++++---- include/asm-xen/asm-i386/pgalloc.h | 2 - 7 files changed, 92 insertions(+), 23 deletions(-) diff -Nru a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig --- a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig 2004-09-16 10:01:08 -04:00 @@ -31,9 +31,68 @@ Support for privileged operation (domain 0) config XEN_PHYSDEV_ACCESS - bool "Device-driver domain (physical device access)" + bool "Physical device access" + default y if XEN_PRIVILEGED_GUEST + default n if !XEN_PRIVILEGED_GUEST help - Device-driver domain (physical device access) + Assume access is available to physical hardware devices + (e.g., hard drives, network cards). This allows you to configure + such devices and also includes some low-level support that is + otherwise not compiled into the kernel. + +config XEN_BLKDEV_BACKEND + bool "Block-device backend driver" + default y if XEN_PHYSDEV_ACCESS + default n if !XEN_PHYSDEV_ACCESS + help + The block-device backend driver allows the kernel to export its + block devices to other guests via a high-performance shared-memory + interface. + +config XEN_NETDEV_BACKEND + bool "Network-device backend driver" + default y if XEN_PHYSDEV_ACCESS + default n if !XEN_PHYSDEV_ACCESS + help + The network-device backend driver allows the kernel to export its + network devices to other guests via a high-performance shared-memory + interface. + +config XEN_BLKDEV_FRONTEND + bool "Block-device frontend driver" + default y + help + The block-device frontend driver allows the kernel to access block + devices mounted within another guest OS. Unless you are building a + dedicated device-driver domain, or your master control domain + (domain 0), then you almost certainly want to say Y here. + +config XEN_NETDEV_FRONTEND + bool "Network-device frontend driver" + default y + help + The network-device frontend driver allows the kernel to access + network interfaces within another guest OS. Unless you are building a + dedicated device-driver domain, or your master control domain + (domain 0), then you almost certainly want to say Y here. + +if XEN_NETDEV_FRONTEND +config XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER + bool "Pipelined transmitter (DANGEROUS)" + default n + help + The driver will assume that the backend is pipelining packets for + transmission: whenever packets are pending in the remote backend, + the driver will not send asynchronous notifications when it queues + additional packets for transmission. + If the backend is a dumb domain, such as a transparent Ethernet + bridge with no local IP interface, it is safe to say Y here to get + slightly lower network overhead. + If the backend has a local IP interface; or may be doing smart things + like reassembling packets to perform firewall filtering; or if you + are unsure; or if you experience network hangs when this option is + enabled; then you must say N here. +endif config XEN_WRITABLE_PAGETABLES bool "Use writable pagetables" @@ -49,8 +108,8 @@ config PAGESIZED_SKBS bool - default y if XEN_PHYSDEV_ACCESS - default n if !XEN_PHYSDEV_ACCESS + default y if XEN_NETDEV_BACKEND + default n if !XEN_NETDEV_BACKEND #config VT # bool diff -Nru a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig 2004-09-16 10:01:08 -04:00 @@ -10,6 +10,11 @@ # CONFIG_XEN_PRIVILEGED_GUEST=y CONFIG_XEN_PHYSDEV_ACCESS=y +CONFIG_XEN_BLKDEV_BACKEND=y +CONFIG_XEN_NETDEV_BACKEND=y +CONFIG_XEN_BLKDEV_FRONTEND=y +CONFIG_XEN_NETDEV_FRONTEND=y +# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set CONFIG_XEN_WRITABLE_PAGETABLES=y CONFIG_FOREIGN_PAGES=y CONFIG_PAGESIZED_SKBS=y diff -Nru a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig 2004-09-16 10:01:08 -04:00 @@ -10,6 +10,11 @@ # # CONFIG_XEN_PRIVILEGED_GUEST is not set # CONFIG_XEN_PHYSDEV_ACCESS is not set +# CONFIG_XEN_BLKDEV_BACKEND is not set +# CONFIG_XEN_NETDEV_BACKEND is not set +CONFIG_XEN_BLKDEV_FRONTEND=y +CONFIG_XEN_NETDEV_FRONTEND=y +# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set CONFIG_XEN_WRITABLE_PAGETABLES=y CONFIG_FOREIGN_PAGES=y # CONFIG_PAGESIZED_SKBS is not set diff -Nru a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c 2004-09-16 10:01:08 -04:00 @@ -337,8 +337,6 @@ #endif /* CONFIG_XEN_PHYSDEV_ACCESS */ -#if defined(CONFIG_XEN_PRIVILEGED_GUEST) - /* These hacky macros avoid phys->machine translations. */ #define __direct_pte(x) ((pte_t) { (x) } ) #define __direct_mk_pte(page_nr,pgprot) \ @@ -481,6 +479,3 @@ return 0; } - - -#endif /* CONFIG_XEN_PRIVILEGED_GUEST */ diff -Nru a/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile b/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile --- a/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile 2004-09-16 10:01:08 -04:00 @@ -1,11 +1,11 @@ -obj-y += blkfront/ obj-y += console/ obj-y += evtchn/ -obj-y += netfront/ obj-y += privcmd/ -obj-$(CONFIG_XEN_PHYSDEV_ACCESS) += blkback/ -obj-$(CONFIG_XEN_PHYSDEV_ACCESS) += netback/ +obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ +obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/ +obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += blkfront/ +obj-$(CONFIG_XEN_NETDEV_FRONTEND) += netfront/ diff -Nru a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c 2004-09-16 10:01:08 -04:00 @@ -40,6 +40,19 @@ #define __GFP_NOWARN 0 #endif +/* + * If the backend driver is pipelining transmit requests then we can be very + * aggressive in avoiding new-packet notifications -- only need to send a + * notification if there are no outstanding unreceived responses. + * If the backend may be buffering our transmit buffers for any reason then we + * are rather more conservative. + */ +#ifdef CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER +#define TX_TEST_IDX resp_prod /* aggressive: any outstanding responses? */ +#else +#define TX_TEST_IDX req_cons /* conservative: not seen all our requests? */ +#endif + static void network_tx_buf_gc(struct net_device *dev); static void network_alloc_rx_buffers(struct net_device *dev); @@ -408,15 +421,9 @@ np->stats.tx_bytes += skb->len; np->stats.tx_packets++; - /* Only notify Xen if there are no outstanding responses. */ - /* - * KAF (16/9/04): Checking outstanding responses is unsafe, as pending work - * may be dependent on packets not yet seen by the backend (e.g., he may - * have a partially-assembled fragmented IP packet). For now, the check is - * more conservative -- has the backend seen all previous requests? - */ + /* Only notify Xen if we really have to. */ mb(); - if ( np->tx->req_cons/*resp_prod*/ == i ) + if ( np->tx->TX_TEST_IDX == i ) notify_via_evtchn(np->evtchn); return 0; diff -Nru a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h 2004-09-16 10:01:08 -04:00 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h 2004-09-16 10:01:08 -04:00 @@ -53,7 +53,6 @@ #define check_pgt_cache() do { } while (0) -#ifdef CONFIG_XEN_PRIVILEGED_GUEST int direct_remap_area_pages(struct mm_struct *mm, unsigned long address, unsigned long machine_addr, @@ -64,6 +63,5 @@ unsigned long address, unsigned long size, mmu_update_t *v); -#endif /* CONFIG_XEN_PRIVILEGED_GUEST */ #endif /* _I386_PGALLOC_H */ |