Misc fixes.
Subsystems (4)
PATCH 1/1 Misc fixes.
Couple of miscellaneous fixes to build Linux pv_ops more cleanly.
PATCH 1/3 Fix toogle whether xenbus driver should be built as module or part of kernel.
The "select" statement in the Kconfig ensures that all other users of the xenbus will have the same dependency.
--- drivers/input/Kconfig | 1 + drivers/video/Kconfig | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/input/Kconfig +1 -0
@@ -153,6 +153,7 @@ config XEN_KBDDEV_FRONTEND tristate "Xen virtual keyboard and mouse support" depends on XEN_FBDEV_FRONTEND default y + select XEN_XENBUS_FRONTEND help This driver implements the front-end of the Xen virtual keyboard and mouse device driver. It communicates with a back-end
drivers/video/Kconfig +1 -0
@@ -2070,6 +2070,7 @@ config XEN_FBDEV_FRONTEND select FB_SYS_IMAGEBLIT select FB_SYS_FOPS select FB_DEFERRED_IO + select XEN_XENBUS_FRONTEND default y help This driver implements the front-end of the Xen virtual
Signature · 1 line
1.6.2.5
PATCH 2/3 Fix compile warnings: ignoring return value of 'xenbus_register_backend' ..
We neglect to check the return value of xenbus_register_backend and take actions when that fails. This patch fixes that and adds code to deal with those type of failures.
--- drivers/xen/blkback/blkback.c | 18 +++++++++++++----- drivers/xen/blkback/common.h | 4 ++-- drivers/xen/blkback/interface.c | 6 +++++- drivers/xen/blkback/xenbus.c | 5 ++--- drivers/xen/netback/common.h | 2 +- drivers/xen/netback/netback.c | 12 +++++++++++- drivers/xen/netback/xenbus.c | 4 ++-- 7 files changed, 36 insertions(+), 15 deletions(-)
drivers/xen/blkback/blkback.c +13 -5
@@ -614,6 +614,7 @@ static void make_response(blkif_t *blkif, u64 id,static int __init blkif_init (void ) {int i, mmap_pages; +int rc =0 ;if (!xen_pv_domain ())return -ENODEV ;
@@ -626,13 +627,17 @@ static int __init blkif_init(void) mmap_pages, GFP_KERNEL); pending_pages =alloc_empty_pages_and_pagevec (mmap_pages); -if (!pending_reqs || !pending_grant_handles || !pending_pages) +if (!pending_reqs || !pending_grant_handles || !pending_pages) { + rc = -ENOMEM ; goto out_of_memory; + }for (i =0 ; i < mmap_pages; i++) pending_grant_handles[i] =BLKBACK_INVALID_HANDLE ; -blkif_interface_init (); + rc =blkif_interface_init (); +if (rc) + goto failed_init;memset (pending_reqs,0 ,sizeof (pending_reqs));INIT_LIST_HEAD (&pending_free);
@@ -640,16 +645,19 @@ static int __init blkif_init(void)for (i =0 ; i < blkif_reqs; i++)list_add_tail (&pending_reqs[i].free_list, &pending_free); -blkif_xenbus_init (); + rc =blkif_xenbus_init (); +if (rc) + goto failed_init;return 0 ; out_of_memory: +printk ("%s: out of memory\n" , __FUNCTION__); + failed_init:kfree (pending_reqs);kfree (pending_grant_handles);free_empty_pages_and_pagevec (pending_pages, mmap_pages); -printk ("%s: out of memory\n" , __FUNCTION__); -return -ENOMEM ; +return rc; }module_init (blkif_init);
drivers/xen/blkback/common.h +2 -2
@@ -124,9 +124,9 @@ struct phys_req {int vbd_translate (struct phys_req *req,blkif_t *blkif,int operation); -void blkif_interface_init (void ); +int blkif_interface_init (void ); -void blkif_xenbus_init (void ); +int blkif_xenbus_init (void );irqreturn_t blkif_be_int (int irq,void *dev_id);int blkif_schedule (void *arg);
drivers/xen/blkback/interface.c +5 -1
@@ -175,8 +175,12 @@ void blkif_free(blkif_t *blkif)kmem_cache_free (blkif_cachep, blkif); } -void __init blkif_interface_init (void ) +int __init blkif_interface_init (void ) { blkif_cachep =kmem_cache_create ("blkif_cache" ,sizeof (blkif_t),0 ,0 ,NULL ); +if (!blkif_cachep) +return -ENOMEM ; + +return 0 ; }
drivers/xen/blkback/xenbus.c +2 -3
@@ -535,8 +535,7 @@ static struct xenbus_driver blkback = { }; -void blkif_xenbus_init (void ) +int blkif_xenbus_init (void ) { -/* XXX must_check */ - (void )xenbus_register_backend (&blkback); +return xenbus_register_backend (&blkback); }
drivers/xen/netback/common.h +1 -1
@@ -194,7 +194,7 @@ static inline void netif_put(struct xen_netif *netif)wake_up (&netif->waiting_to_free); } -void netif_xenbus_init (void ); +int netif_xenbus_init (void );#define netif_schedulable (netif) \ (netif_running((netif)->dev) && netback_carrier_ok(netif))
drivers/xen/netback/netback.c +11 -1
@@ -1536,6 +1536,7 @@ static int __init netback_init(void) {int i;struct page *page; +int rc =0 ;if (!xen_domain ())return -ENODEV ;
@@ -1583,7 +1584,9 @@ static int __init netback_init(void)//netif_accel_init(); -netif_xenbus_init (); + rc =netif_xenbus_init (); +if (rc) + goto failed_init;#ifdef NETBE_DEBUG_INTERRUPT (void)bind_virq_to_irqhandler(VIRQ_DEBUG,
@@ -1595,6 +1598,13 @@ static int __init netback_init(void)#endif return 0 ; + +failed_init: +free_empty_pages_and_pagevec (mmap_pages,MAX_PENDING_REQS ); +del_timer (&netbk_tx_pending_timer); +del_timer (&net_timer); +return rc; + }module_init (netback_init);
drivers/xen/netback/xenbus.c +2 -2
@@ -447,8 +447,8 @@ static struct xenbus_driver netback = { }; -void netif_xenbus_init (void ) +int netif_xenbus_init (void ) {printk (KERN_CRIT "registering netback\n" ); - (void )xenbus_register_backend (&netback); +return xenbus_register_backend (&netback); }
Signature · 1 line
1.6.2.5
PATCH 3/3 Fix compilation issues with CONFIG_DRM_TTM enabled.
The recent fix for GART on Xen included an extra include which caused the build to choke when building the ttm drivers.
--- arch/x86/include/asm/agp.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/include/asm/agp.h +0 -1
@@ -3,7 +3,6 @@#include <asm/pgtable.h> #include <asm/cacheflush.h> -#include <asm/dma-mapping.h> #include <asm/xen/hypervisor.h> #include <asm/xen/page.h>
Signature · 1 line
1.6.2.5
Re: [PATCH 3/3] Fix compilation issues with CONFIG_DRM_TTM enabled.
Quoted 3 lines · Konrad Rzeszutek Wilk
The recent fix for GART on Xen included an extra include which caused the build to choke when building the ttm drivers.
How does the compile fail? (Generally its best to include the compilation error messages when submitting a compile-fix patch.)
Quoted 10 lines
Signed-off-by Konrad Rzeszutek Wilk <[email protected]>--- arch/x86/include/asm/agp.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)arch/x86/include/asm/agp.h +0
-0
arch/x86/include/asm/agp.h line 6
Quoted 5 lines
arch/x86/include/asm/agp.h +0
-1@@ -3,7 +3,6 @@#include <asm/pgtable.h> #include <asm/cacheflush.h> -#include <asm/dma-mapping.h>
The code below uses dma_alloc/free_coherent, so it needs some header for the prototypes. Perhaps it should be linux/dma-mapping.h?
J
Re: [PATCH 3/3] Fix compilation issues with CONFIG_DRM_TTM enabled.
Quoted 7 lines · Jeremy Fitzhardinge
Quoted 3 lines · Konrad Rzeszutek Wilk
The recent fix for GART on Xen included an extra include which caused the build to choke when building the ttm drivers.
How does the compile fail? (Generally its best to include the compilation error messages when submitting a compile-fix patch.)
[root@tst001 linux-2.6-pvops.git]# SUBDIRS=/root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/ttm make -j4 -C /root/xen-unstable.hg/linux-2.6-pvops.git O=/root/xen-unstable.hg/build-linux-2.6-pvops_x86_64/ modules
make: Entering directory `/root/xen-unstable.hg/linux-2.6-pvops.git'/root/xen-unstable.hg/linux-2.6-pvops.git/scripts/Makefile.build:44: /root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/ttm/Makefile: No such file or directory
make[2]: *** No rule to make target `/root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/ttm/Makefile'. Stop.
make[1]: *** [_module_/root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/ttm] Error 2
make: *** [sub-make] Error 2
make: Leaving directory `/root/xen-unstable.hg/linux-2.6-pvops.git'
[root@tst001 linux-2.6-pvops.git]# SUBDIRS=/root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm make -j4 -C /root/xen-unstable.hg/linux-2.6-pvops.git O=/root/xen-unstable.hg/build-linux-2.6-pvops_x86_64/ modules
make: Entering directory `/root/xen-unstable.hg/linux-2.6-pvops.git'
CC [M] /root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm/ttm_agp_backend.o
In file included from /root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/swiotlb.h:6,
from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/swiotlb.h:5,
from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/dma-mapping.h:15,
from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/agp.h:7,
from /root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm/ttm_agp_backend.c:40:/root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/dma-mapping.h: In function ‘dma_sync_single’:/root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/dma-mapping.h:117: error: implicit declaration of function ‘dma_sync_single_for_cpu’ /root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/dma-mapping.h: In function ‘dma_sync_sg’:/root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/dma-mapping.h:124: error: implicit declaration of function ‘dma_sync_sg_for_cpu’ In file included from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/dma-mapping.h:37,
from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/agp.h:7,
from /root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm/ttm_agp_backend.c:40:/root/xen-unstable.hg/linux-2.6-pvops.git/include/asm-generic/dma-mapping-common.h: At top level:/root/xen-unstable.hg/linux-2.6-pvops.git/include/asm-generic/dma-mapping-common.h:96: warning: conflicting types for ‘dma_sync_single_for_cpu’ /root/xen-unstable.hg/linux-2.6-pvops.git/include/asm-generic/dma-mapping-common.h:96: error: static declaration of ‘dma_sync_single_for_cpu’ follows non-static declaration /root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/dma-mapping.h:117: note: previous implicit declaration of ‘dma_sync_single_for_cpu’ was here In file included from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/dma-mapping.h:37,
from /root/xen-unstable.hg/linux-2.6-pvops.git/arch/x86/include/asm/agp.h:7,
from /root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm/ttm_agp_backend.c:40:/root/xen-unstable.hg/linux-2.6-pvops.git/include/asm-generic/dma-mapping-common.h:159: warning: conflicting types for ‘dma_sync_sg_for_cpu’ /root/xen-unstable.hg/linux-2.6-pvops.git/include/asm-generic/dma-mapping-common.h:159: error: static declaration of ‘dma_sync_sg_for_cpu’ follows non-static declaration /root/xen-unstable.hg/linux-2.6-pvops.git/include/linux/dma-mapping.h:124: note: previous implicit declaration of ‘dma_sync_sg_for_cpu’ was here make[2]: *** [/root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm/ttm_agp_backend.o] Error 1
make[1]: *** [_module_/root/xen-unstable.hg/linux-2.6-pvops.git/drivers/gpu/drm/ttm] Error 2
make: *** [sub-make] Error 2
make: Leaving directory `/root/xen-unstable.hg/linux-2.6-pvops.git'
Quoted 12 lines
Quoted 12 lines
Signed-off-by Konrad Rzeszutek Wilk <[email protected]>--- arch/x86/include/asm/agp.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)arch/x86/include/asm/agp.h +0
-0@@ -3,7 +3,6 @@
Quoted 7 lines
arch/x86/include/asm/agp.h line 6
Quoted 4 lines
arch/x86/include/asm/agp.h +0
-1#include <asm/pgtable.h> #include <asm/cacheflush.h> -#include <asm/dma-mapping.h> The code below uses dma_alloc/free_coherent, so it needs some header for the prototypes. Perhaps it should be
linux/dma-mapping.h?
That was what I thought too, but all of the cases that utilize this header had beforehand included the header for the dma_alloc/free_coherent.
Your idea of using linux/dma-mapping.h fixes the issue as well, and it is much clearer.