ia64/xen-unstable

changeset 2489:d8a023aa1466

bitkeeper revision 1.1159.1.158 (41499106LOJstE56FhydVjOBF9ioOQ)

Improve configuration of virtual device drivers in XenLinux.
author kaf24@freefall.cl.cam.ac.uk
date Thu Sep 16 13:11:34 2004 +0000 (2004-09-16)
parents 06ca92591145
children d6967bb2c926 8c7604b04eea
files linux-2.6.8.1-xen-sparse/arch/xen/Kconfig linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6.8.1-xen-sparse/drivers/xen/Makefile linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h
line diff
     1.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig	Thu Sep 16 12:05:20 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig	Thu Sep 16 13:11:34 2004 +0000
     1.3 @@ -31,9 +31,68 @@ config XEN_PRIVILEGED_GUEST
     1.4  	  Support for privileged operation (domain 0)
     1.5  
     1.6  config XEN_PHYSDEV_ACCESS
     1.7 -	bool "Device-driver domain (physical device access)"
     1.8 +	bool "Physical device access"
     1.9 +	default y if XEN_PRIVILEGED_GUEST
    1.10 +	default n if !XEN_PRIVILEGED_GUEST
    1.11  	help
    1.12 -	  Device-driver domain (physical device access)
    1.13 +	  Assume access is available to physical hardware devices
    1.14 +          (e.g., hard drives, network cards). This allows you to configure
    1.15 +          such devices and also includes some low-level support that is
    1.16 +          otherwise not compiled into the kernel.
    1.17 +
    1.18 +config XEN_BLKDEV_BACKEND
    1.19 +        bool "Block-device backend driver"
    1.20 +        default y if XEN_PHYSDEV_ACCESS
    1.21 +        default n if !XEN_PHYSDEV_ACCESS
    1.22 +        help
    1.23 +          The block-device backend driver allows the kernel to export its
    1.24 +          block devices to other guests via a high-performance shared-memory
    1.25 +          interface.
    1.26 +
    1.27 +config XEN_NETDEV_BACKEND
    1.28 +        bool "Network-device backend driver"
    1.29 +        default y if XEN_PHYSDEV_ACCESS
    1.30 +        default n if !XEN_PHYSDEV_ACCESS
    1.31 +        help
    1.32 +          The network-device backend driver allows the kernel to export its
    1.33 +          network devices to other guests via a high-performance shared-memory
    1.34 +          interface.
    1.35 +
    1.36 +config XEN_BLKDEV_FRONTEND
    1.37 +        bool "Block-device frontend driver"
    1.38 +        default y
    1.39 +        help
    1.40 +          The block-device frontend driver allows the kernel to access block
    1.41 +          devices mounted within another guest OS. Unless you are building a
    1.42 +          dedicated device-driver domain, or your master control domain
    1.43 +          (domain 0), then you almost certainly want to say Y here.
    1.44 +
    1.45 +config XEN_NETDEV_FRONTEND
    1.46 +        bool "Network-device frontend driver"
    1.47 +        default y
    1.48 +        help
    1.49 +          The network-device frontend driver allows the kernel to access
    1.50 +          network interfaces within another guest OS. Unless you are building a
    1.51 +          dedicated device-driver domain, or your master control domain
    1.52 +          (domain 0), then you almost certainly want to say Y here.
    1.53 +
    1.54 +if XEN_NETDEV_FRONTEND
    1.55 +config XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER
    1.56 +        bool "Pipelined transmitter (DANGEROUS)"
    1.57 +        default n
    1.58 +        help
    1.59 +          The driver will assume that the backend is pipelining packets for
    1.60 +          transmission: whenever packets are pending in the remote backend,
    1.61 +          the driver will not send asynchronous notifications when it queues
    1.62 +          additional packets for transmission.
    1.63 +          If the backend is a dumb domain, such as a transparent Ethernet
    1.64 +          bridge with no local IP interface, it is safe to say Y here to get
    1.65 +          slightly lower network overhead.
    1.66 +          If the backend has a local IP interface; or may be doing smart things
    1.67 +          like reassembling packets to perform firewall filtering; or if you
    1.68 +          are unsure; or if you experience network hangs when this option is
    1.69 +          enabled; then you must say N here.
    1.70 +endif
    1.71  
    1.72  config XEN_WRITABLE_PAGETABLES
    1.73  	bool "Use writable pagetables"
    1.74 @@ -49,8 +108,8 @@ config FOREIGN_PAGES
    1.75  
    1.76  config PAGESIZED_SKBS
    1.77  	bool
    1.78 -	default y if XEN_PHYSDEV_ACCESS
    1.79 -	default n if !XEN_PHYSDEV_ACCESS
    1.80 +	default y if XEN_NETDEV_BACKEND
    1.81 +	default n if !XEN_NETDEV_BACKEND
    1.82  
    1.83  #config VT
    1.84  #	bool
     2.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig	Thu Sep 16 12:05:20 2004 +0000
     2.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xen0_defconfig	Thu Sep 16 13:11:34 2004 +0000
     2.3 @@ -10,6 +10,11 @@ CONFIG_NO_IDLE_HZ=y
     2.4  #
     2.5  CONFIG_XEN_PRIVILEGED_GUEST=y
     2.6  CONFIG_XEN_PHYSDEV_ACCESS=y
     2.7 +CONFIG_XEN_BLKDEV_BACKEND=y
     2.8 +CONFIG_XEN_NETDEV_BACKEND=y
     2.9 +CONFIG_XEN_BLKDEV_FRONTEND=y
    2.10 +CONFIG_XEN_NETDEV_FRONTEND=y
    2.11 +# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
    2.12  CONFIG_XEN_WRITABLE_PAGETABLES=y
    2.13  CONFIG_FOREIGN_PAGES=y
    2.14  CONFIG_PAGESIZED_SKBS=y
     3.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig	Thu Sep 16 12:05:20 2004 +0000
     3.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig	Thu Sep 16 13:11:34 2004 +0000
     3.3 @@ -10,6 +10,11 @@ CONFIG_NO_IDLE_HZ=y
     3.4  #
     3.5  # CONFIG_XEN_PRIVILEGED_GUEST is not set
     3.6  # CONFIG_XEN_PHYSDEV_ACCESS is not set
     3.7 +# CONFIG_XEN_BLKDEV_BACKEND is not set
     3.8 +# CONFIG_XEN_NETDEV_BACKEND is not set
     3.9 +CONFIG_XEN_BLKDEV_FRONTEND=y
    3.10 +CONFIG_XEN_NETDEV_FRONTEND=y
    3.11 +# CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
    3.12  CONFIG_XEN_WRITABLE_PAGETABLES=y
    3.13  CONFIG_FOREIGN_PAGES=y
    3.14  # CONFIG_PAGESIZED_SKBS is not set
     4.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c	Thu Sep 16 12:05:20 2004 +0000
     4.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/ioremap.c	Thu Sep 16 13:11:34 2004 +0000
     4.3 @@ -337,8 +337,6 @@ void __init bt_iounmap(void *addr, unsig
     4.4  
     4.5  #endif /* CONFIG_XEN_PHYSDEV_ACCESS */
     4.6  
     4.7 -#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
     4.8 -
     4.9  /* These hacky macros avoid phys->machine translations. */
    4.10  #define __direct_pte(x) ((pte_t) { (x) } )
    4.11  #define __direct_mk_pte(page_nr,pgprot) \
    4.12 @@ -481,6 +479,3 @@ int direct_remap_area_pages(struct mm_st
    4.13      
    4.14      return 0;
    4.15  }
    4.16 -
    4.17 -
    4.18 -#endif /* CONFIG_XEN_PRIVILEGED_GUEST */
     5.1 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile	Thu Sep 16 12:05:20 2004 +0000
     5.2 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/Makefile	Thu Sep 16 13:11:34 2004 +0000
     5.3 @@ -1,11 +1,11 @@
     5.4  
     5.5  
     5.6 -obj-y	+= blkfront/
     5.7  obj-y	+= console/
     5.8  obj-y	+= evtchn/
     5.9 -obj-y	+= netfront/
    5.10  obj-y	+= privcmd/
    5.11  
    5.12 -obj-$(CONFIG_XEN_PHYSDEV_ACCESS)	+= blkback/
    5.13 -obj-$(CONFIG_XEN_PHYSDEV_ACCESS)	+= netback/
    5.14 +obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
    5.15 +obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
    5.16 +obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
    5.17 +obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
    5.18  
     6.1 --- a/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 16 12:05:20 2004 +0000
     6.2 +++ b/linux-2.6.8.1-xen-sparse/drivers/xen/netfront/netfront.c	Thu Sep 16 13:11:34 2004 +0000
     6.3 @@ -40,6 +40,19 @@
     6.4  #define __GFP_NOWARN 0
     6.5  #endif
     6.6  
     6.7 +/*
     6.8 + * If the backend driver is pipelining transmit requests then we can be very
     6.9 + * aggressive in avoiding new-packet notifications -- only need to send a
    6.10 + * notification if there are no outstanding unreceived responses.
    6.11 + * If the backend may be buffering our transmit buffers for any reason then we
    6.12 + * are rather more conservative.
    6.13 + */
    6.14 +#ifdef CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER
    6.15 +#define TX_TEST_IDX resp_prod /* aggressive: any outstanding responses? */
    6.16 +#else
    6.17 +#define TX_TEST_IDX req_cons  /* conservative: not seen all our requests? */
    6.18 +#endif
    6.19 +
    6.20  static void network_tx_buf_gc(struct net_device *dev);
    6.21  static void network_alloc_rx_buffers(struct net_device *dev);
    6.22  
    6.23 @@ -408,15 +421,9 @@ static int network_start_xmit(struct sk_
    6.24      np->stats.tx_bytes += skb->len;
    6.25      np->stats.tx_packets++;
    6.26  
    6.27 -    /* Only notify Xen if there are no outstanding responses. */
    6.28 -    /*
    6.29 -     * KAF (16/9/04): Checking outstanding responses is unsafe, as pending work
    6.30 -     * may be dependent on packets not yet seen by the backend (e.g., he may
    6.31 -     * have a partially-assembled fragmented IP packet). For now, the check is
    6.32 -     * more conservative -- has the backend seen all previous requests?
    6.33 -     */
    6.34 +    /* Only notify Xen if we really have to. */
    6.35      mb();
    6.36 -    if ( np->tx->req_cons/*resp_prod*/ == i )
    6.37 +    if ( np->tx->TX_TEST_IDX == i )
    6.38          notify_via_evtchn(np->evtchn);
    6.39  
    6.40      return 0;
     7.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h	Thu Sep 16 12:05:20 2004 +0000
     7.2 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h	Thu Sep 16 13:11:34 2004 +0000
     7.3 @@ -53,7 +53,6 @@ extern void pte_free(struct page *pte);
     7.4  
     7.5  #define check_pgt_cache()	do { } while (0)
     7.6  
     7.7 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
     7.8  int direct_remap_area_pages(struct mm_struct *mm,
     7.9                              unsigned long address, 
    7.10                              unsigned long machine_addr,
    7.11 @@ -64,6 +63,5 @@ int __direct_remap_area_pages(struct mm_
    7.12  			      unsigned long address, 
    7.13  			      unsigned long size, 
    7.14  			      mmu_update_t *v);
    7.15 -#endif /* CONFIG_XEN_PRIVILEGED_GUEST */
    7.16  
    7.17  #endif /* _I386_PGALLOC_H */