Couple of miscellaneous fixes to build Linux pv_ops more cleanly. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Konrad Rzeszutek Wilk
2009-Oct-08 17:23 UTC
[Xen-devel] [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. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- drivers/input/Kconfig | 1 + drivers/video/Kconfig | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index cd50c00..b8e0424 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -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 diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 3b54b39..1b332d1 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -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 -- 1.6.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Konrad Rzeszutek Wilk
2009-Oct-08 17:23 UTC
[Xen-devel] [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. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- 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(-) diff --git a/drivers/xen/blkback/blkback.c b/drivers/xen/blkback/blkback.c index e9e3de1..d0f9bd3 100644 --- a/drivers/xen/blkback/blkback.c +++ b/drivers/xen/blkback/blkback.c @@ -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); diff --git a/drivers/xen/blkback/common.h b/drivers/xen/blkback/common.h index 57b7825..aaf3648 100644 --- a/drivers/xen/blkback/common.h +++ b/drivers/xen/blkback/common.h @@ -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); diff --git a/drivers/xen/blkback/interface.c b/drivers/xen/blkback/interface.c index c6c3e14..4c68fa7 100644 --- a/drivers/xen/blkback/interface.c +++ b/drivers/xen/blkback/interface.c @@ -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; } diff --git a/drivers/xen/blkback/xenbus.c b/drivers/xen/blkback/xenbus.c index 650f4b3..04c0a12 100644 --- a/drivers/xen/blkback/xenbus.c +++ b/drivers/xen/blkback/xenbus.c @@ -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); } diff --git a/drivers/xen/netback/common.h b/drivers/xen/netback/common.h index 9056be0..0675946 100644 --- a/drivers/xen/netback/common.h +++ b/drivers/xen/netback/common.h @@ -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)) diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c index d7d738e..860c61e 100644 --- a/drivers/xen/netback/netback.c +++ b/drivers/xen/netback/netback.c @@ -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); diff --git a/drivers/xen/netback/xenbus.c b/drivers/xen/netback/xenbus.c index a492288..c46b235 100644 --- a/drivers/xen/netback/xenbus.c +++ b/drivers/xen/netback/xenbus.c @@ -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); } -- 1.6.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Konrad Rzeszutek Wilk
2009-Oct-08 17:23 UTC
[Xen-devel] [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. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- arch/x86/include/asm/agp.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/agp.h b/arch/x86/include/asm/agp.h index 8107b71..3282ea6 100644 --- a/arch/x86/include/asm/agp.h +++ b/arch/x86/include/asm/agp.h @@ -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> -- 1.6.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jeremy Fitzhardinge
2009-Oct-08 18:41 UTC
[Xen-devel] Re: [PATCH 3/3] Fix compilation issues with CONFIG_DRM_TTM enabled.
On 10/08/09 10:23, Konrad Rzeszutek Wilk wrote:> 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.)> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > --- > arch/x86/include/asm/agp.h | 1 - > 1 files changed, 0 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/include/asm/agp.h b/arch/x86/include/asm/agp.h > index 8107b71..3282ea6 100644 > --- a/arch/x86/include/asm/agp.h > +++ b/arch/x86/include/asm/agp.h > @@ -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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Konrad Rzeszutek Wilk
2009-Oct-08 19:00 UTC
[Xen-devel] Re: [PATCH 3/3] Fix compilation issues with CONFIG_DRM_TTM enabled.
On Thu, Oct 08, 2009 at 11:41:39AM -0700, Jeremy Fitzhardinge wrote:> On 10/08/09 10:23, Konrad Rzeszutek Wilk wrote: > > 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''> > > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > --- > > arch/x86/include/asm/agp.h | 1 - > > 1 files changed, 0 insertions(+), 1 deletions(-) > > > > diff --git a/arch/x86/include/asm/agp.h b/arch/x86/include/asm/agp.h > > index 8107b71..3282ea6 100644 > > --- a/arch/x86/include/asm/agp.h > > +++ b/arch/x86/include/asm/agp.h > > @@ -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?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. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel