LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v2 2/7] powerpc: remove swiotlb_pci_dma_ops
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Now swiotlb_pci_dma_ops is identical to swiotlb_dma_ops; we can use
swiotlb_dma_ops with any devices. This removes swiotlb_pci_dma_ops.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/include/asm/swiotlb.h         |    1 -
 arch/powerpc/kernel/dma-swiotlb.c          |   14 --------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c   |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
 6 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 31e0e43..21ce0a3 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -14,7 +14,6 @@
 #include <linux/swiotlb.h>
 
 extern struct dma_mapping_ops swiotlb_dma_ops;
-extern struct dma_mapping_ops swiotlb_pci_dma_ops;
 
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index c9f6a30..ca141e1 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -45,20 +45,6 @@ struct dma_mapping_ops swiotlb_dma_ops = {
 	.sync_sg_for_device = swiotlb_sync_sg_for_device
 };
 
-struct dma_mapping_ops swiotlb_pci_dma_ops = {
-	.alloc_coherent = dma_direct_alloc_coherent,
-	.free_coherent = dma_direct_free_coherent,
-	.map_sg = swiotlb_map_sg_attrs,
-	.unmap_sg = swiotlb_unmap_sg_attrs,
-	.dma_supported = swiotlb_dma_supported,
-	.map_page = swiotlb_map_page,
-	.unmap_page = swiotlb_unmap_page,
-	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
-	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
-	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
-	.sync_sg_for_device = swiotlb_sync_sg_for_device
-};
-
 void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
 {
 	struct pci_controller *hose;
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index bf052c0..004b7d3 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -96,7 +96,7 @@ static void __init mpc8536_ds_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index c6f92cc..544011a 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -192,7 +192,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index e1f82f8..5ea1b68 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -254,7 +254,7 @@ static void __init mpc85xx_mds_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 8032301..2aa69a6 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -105,7 +105,7 @@ mpc86xx_hpcn_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak

This is the second version of the patchset to convert POWERPC to use
asm-generic/dma-mapping-common.h:

http://marc.info/?l=linux-kernel&m=124840628128189&w=2

There are some minor changes since the first version are:

- removed unused CONFIG_PPC_NEED_DMA_SYNC_OPS [5/7] (Becky pointed
  out).

- added Becky's Acked-by

- added two new patches ([6/7] and [7/7]). [6/7] fixes SWIOTLB's
  dma_mapping_error(). [7/7] addes CONFIG_DMA_API_DEBUG support.


This is on the top of my swiotlb cleanup patchset:

http://marc.info/?l=linuxppc-embedded&m=124718920320951&w=2


The above swiotlb patchset was merged in -tip so I think that merging
this patchset via -tip too is the easiest way to handle this patchset.

The patchset also is available via a git tree:

git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc


=
 arch/powerpc/Kconfig                       |    7 +-
 arch/powerpc/include/asm/device.h          |    7 +-
 arch/powerpc/include/asm/dma-mapping.h     |  318 +++-------------------------
 arch/powerpc/include/asm/pci.h             |    4 +-
 arch/powerpc/include/asm/swiotlb.h         |    8 +-
 arch/powerpc/kernel/dma-iommu.c            |    2 +-
 arch/powerpc/kernel/dma-swiotlb.c          |   53 ++---
 arch/powerpc/kernel/dma.c                  |   13 +-
 arch/powerpc/kernel/ibmebus.c              |    2 +-
 arch/powerpc/kernel/pci-common.c           |    6 +-
 arch/powerpc/kernel/vio.c                  |    2 +-
 arch/powerpc/platforms/85xx/mpc8536_ds.c   |    3 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    3 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    3 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +-
 arch/powerpc/platforms/cell/iommu.c        |    2 +-
 arch/powerpc/platforms/ps3/system-bus.c    |    4 +-
 include/linux/dma-mapping.h                |    1 +
 18 files changed, 89 insertions(+), 352 deletions(-)

^ permalink raw reply

* [PATCH -v2 5/7] powerpc: use asm-generic/dma-mapping-common.h
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/Kconfig                   |    6 +-
 arch/powerpc/include/asm/dma-mapping.h |  242 +-------------------------------
 2 files changed, 7 insertions(+), 241 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d00131c..fb3f4ff 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -120,7 +120,7 @@ config PPC
 	select HAVE_KRETPROBES
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_LMB
-	select HAVE_DMA_ATTRS if PPC64
+	select HAVE_DMA_ATTRS
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_OPROFILE
 	select HAVE_SYSCALL_WRAPPERS if PPC64
@@ -307,10 +307,6 @@ config SWIOTLB
 	  platforms where the size of a physical address is larger
 	  than the bus address.  Not all platforms support this.
 
-config PPC_NEED_DMA_SYNC_OPS
-	def_bool y
-	depends on (NOT_COHERENT_CACHE || SWIOTLB)
-
 config HOTPLUG_CPU
 	bool "Support for enabling/disabling CPUs"
 	depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 8ca2b51..91217e4 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -14,6 +14,7 @@
 #include <linux/mm.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-attrs.h>
+#include <linux/dma-debug.h>
 #include <asm/io.h>
 #include <asm/swiotlb.h>
 
@@ -89,6 +90,11 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
 	dev->archdata.dma_ops = ops;
 }
 
+/* this will be removed soon */
+#define flush_write_buffers()
+
+#include <asm-generic/dma-mapping-common.h>
+
 static inline int dma_supported(struct device *dev, u64 mask)
 {
 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
@@ -117,87 +123,6 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 	return 0;
 }
 
-/*
- * map_/unmap_single actually call through to map/unmap_page now that all the
- * dma_map_ops have been converted over. We just have to get the page and
- * offset to pass through to map_page
- */
-static inline dma_addr_t dma_map_single_attrs(struct device *dev,
-					      void *cpu_addr,
-					      size_t size,
-					      enum dma_data_direction direction,
-					      struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	return dma_ops->map_page(dev, virt_to_page(cpu_addr),
-				 (unsigned long)cpu_addr % PAGE_SIZE, size,
-				 direction, attrs);
-}
-
-static inline void dma_unmap_single_attrs(struct device *dev,
-					  dma_addr_t dma_addr,
-					  size_t size,
-					  enum dma_data_direction direction,
-					  struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	dma_ops->unmap_page(dev, dma_addr, size, direction, attrs);
-}
-
-static inline dma_addr_t dma_map_page_attrs(struct device *dev,
-					    struct page *page,
-					    unsigned long offset, size_t size,
-					    enum dma_data_direction direction,
-					    struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	return dma_ops->map_page(dev, page, offset, size, direction, attrs);
-}
-
-static inline void dma_unmap_page_attrs(struct device *dev,
-					dma_addr_t dma_address,
-					size_t size,
-					enum dma_data_direction direction,
-					struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	dma_ops->unmap_page(dev, dma_address, size, direction, attrs);
-}
-
-static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
-				   int nents, enum dma_data_direction direction,
-				   struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-	return dma_ops->map_sg(dev, sg, nents, direction, attrs);
-}
-
-static inline void dma_unmap_sg_attrs(struct device *dev,
-				      struct scatterlist *sg,
-				      int nhwentries,
-				      enum dma_data_direction direction,
-				      struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-	dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
-}
-
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
@@ -216,161 +141,6 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
 }
 
-static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
-					size_t size,
-					enum dma_data_direction direction)
-{
-	return dma_map_single_attrs(dev, cpu_addr, size, direction, NULL);
-}
-
-static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
-				    size_t size,
-				    enum dma_data_direction direction)
-{
-	dma_unmap_single_attrs(dev, dma_addr, size, direction, NULL);
-}
-
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
-				      unsigned long offset, size_t size,
-				      enum dma_data_direction direction)
-{
-	return dma_map_page_attrs(dev, page, offset, size, direction, NULL);
-}
-
-static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-				  size_t size,
-				  enum dma_data_direction direction)
-{
-	dma_unmap_page_attrs(dev, dma_address, size, direction, NULL);
-}
-
-static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction direction)
-{
-	return dma_map_sg_attrs(dev, sg, nents, direction, NULL);
-}
-
-static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-				int nhwentries,
-				enum dma_data_direction direction)
-{
-	dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
-}
-
-#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
-static inline void dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_cpu)
-		dma_ops->sync_single_range_for_cpu(dev, dma_handle, 0,
-					   size, direction);
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_device)
-		dma_ops->sync_single_range_for_device(dev, dma_handle,
-					      0, size, direction);
-}
-
-static inline void dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_sg_for_cpu)
-		dma_ops->sync_sg_for_cpu(dev, sgl, nents, direction);
-}
-
-static inline void dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_sg_for_device)
-		dma_ops->sync_sg_for_device(dev, sgl, nents, direction);
-}
-
-static inline void dma_sync_single_range_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_cpu)
-		dma_ops->sync_single_range_for_cpu(dev, dma_handle,
-					   offset, size, direction);
-}
-
-static inline void dma_sync_single_range_for_device(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_device)
-		dma_ops->sync_single_range_for_device(dev, dma_handle, offset,
-					      size, direction);
-}
-#else /* CONFIG_PPC_NEED_DMA_SYNC_OPS */
-static inline void dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_single_range_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_single_range_for_device(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-}
-#endif
-
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 #ifdef CONFIG_PPC64
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 3/7] add set_dma_mask hook to struct dma_map_ops
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

POWERPC needs this hook. SPARC could use it too.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 include/linux/dma-mapping.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index c0f6c3c..91b7618 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -58,6 +58,7 @@ struct dma_map_ops {
 				   enum dma_data_direction dir);
 	int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
 	int (*dma_supported)(struct device *dev, u64 mask);
+	int (*set_dma_mask)(struct device *dev, u64 mask);
 	int is_phys;
 };
 
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 4/7] powerpc: use dma_map_ops struct
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

This converts uses dma_map_ops struct (in include/linux/dma-mapping.h)
instead of POWERPC homegrown dma_mapping_ops.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/include/asm/device.h       |    4 +-
 arch/powerpc/include/asm/dma-mapping.h  |   84 ++++++++-----------------------
 arch/powerpc/include/asm/pci.h          |    4 +-
 arch/powerpc/include/asm/swiotlb.h      |    2 +-
 arch/powerpc/kernel/dma-iommu.c         |    2 +-
 arch/powerpc/kernel/dma-swiotlb.c       |    2 +-
 arch/powerpc/kernel/dma.c               |    2 +-
 arch/powerpc/kernel/ibmebus.c           |    2 +-
 arch/powerpc/kernel/pci-common.c        |    6 +-
 arch/powerpc/kernel/vio.c               |    2 +-
 arch/powerpc/platforms/cell/iommu.c     |    2 +-
 arch/powerpc/platforms/ps3/system-bus.c |    4 +-
 12 files changed, 37 insertions(+), 79 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 0086f8d..67fcd7f 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -6,7 +6,7 @@
 #ifndef _ASM_POWERPC_DEVICE_H
 #define _ASM_POWERPC_DEVICE_H
 
-struct dma_mapping_ops;
+struct dma_map_ops;
 struct device_node;
 
 struct dev_archdata {
@@ -14,7 +14,7 @@ struct dev_archdata {
 	struct device_node	*of_node;
 
 	/* DMA operations on that device */
-	struct dma_mapping_ops	*dma_ops;
+	struct dma_map_ops	*dma_ops;
 	void			*dma_data;
 #ifdef CONFIG_SWIOTLB
 	dma_addr_t		max_direct_dma_addr;
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 1765c37..8ca2b51 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -64,56 +64,14 @@ static inline unsigned long device_to_mask(struct device *dev)
 }
 
 /*
- * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
- */
-struct dma_mapping_ops {
-	void *		(*alloc_coherent)(struct device *dev, size_t size,
-				dma_addr_t *dma_handle, gfp_t flag);
-	void		(*free_coherent)(struct device *dev, size_t size,
-				void *vaddr, dma_addr_t dma_handle);
-	int		(*map_sg)(struct device *dev, struct scatterlist *sg,
-				int nents, enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-	void		(*unmap_sg)(struct device *dev, struct scatterlist *sg,
-				int nents, enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-	int		(*dma_supported)(struct device *dev, u64 mask);
-	int		(*set_dma_mask)(struct device *dev, u64 dma_mask);
-	dma_addr_t 	(*map_page)(struct device *dev, struct page *page,
-				unsigned long offset, size_t size,
-				enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-	void		(*unmap_page)(struct device *dev,
-				dma_addr_t dma_address, size_t size,
-				enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
-	void            (*sync_single_range_for_cpu)(struct device *hwdev,
-				dma_addr_t dma_handle, unsigned long offset,
-				size_t size,
-				enum dma_data_direction direction);
-	void            (*sync_single_range_for_device)(struct device *hwdev,
-				dma_addr_t dma_handle, unsigned long offset,
-				size_t size,
-				enum dma_data_direction direction);
-	void            (*sync_sg_for_cpu)(struct device *hwdev,
-				struct scatterlist *sg, int nelems,
-				enum dma_data_direction direction);
-	void            (*sync_sg_for_device)(struct device *hwdev,
-				struct scatterlist *sg, int nelems,
-				enum dma_data_direction direction);
-#endif
-};
-
-/*
  * Available generic sets of operations
  */
 #ifdef CONFIG_PPC64
-extern struct dma_mapping_ops dma_iommu_ops;
+extern struct dma_map_ops dma_iommu_ops;
 #endif
-extern struct dma_mapping_ops dma_direct_ops;
+extern struct dma_map_ops dma_direct_ops;
 
-static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
+static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 {
 	/* We don't handle the NULL dev case for ISA for now. We could
 	 * do it via an out of line call but it is not needed for now. The
@@ -126,14 +84,14 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
 	return dev->archdata.dma_ops;
 }
 
-static inline void set_dma_ops(struct device *dev, struct dma_mapping_ops *ops)
+static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
 {
 	dev->archdata.dma_ops = ops;
 }
 
 static inline int dma_supported(struct device *dev, u64 mask)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	if (unlikely(dma_ops == NULL))
 		return 0;
@@ -147,7 +105,7 @@ static inline int dma_supported(struct device *dev, u64 mask)
 
 static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	if (unlikely(dma_ops == NULL))
 		return -EIO;
@@ -161,7 +119,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 
 /*
  * map_/unmap_single actually call through to map/unmap_page now that all the
- * dma_mapping_ops have been converted over. We just have to get the page and
+ * dma_map_ops have been converted over. We just have to get the page and
  * offset to pass through to map_page
  */
 static inline dma_addr_t dma_map_single_attrs(struct device *dev,
@@ -170,7 +128,7 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev,
 					      enum dma_data_direction direction,
 					      struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -185,7 +143,7 @@ static inline void dma_unmap_single_attrs(struct device *dev,
 					  enum dma_data_direction direction,
 					  struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -198,7 +156,7 @@ static inline dma_addr_t dma_map_page_attrs(struct device *dev,
 					    enum dma_data_direction direction,
 					    struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -211,7 +169,7 @@ static inline void dma_unmap_page_attrs(struct device *dev,
 					enum dma_data_direction direction,
 					struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -222,7 +180,7 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
 				   int nents, enum dma_data_direction direction,
 				   struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	return dma_ops->map_sg(dev, sg, nents, direction, attrs);
@@ -234,7 +192,7 @@ static inline void dma_unmap_sg_attrs(struct device *dev,
 				      enum dma_data_direction direction,
 				      struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
@@ -243,7 +201,7 @@ static inline void dma_unmap_sg_attrs(struct device *dev,
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
@@ -252,7 +210,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 static inline void dma_free_coherent(struct device *dev, size_t size,
 				     void *cpu_addr, dma_addr_t dma_handle)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
@@ -304,7 +262,7 @@ static inline void dma_sync_single_for_cpu(struct device *dev,
 		dma_addr_t dma_handle, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -317,7 +275,7 @@ static inline void dma_sync_single_for_device(struct device *dev,
 		dma_addr_t dma_handle, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -330,7 +288,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev,
 		struct scatterlist *sgl, int nents,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -342,7 +300,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
 		struct scatterlist *sgl, int nents,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -354,7 +312,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
 		dma_addr_t dma_handle, unsigned long offset, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -367,7 +325,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
 		dma_addr_t dma_handle, unsigned long offset, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index d9483c5..7ae46d7 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -61,8 +61,8 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 }
 
 #ifdef CONFIG_PCI
-extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
-extern struct dma_mapping_ops *get_pci_dma_ops(void);
+extern void set_pci_dma_ops(struct dma_map_ops *dma_ops);
+extern struct dma_map_ops *get_pci_dma_ops(void);
 #else	/* CONFIG_PCI */
 #define set_pci_dma_ops(d)
 #define get_pci_dma_ops()	NULL
diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 21ce0a3..8979d4c 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -13,7 +13,7 @@
 
 #include <linux/swiotlb.h>
 
-extern struct dma_mapping_ops swiotlb_dma_ops;
+extern struct dma_map_ops swiotlb_dma_ops;
 
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 2983ada..87ddb3f 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -89,7 +89,7 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
 		return 1;
 }
 
-struct dma_mapping_ops dma_iommu_ops = {
+struct dma_map_ops dma_iommu_ops = {
 	.alloc_coherent	= dma_iommu_alloc_coherent,
 	.free_coherent	= dma_iommu_free_coherent,
 	.map_sg		= dma_iommu_map_sg,
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index ca141e1..d1143a6 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -31,7 +31,7 @@ unsigned int ppc_swiotlb_enable;
  * map_page, and unmap_page on highmem, use normal dma_ops
  * for everything else.
  */
-struct dma_mapping_ops swiotlb_dma_ops = {
+struct dma_map_ops swiotlb_dma_ops = {
 	.alloc_coherent = dma_direct_alloc_coherent,
 	.free_coherent = dma_direct_free_coherent,
 	.map_sg = swiotlb_map_sg_attrs,
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 20a60d6..3e8bb9a 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -140,7 +140,7 @@ static inline void dma_direct_sync_single_range(struct device *dev,
 }
 #endif
 
-struct dma_mapping_ops dma_direct_ops = {
+struct dma_map_ops dma_direct_ops = {
 	.alloc_coherent	= dma_direct_alloc_coherent,
 	.free_coherent	= dma_direct_free_coherent,
 	.map_sg		= dma_direct_map_sg,
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 6e3f624..a4c8b38 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -127,7 +127,7 @@ static int ibmebus_dma_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static struct dma_mapping_ops ibmebus_dma_ops = {
+static struct dma_map_ops ibmebus_dma_ops = {
 	.alloc_coherent = ibmebus_alloc_coherent,
 	.free_coherent  = ibmebus_free_coherent,
 	.map_sg         = ibmebus_map_sg,
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 5a56e97..7585f1f 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,14 +50,14 @@ resource_size_t isa_mem_base;
 unsigned int ppc_pci_flags = 0;
 
 
-static struct dma_mapping_ops *pci_dma_ops = &dma_direct_ops;
+static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
 
-void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
+void set_pci_dma_ops(struct dma_map_ops *dma_ops)
 {
 	pci_dma_ops = dma_ops;
 }
 
-struct dma_mapping_ops *get_pci_dma_ops(void)
+struct dma_map_ops *get_pci_dma_ops(void)
 {
 	return pci_dma_ops;
 }
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 819e59f..bc7b41e 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -601,7 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
 	vio_cmo_dealloc(viodev, alloc_size);
 }
 
-struct dma_mapping_ops vio_dma_mapping_ops = {
+struct dma_map_ops vio_dma_mapping_ops = {
 	.alloc_coherent = vio_dma_iommu_alloc_coherent,
 	.free_coherent  = vio_dma_iommu_free_coherent,
 	.map_sg         = vio_dma_iommu_map_sg,
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 5b34fc2..416db17 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -642,7 +642,7 @@ static int dma_fixed_dma_supported(struct device *dev, u64 mask)
 
 static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask);
 
-struct dma_mapping_ops dma_iommu_fixed_ops = {
+struct dma_map_ops dma_iommu_fixed_ops = {
 	.alloc_coherent = dma_fixed_alloc_coherent,
 	.free_coherent  = dma_fixed_free_coherent,
 	.map_sg         = dma_fixed_map_sg,
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 3f763c5..02ddcc2 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -694,7 +694,7 @@ static int ps3_dma_supported(struct device *_dev, u64 mask)
 	return mask >= DMA_BIT_MASK(32);
 }
 
-static struct dma_mapping_ops ps3_sb_dma_ops = {
+static struct dma_map_ops ps3_sb_dma_ops = {
 	.alloc_coherent = ps3_alloc_coherent,
 	.free_coherent = ps3_free_coherent,
 	.map_sg = ps3_sb_map_sg,
@@ -704,7 +704,7 @@ static struct dma_mapping_ops ps3_sb_dma_ops = {
 	.unmap_page = ps3_unmap_page,
 };
 
-static struct dma_mapping_ops ps3_ioc0_dma_ops = {
+static struct dma_map_ops ps3_ioc0_dma_ops = {
 	.alloc_coherent = ps3_alloc_coherent,
 	.free_coherent = ps3_free_coherent,
 	.map_sg = ps3_ioc0_map_sg,
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 6/7] powerpc: handle SWIOTLB mapping error properly
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 arch/powerpc/include/asm/dma-mapping.h |    5 +++++
 arch/powerpc/kernel/dma-swiotlb.c      |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 91217e4..4bd41b4 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -143,6 +143,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops->mapping_error)
+		return dma_ops->mapping_error(dev, dma_addr);
+
 #ifdef CONFIG_PPC64
 	return (dma_addr == DMA_ERROR_CODE);
 #else
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index d1143a6..e96cbbd 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -42,7 +42,8 @@ struct dma_map_ops swiotlb_dma_ops = {
 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
-	.sync_sg_for_device = swiotlb_sync_sg_for_device
+	.sync_sg_for_device = swiotlb_sync_sg_for_device,
+	.mapping_error = swiotlb_dma_mapping_error,
 };
 
 void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 7/7] powerpc: add CONFIG_DMA_API_DEBUG support
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 arch/powerpc/Kconfig                   |    1 +
 arch/powerpc/include/asm/dma-mapping.h |   11 ++++++++++-
 arch/powerpc/kernel/dma.c              |   11 +++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fb3f4ff..4459b78 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -121,6 +121,7 @@ config PPC
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_LMB
 	select HAVE_DMA_ATTRS
+	select HAVE_DMA_API_DEBUG
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_OPROFILE
 	select HAVE_SYSCALL_WRAPPERS if PPC64
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 4bd41b4..cb2ca41 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -127,9 +127,15 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
+	void *cpu_addr;
 
 	BUG_ON(!dma_ops);
-	return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
+
+	cpu_addr = dma_ops->alloc_coherent(dev, size, dma_handle, flag);
+
+	debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
+
+	return cpu_addr;
 }
 
 static inline void dma_free_coherent(struct device *dev, size_t size,
@@ -138,6 +144,9 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
+
+	debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
+
 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
 }
 
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 3e8bb9a..c6d730e 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -7,6 +7,7 @@
 
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
+#include <linux/dma-debug.h>
 #include <asm/bug.h>
 #include <asm/abs_addr.h>
 
@@ -156,3 +157,13 @@ struct dma_map_ops dma_direct_ops = {
 #endif
 };
 EXPORT_SYMBOL(dma_direct_ops);
+
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+
+static int __init dma_init(void)
+{
+       dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
+
+       return 0;
+}
+fs_initcall(dma_init);
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 1/7] powerpc: remove addr_needs_map in struct dma_mapping_ops
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

This patch adds max_direct_dma_addr to struct dev_archdata to remove
addr_needs_map in struct dma_mapping_ops. It also converts
dma_capable() to use max_direct_dma_addr.

max_direct_dma_addr is initialized in pci_dma_dev_setup_swiotlb(),
called via ppc_md.pci_dma_dev_setup hook.

For further information:
http://marc.info/?t=124719060200001&r=1&w=2

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/include/asm/device.h          |    3 ++
 arch/powerpc/include/asm/dma-mapping.h     |    8 +++---
 arch/powerpc/include/asm/swiotlb.h         |    5 +--
 arch/powerpc/kernel/dma-swiotlb.c          |   36 +++++++++++----------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c   |    1 +
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    1 +
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    1 +
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    1 +
 8 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 7d2277c..0086f8d 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -16,6 +16,9 @@ struct dev_archdata {
 	/* DMA operations on that device */
 	struct dma_mapping_ops	*dma_ops;
 	void			*dma_data;
+#ifdef CONFIG_SWIOTLB
+	dma_addr_t		max_direct_dma_addr;
+#endif
 };
 
 static inline void dev_archdata_set_node(struct dev_archdata *ad,
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 0c34371..1765c37 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -87,8 +87,6 @@ struct dma_mapping_ops {
 				dma_addr_t dma_address, size_t size,
 				enum dma_data_direction direction,
 				struct dma_attrs *attrs);
-	int		(*addr_needs_map)(struct device *dev, dma_addr_t addr,
-				size_t size);
 #ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
 	void            (*sync_single_range_for_cpu)(struct device *hwdev,
 				dma_addr_t dma_handle, unsigned long offset,
@@ -426,10 +424,12 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
-	struct dma_mapping_ops *ops = get_dma_ops(dev);
+#ifdef CONFIG_SWIOTLB
+	struct dev_archdata *sd = &dev->archdata;
 
-	if (ops->addr_needs_map && ops->addr_needs_map(dev, addr, size))
+	if (sd->max_direct_dma_addr && addr + size > sd->max_direct_dma_addr)
 		return 0;
+#endif
 
 	if (!dev->dma_mask)
 		return 0;
diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 30891d6..31e0e43 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -16,12 +16,11 @@
 extern struct dma_mapping_ops swiotlb_dma_ops;
 extern struct dma_mapping_ops swiotlb_pci_dma_ops;
 
-int swiotlb_arch_address_needs_mapping(struct device *, dma_addr_t,
-				       size_t size);
-
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
 extern unsigned int ppc_swiotlb_enable;
 int __init swiotlb_setup_bus_notifier(void);
 
+extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
+
 #endif /* __ASM_SWIOTLB_H */
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index e8a57de..c9f6a30 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -25,26 +25,6 @@ int swiotlb __read_mostly;
 unsigned int ppc_swiotlb_enable;
 
 /*
- * Determine if an address is reachable by a pci device, or if we must bounce.
- */
-static int
-swiotlb_pci_addr_needs_map(struct device *hwdev, dma_addr_t addr, size_t size)
-{
-	dma_addr_t max;
-	struct pci_controller *hose;
-	struct pci_dev *pdev = to_pci_dev(hwdev);
-
-	hose = pci_bus_to_host(pdev->bus);
-	max = hose->dma_window_base_cur + hose->dma_window_size;
-
-	/* check that we're within mapped pci window space */
-	if ((addr + size > max) | (addr < hose->dma_window_base_cur))
-		return 1;
-
-	return 0;
-}
-
-/*
  * At the moment, all platforms that use this code only require
  * swiotlb to be used if we're operating on HIGHMEM.  Since
  * we don't ever call anything other than map_sg, unmap_sg,
@@ -73,22 +53,36 @@ struct dma_mapping_ops swiotlb_pci_dma_ops = {
 	.dma_supported = swiotlb_dma_supported,
 	.map_page = swiotlb_map_page,
 	.unmap_page = swiotlb_unmap_page,
-	.addr_needs_map = swiotlb_pci_addr_needs_map,
 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
 	.sync_sg_for_device = swiotlb_sync_sg_for_device
 };
 
+void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
+{
+	struct pci_controller *hose;
+	struct dev_archdata *sd;
+
+	hose = pci_bus_to_host(pdev->bus);
+	sd = &pdev->dev.archdata;
+	sd->max_direct_dma_addr =
+		hose->dma_window_base_cur + hose->dma_window_size;
+}
+
 static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
 				  unsigned long action, void *data)
 {
 	struct device *dev = data;
+	struct dev_archdata *sd;
 
 	/* We are only intereted in device addition */
 	if (action != BUS_NOTIFY_ADD_DEVICE)
 		return 0;
 
+	sd = &dev->archdata;
+	sd->max_direct_dma_addr = 0;
+
 	/* May need to bounce if the device can't address all of DRAM */
 	if (dma_get_mask(dev) < lmb_end_of_DRAM())
 		set_dma_ops(dev, &swiotlb_dma_ops);
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 055ff41..bf052c0 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -97,6 +97,7 @@ static void __init mpc8536_ds_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 849c0ac..c6f92cc 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -193,6 +193,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index bfb3283..e1f82f8 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -255,6 +255,7 @@ static void __init mpc85xx_mds_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 }
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 6632702..8032301 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -106,6 +106,7 @@ mpc86xx_hpcn_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 }
-- 
1.6.0.6

^ permalink raw reply related

* Spansion S25FL128-Flash and MTD
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) @ 2009-08-05  7:16 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

Hi,

I am trying to get a MTD running on my embedded PowerPC board. I am using a=
 Xilinx Virtex4 with an embedded PowerPC 405. In the FPGA there is a Xilinx=
 SPI controller implemented to which a Spansion S25FL128 SPI-flash (16MB) i=
s connected.

The problem is that with my setup the flash chips gets not detected and the=
 MTD partitions won't be setup.

In the kernel config I have configured the following options:

In the device drivers section:
[x] SPI support
        [x] Xilinx SPI controller
[x] Memory Technology Device (MTD) support
        [x] MTD partitioning support
        [x] Flash partition map based on OF description
        RAM/ROM/Flash chip drivers
                [x] Detect non-CFI AMD/JEDEC-compatible flash chips
        Self-contained MTD device drivers
                [x] Support most SPI Flash chips (AT26DF, M25P, W25X, ...)

As filesystem I have configured JFFS2.

In my device tree I have declared the SPI controller and the connected flas=
h as follows:

SPI_Flash: xps-spi@83400000 {
        compatible =3D "xlnx,xps-spi-2.00.b";
        interrupt-parent =3D <&int_ctrl>;
        interrupts =3D < 3 2 >;
        reg =3D < 0x83400000 0x10000 >;
        xlnx,family =3D "virtex4";
        xlnx,fifo-exist =3D <0x0>;
        xlnx,num-offchip-ss-bits =3D <0x1>;
        xlnx,num-ss-bits =3D <0x1>;
        xlnx,sck-ratio =3D <0x20>;
        #address-cells =3D <1>;
        #size-cells =3D <1>;
        nor_flash@0,1000000 {
                compatible =3D "amd,s25sl12800", "jedec-flash";
                reg =3D <0x0 0x1000000>;
                spi-max-frequency =3D <25000000>;
                bank-width =3D <1>;
                device-width =3D <1>;
                #address-cells =3D <1>;
                #size-cells =3D <1>;
                rootfs@800000 {
                        label =3D "rootfs";
                        reg =3D <0x800000 0x800000>;
                };
        };
};

When the kernel boots I can see from the console that the drivers for JFFS2=
 and the SPI controller get successfully loaded:

...
JFFS2 version 2.2. (NAND) (c) 2001-2006 Red Hat, Inc.
...
xilinx-xps-spi 83400000.xps-spi: at 0x83400000 mapped to 0xC9060000, irq=3D=
17
...

While debugging the boot process I couldn't see any calls to jedec_probe() =
resp. m25p_probe() from m25p80.c which to my understanding should be called=
 in result to a successfull match of my compatible property (jedec-flash).

The question is: What am I missing? Is there a problem with my device tree =
definition? What else am I doing wrong?

Any help is appreciated. Regards,
Matthias.

^ permalink raw reply

* Re: Spansion S25FL128-Flash and MTD
From: Benjamin Krill @ 2009-08-05  7:45 UTC (permalink / raw)
  To: EXTERNAL Lange Matthias (AA-DGW/ENG1); +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <44C5CFA72BC0E242A53B64DC1E67DEB80FB989659B@SI-MBX10.de.bosch.com>

Hi,

>                #address-cells = <1>;
>                #size-cells = <1>;
>                rootfs@800000 {

The partition must be called
	partition@...

>                        label = "rootfs";
>                        reg = <0x800000 0x800000>;
>                };
>        };
>};

cheers
 ben

^ permalink raw reply

* RE: Spansion S25FL128-Flash and MTD
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) @ 2009-08-05  8:14 UTC (permalink / raw)
  To: Benjamin Krill; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <20090805074501.GN22901@codiert.org>

> Hi,
>
> >                #address-cells =3D <1>;
> >                #size-cells =3D <1>;
> >                rootfs@800000 {
>
> The partition must be called
>       partition@...
>

Thanks, though that didn't solve my problem. The naming seems to be a bug i=
n booting-without-of.txt where the example in section "CFI or JEDEC memory-=
mapped NOR flash" uses "firmware" as the node name.

Regards,
Matthias.

^ permalink raw reply

* Re: 2.6.31-rc5-git2 crash on a idle system.
From: Sachin Sant @ 2009-08-05  9:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: neilb, linuxppc-dev, linux-raid
In-Reply-To: <1249421223.18245.36.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

Benjamin Herrenschmidt wrote:
> On Tue, 2009-08-04 at 17:57 +0530, Sachin Sant wrote:
>   
>> I have a power6 blade [IBM,7998-61X] running 2.6.31-rc5-git2
>> kernel (a33a052f19a21d727847391c8c1aff3fb221c472). After some
>> period of inactivity the machine drops into xmon with following
>> traces.
>>     
>
> Looks like code has been overwritten with data. Would be useful
> to try to track down when that happens.
>
> Ben.
2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) works fine
on this box without any problem. So the problem was introduced between
2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) and
2.6.31-rc5-git2 (a33a052f19a21d727847391c8c1aff3fb221c472).

Looking at the changelog all the changes are confined to
drivers/md/ directory ( probably following five commits ). I do have
all the CONFIG_MD* options enabled in my kernel.

449aad3e25358812c43afc60918c5ad3819488e7
70471dafe3390243c598a3165dfb86b8b8b3f4fe
3673f305faf1bc66ead751344f8262ace851ff44
3a981b03f38dc3b8a69b77cbc679e66c1318a44a
ac5e7113e74872928844d00085bd47c988f12728

I will try to find out the exact commit.

Thanks
-Sachin


-- 

---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------


[-- Attachment #2: rc5-git2-log --]
[-- Type: text/plain, Size: 19467 bytes --]

[root@mjs22lp1 home]# cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
    pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
    lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
    sp: c00000000ffffd10
   msr: 8000000000089032
  current = 0xc000000000f58b70
  paca    = 0xc0000000010b2400
    pid   = 0, comm = swapper
enter ? for help
[c00000000ffffda0] c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
[c00000000ffffea0] c0000000000be8a0 .__do_softirq+0x174/0x2c8
[c00000000fffff90] c0000000000307b0 .call_do_softirq+0x14/0x24
[c000000001013870] c00000000000ecf8 .do_softirq+0xa0/0x104
[c000000001013910] c0000000000be1d0 .irq_exit+0x74/0xd4
[c000000001013990] c00000000002ce20 .timer_interrupt+0x1cc/0x200
[c000000001013a30] c000000000003728 decrementer_common+0x128/0x180
--- Exception: 901 (Decrementer) at c00000000000ec3c .raw_local_irq_restore+0xc0/0xdc
[c000000001013dc0] c000000000015824 .cpu_idle+0x13c/0x1e0
[c000000001013e60] c000000000009fe8 .rest_init+0x94/0xcc
[c000000001013ee0] c000000000990cf4 .start_kernel+0x484/0x4a8
[c000000001013f90] c000000000008408 .start_here_common+0x2c/0xa4
0:mon> e
cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
    pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
    lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
    sp: c00000000ffffd10
   msr: 8000000000089032
  current = 0xc000000000f58b70
  paca    = 0xc0000000010b2400
    pid   = 0, comm = swapper
0:mon> di c000000000600000 
c000000000600000  00001010      .long 0x1010
c000000000600004  00000008      .long 0x8
c000000000600008  00001013      .long 0x1013
c00000000060000c  0000000f      .long 0xf
c000000000600010  7961626f      rldimi. r1,r11,44,41
c000000000600014  6f740000      xoris   r20,r27,0
c000000000600018  00101600      .long 0x101600
c00000000060001c  00000c00      .long 0xc00
c000000000600020  00000400      .long 0x400
c000000000600024  00101100      .long 0x101100
c000000000600028  000008e9      .long 0x8e9
c00000000060002c  60000000      nop
c000000000600030  e93e8050      ld      r9,-32688(r30)
c000000000600034  7c6507b4      extsw   r5,r3
c000000000600038  78ab4da4      rldicr  r11,r5,9,54
c00000000060003c  396b0040      addi    r11,r11,64
0:mon> r
R00 = c0000000000c6038   R16 = 0000000000000000
R01 = c00000000ffffd10   R17 = 0000000000000100
R02 = c000000001011110   R18 = c000000001059300
R03 = 0000000000000000   R19 = c000000001102f98
R04 = c00000000ffffd60   R20 = c000000001103398
R05 = ffffffffffffffff   R21 = c000000001103798
R06 = 0000000000000700   R22 = c000000001103b98
R07 = 0000000000000001   R23 = 0000000000000000
R08 = 0000000000830000   R24 = c00000000fffc000
R09 = c00000000072f890   R25 = 0000000000000000
R10 = c00000000120fbf8   R26 = 0000000000200200
R11 = c000000000600090   R27 = c00000000ffffe10
R12 = 0000000028000022   R28 = 0000000000000001
R13 = c0000000010b2400   R29 = c0000000010805e8
R14 = 0000000000382800   R30 = c000000000fb4f78
R15 = 0000000000000000   R31 = c00000000ffffd10
pc  = c000000000600000 .flow_cache_new_hashrnd+0x3c/0xcc
lr  = c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
msr = 8000000000089032   cr  = 28000024
ctr = c0000000005fffc4   xer = 0000000000000000   trap =  700
0:mon> dl
<6>Phyp-dump disabled at boot time
<6>Using pSeries machine description
<7>Page orders: linear mapping = 24, virtual = 16, io = 12, vmemmap = 24
<6>Using 1TB segments
<4>Found initrd at 0xc000000002000000:0xc000000002382800
<6>console [udbg0] enabled
<6>Partition configured for 8 cpus.
<6>CPU maps initialized for 2 threads per core
<7> (thread shift is 1)
<4>Starting Linux PPC64 #1 SMP Tue Aug 4 12:15:55 IST 2009
<4>-----------------------------------------------------
<4>ppc64_pft_size                = 0x1a
<4>physicalMemorySize            = 0xa0000000
<4>htab_hash_mask                = 0x7ffff
<4>-----------------------------------------------------
<6>Initializing cgroup subsys cpuset
<6>Initializing cgroup subsys cpu
<5>Linux version 2.6.31-rc5-git2 (root@mjs22lp1) (gcc version 4.4.0 20090307 (Red Hat 4.4.0-0.23) (GCC) ) #1 SMP Tue Aug 4 12:15:55 IST 2009
<4>[boot]0012 Setup Arch
<7>Node 0 Memory: 0x0-0x54000000
<7>Node 1 Memory: 0x54000000-0xa0000000
<4>EEH: No capable adapters found
<6>PPC64 nvram contains 15360 bytes
<7>Using shared processor idle loop
<4>Zone PFN ranges:
<4>  DMA      0x00000000 -> 0x0000a000
<4>  Normal   0x0000a000 -> 0x0000a000
<4>Movable zone start PFN for each node
<4>early_node_map[2] active PFN ranges
<4>    0: 0x00000000 -> 0x00005400
<4>    1: 0x00005400 -> 0x0000a000
<7>On node 0 totalpages: 21504
<7>  DMA zone: 19 pages used for memmap
<7>  DMA zone: 0 pages reserved
<7>  DMA zone: 21485 pages, LIFO batch:1
<7>On node 1 totalpages: 19456
<7>  DMA zone: 17 pages used for memmap
<7>  DMA zone: 0 pages reserved
<7>  DMA zone: 19439 pages, LIFO batch:1
<4>[boot]0015 Setup Done
<4>Built 2 zonelists in Node order, mobility grouping on.  Total pages: 40924
<4>Policy zone: DMA
<5>Kernel command line: ro console=hvc0 root=UUID=9448b379-7842-486c-8bc8-22a1427c4462 
<4>PID hash table entries: 4096 (order: 12, 32768 bytes)
<4>freeing bootmem node 0
<4>freeing bootmem node 1
<6>Memory: 2570560k/2621440k available (15296k kernel code, 50880k reserved, 1152k data, 1488k bss, 5504k init)
<6>SLUB: Genslabs=18, HWalign=128, Order=0-3, MinObjects=0, CPUs=8, Nodes=16
<6>Hierarchical RCU implementation.
<6>NR_IRQS:512
<4>[boot]0020 XICS Init
<4>[boot]0021 XICS Done
<7>pic: no ISA interrupt controller
<7>time_init: decrementer frequency = 512.000000 MHz
<7>time_init: processor frequency   = 4005.000000 MHz
<6>clocksource: timebase mult[7d0000] shift[22] registered
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[0]
<4>Console: colour dummy device 80x25
<6>console handover: boot [udbg0] -> real [hvc0]
<6>allocated 1638400 bytes of page_cgroup
<6>please try 'cgroup_disable=memory' option if you don't want memory cgroups
<6>Security Framework initialized
<6>SELinux:  Initializing.
<7>SELinux:  Starting in permissive mode
<6>Dentry cache hash table entries: 524288 (order: 6, 4194304 bytes)
<6>Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
<4>Mount-cache hash table entries: 4096
<6>Initializing cgroup subsys ns
<6>Initializing cgroup subsys cpuacct
<6>Initializing cgroup subsys memory
<6>Initializing cgroup subsys devices
<6>Initializing cgroup subsys freezer
<6>Initializing cgroup subsys net_cls
<6>ftrace: allocating 19543 entries in 8 pages
<7>irq: irq 2 on host null mapped to virtual irq 16
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[1]
<4>Processor 1 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[2]
<4>Processor 2 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[3]
<4>Processor 3 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[4]
<4>Processor 4 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[5]
<4>Processor 5 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[6]
<4>Processor 6 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[7]
<4>Processor 7 found.
<6>Brought up 8 CPUs
<7>Node 0 CPUs: 0-7
<7>Node 1 CPUs:
<7>CPU0 attaching sched-domain:
<7> domain 0: span 0-1 level SIBLING
<7>  groups: 0 1
<7>  domain 1: span 0-7 level CPU
<7>   groups: 0-1 2-3 4-5 6-7
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU1 attaching sched-domain:
<7> domain 0: span 0-1 level SIBLING
<7>  groups: 1 0
<7>  domain 1: span 0-7 level CPU
<7>   groups: 0-1 2-3 4-5 6-7
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU2 attaching sched-domain:
<7> domain 0: span 2-3 level SIBLING
<7>  groups: 2 3
<7>  domain 1: span 0-7 level CPU
<7>   groups: 2-3 4-5 6-7 0-1
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU3 attaching sched-domain:
<7> domain 0: span 2-3 level SIBLING
<7>  groups: 3 2
<7>  domain 1: span 0-7 level CPU
<7>   groups: 2-3 4-5 6-7 0-1
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU4 attaching sched-domain:
<7> domain 0: span 4-5 level SIBLING
<7>  groups: 4 5
<7>  domain 1: span 0-7 level CPU
<7>   groups: 4-5 6-7 0-1 2-3
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU5 attaching sched-domain:
<7> domain 0: span 4-5 level SIBLING
<7>  groups: 5 4
<7>  domain 1: span 0-7 level CPU
<7>   groups: 4-5 6-7 0-1 2-3
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU6 attaching sched-domain:
<7> domain 0: span 6-7 level SIBLING
<7>  groups: 6 7
<7>  domain 1: span 0-7 level CPU
<7>   groups: 6-7 0-1 2-3 4-5
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU7 attaching sched-domain:
<7> domain 0: span 6-7 level SIBLING
<7>  groups: 7 6
<7>  domain 1: span 0-7 level CPU
<7>   groups: 6-7 0-1 2-3 4-5
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<6>regulator: core version 0.5
<6>NET: Registered protocol family 16
<6>IBM eBus Device Driver
<6>POWER6 performance monitor hardware support registered
<6>PCI: Probing PCI hardware
<7>PCI: Probing PCI hardware done
<4>bio: create slab <bio-0> at 0
<5>SCSI subsystem initialized
<7>libata version 3.00 loaded.
<6>usbcore: registered new interface driver usbfs
<6>usbcore: registered new interface driver hub
<6>usbcore: registered new device driver usb
<6>NetLabel: Initializing
<6>NetLabel:  domain hash size = 128
<6>NetLabel:  protocols = UNLABELED CIPSOv4
<6>NetLabel:  unlabeled traffic allowed by default
<7>Switched to high resolution mode on CPU 0
<7>Switched to high resolution mode on CPU 3
<7>Switched to high resolution mode on CPU 4
<7>Switched to high resolution mode on CPU 5
<7>Switched to high resolution mode on CPU 1
<7>Switched to high resolution mode on CPU 6
<7>Switched to high resolution mode on CPU 2
<7>Switched to high resolution mode on CPU 7
<6>NET: Registered protocol family 2
<6>IP route cache hash table entries: 32768 (order: 2, 262144 bytes)
<6>TCP established hash table entries: 131072 (order: 5, 2097152 bytes)
<6>TCP bind hash table entries: 65536 (order: 4, 1048576 bytes)
<6>TCP: Hash tables configured (established 131072 bind 65536)
<6>TCP reno registered
<6>NET: Registered protocol family 1
<6>Trying to unpack rootfs image as initramfs...
<4>Freeing initrd memory: 3594k freed
<7>irq: irq 655360 on host null mapped to virtual irq 17
<7>irq: irq 655362 on host null mapped to virtual irq 18
<6>IOMMU table initialized, virtual merging enabled
<7>irq: irq 655364 on host null mapped to virtual irq 19
<7>irq: irq 655365 on host null mapped to virtual irq 20
<7>irq: irq 589825 on host null mapped to virtual irq 21
<7>RTAS daemon started
<7>RTAS: event: 23, Type: Platform Information Event, Severity: 1
<6>audit: initializing netlink socket (disabled)
<5>type=2000 audit(1249386596.125:1): initialized
<6>HugeTLB registered 16 MB page size, pre-allocated 0 pages
<6>HugeTLB registered 16 GB page size, pre-allocated 0 pages
<5>VFS: Disk quotas dquot_6.5.2
<4>Dquot-cache hash table entries: 8192 (order 0, 65536 bytes)
<6>msgmni has been set to 5024
<7>SELinux:  Registering netfilter hooks
<6>alg: No test for stdrng (krng)
<6>Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
<6>io scheduler noop registered
<6>io scheduler anticipatory registered
<6>io scheduler deadline registered
<6>io scheduler cfq registered (default)
<6>pci_hotplug: PCI Hot Plug PCI Core version: 0.5
<6>pciehp: PCI Express Hot Plug Controller Driver version: 0.4
<7>vio_register_driver: driver hvc_console registering
<7>HVSI: registered 0 devices
<6>Linux agpgart interface v0.103
<6>Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
<4>Platform driver 'serial8250' needs updating - please use dev_pm_ops
<6>TX39/49 Serial driver version 1.11
<4>Platform driver 'serial_txx9' needs updating - please use dev_pm_ops
<6>brd: module loaded
<6>loop: module loaded
<6>input: Macintosh mouse button emulation as /devices/virtual/input/input0
<6>Uniform Multi-Platform E-IDE driver
<6>ide-gd driver 1.18
<6>Fixed MDIO Bus: probed
<6>ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
<6>ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
<6>uhci_hcd: USB Universal Host Controller Interface driver
<6>mice: PS/2 mouse device common for all mice
<6>device-mapper: uevent: version 1.0.3
<6>device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
<6>usbcore: registered new interface driver hiddev
<6>usbcore: registered new interface driver usbhid
<6>usbhid: v2.6:USB HID core driver
<4>nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
<4>CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use
<4>nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or
<4>sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
<6>ip_tables: (C) 2000-2006 Netfilter Core Team
<6>TCP cubic registered
<6>Initializing XFRM netlink socket
<6>NET: Registered protocol family 17
<7>Running MSI bitmap self-tests ...
<7>PM: Resume from disk failed.
<4>registered taskstats version 1
<6>Initalizing network drop monitor service
<4>Freeing unused kernel memory: 5504k freed
<7>vio_register_driver: driver ibmvscsi registering
<6>ibmvscsi 30000002: SRP_VERSION: 16.a
<6>scsi0 : IBM POWER Virtual SCSI Adapter 1.5.8
<6>ibmvscsi 30000002: partner initialization complete
<6>ibmvscsi 30000002: host srp version: 16.a, host partition 06-1C12A (1), OS 3, max io 262144
<6>ibmvscsi 30000002: Client reserve enabled
<6>ibmvscsi 30000002: sent SRP login
<6>ibmvscsi 30000002: SRP_LOGIN succeeded
<5>scsi 0:0:1:0: Direct-Access     AIX      VDASD            0001 PQ: 0 ANSI: 3
<5>scsi 0:0:2:0: CD-ROM            AIX      VOPTA                 PQ: 0 ANSI: 4
<6>scsi: waiting for bus probes to complete ...
<5>sd 0:0:1:0: Attached scsi generic sg0 type 0
<5>sd 0:0:1:0: [sda] 147324928 512-byte logical blocks: (75.4 GB/70.2 GiB)
<5>sd 0:0:1:0: [sda] Write Protect is off
<7>sd 0:0:1:0: [sda] Mode Sense: 17 00 00 08
<5>sd 0:0:1:0: [sda] Cache data unavailable
<3>sd 0:0:1:0: [sda] Assuming drive cache: write through
<4>sr0: scsi-1 drive
<6>Uniform CD-ROM driver Revision: 3.20
<7>sr 0:0:2:0: Attached scsi CD-ROM sr0
<5>sr 0:0:2:0: Attached scsi generic sg1 type 5
<5>sd 0:0:1:0: [sda] Cache data unavailable
<3>sd 0:0:1:0: [sda] Assuming drive cache: write through
<6> sda: sda1 sda2 sda3 sda4 < sda5 sda6 sda7 sda8 >
<5>sd 0:0:1:0: [sda] Cache data unavailable
<3>sd 0:0:1:0: [sda] Assuming drive cache: write through
<5>sd 0:0:1:0: [sda] Attached SCSI disk
<6>EXT4-fs (sda3): INFO: recovery required on readonly filesystem
<6>EXT4-fs (sda3): write access will be enabled during recovery
<6>EXT4-fs (sda3): barriers enabled
<6>kjournald2 starting: pid 126, dev sda3:8, commit interval 5 seconds
<6>EXT4-fs (sda3): delayed allocation enabled
<6>EXT4-fs: file extents enabled
<6>EXT4-fs: mballoc enabled
<6>EXT4-fs (sda3): recovery complete
<6>EXT4-fs (sda3): mounted filesystem with ordered data mode
<5>type=1404 audit(1249386597.188:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
<7>SELinux: 8192 avtab hash slots, 117789 rules.
<7>SELinux: 8192 avtab hash slots, 117789 rules.
<7>SELinux:  8 users, 13 roles, 2653 types, 121 bools, 1 sens, 1024 cats
<7>SELinux:  74 classes, 117789 rules
<7>SELinux:  Completing initialization.
<7>SELinux:  Setting up existing superblocks.
<7>SELinux: initialized (dev sda3, type ext4), uses xattr
<7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<7>SELinux: initialized (dev selinuxfs, type selinuxfs), uses genfs_contexts
<7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
<7>SELinux: initialized (dev hugetlbfs, type hugetlbfs), uses genfs_contexts
<7>SELinux: initialized (dev devpts, type devpts), uses transition SIDs
<7>SELinux: initialized (dev inotifyfs, type inotifyfs), uses genfs_contexts
<7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<7>SELinux: initialized (dev anon_inodefs, type anon_inodefs), uses genfs_contexts
<7>SELinux: initialized (dev pipefs, type pipefs), uses task SIDs
<7>SELinux: initialized (dev debugfs, type debugfs), uses genfs_contexts
<7>SELinux: initialized (dev sockfs, type sockfs), uses task SIDs
<7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
<7>SELinux: initialized (dev bdev, type bdev), uses genfs_contexts
<7>SELinux: initialized (dev rootfs, type rootfs), uses genfs_contexts
<7>SELinux: initialized (dev sysfs, type sysfs), uses genfs_contexts
<5>type=1403 audit(1249386597.481:3): policy loaded auid=4294967295 ses=4294967295
<6>udev: starting version 141
<7>drivers/net/ibmveth.c: ibmveth: IBM i/pSeries Virtual Ethernet Driver 1.03
<7>vio_register_driver: driver ibmveth registering
<6>IBM eHEA ethernet device driver (Release EHEA_0101)
<7>irq: irq 590080 on host null mapped to virtual irq 256
<6>ehea: eth0: Jumbo frames are enabled
<6>ehea: eth0 -> logical port id #3
<6>ehea: eth2: Jumbo frames are enabled
<6>ehea: eth2 -> logical port id #4
<6>udev: renamed network interface eth1 to eth3
<6>udev: renamed network interface eth0_rename to eth1
<6>device-mapper: multipath: version 1.1.0 loaded
<6>EXT4-fs (sda3): internal journal on sda3:8
<6>kjournald starting.  Commit interval 5 seconds
<6>EXT3 FS on sda2, internal journal
<6>EXT3-fs: mounted filesystem with writeback data mode.
<7>SELinux: initialized (dev sda2, type ext3), uses xattr
<7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<7>SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts
<6>NET: Registered protocol family 10
<6>lo: Disabled Privacy Extensions
<6>RPC: Registered udp transport module.
<6>RPC: Registered tcp transport module.
<7>SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
<7>irq: irq 779 on host null mapped to virtual irq 267
<6>ehea: eth2: Physical port up
<6>ehea: External switch port is backup port
<7>irq: irq 780 on host null mapped to virtual irq 268
<7>irq: irq 781 on host null mapped to virtual irq 269
<6>ehea: eth0: Physical port up
<6>ehea: External switch port is backup port
<7>irq: irq 782 on host null mapped to virtual irq 270
<6>Bluetooth: Core ver 2.15
<6>NET: Registered protocol family 31
<6>Bluetooth: HCI device and connection manager initialized
<6>Bluetooth: HCI socket layer initialized
<6>Bluetooth: L2CAP ver 2.13
<6>Bluetooth: L2CAP socket layer initialized
<6>Bluetooth: BNEP (Ethernet Emulation) ver 1.3
<6>Bluetooth: BNEP filters: protocol multicast
<6>Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
<7>SELinux: initialized (dev nfsd, type nfsd), uses genfs_contexts
<4>NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
<6>NFSD: starting 90-second grace period
<5>Bridge firewalling registered
<6>Bluetooth: SCO (Voice Link) ver 0.6
<6>Bluetooth: SCO socket layer initialized
<6>virbr0: starting userspace STP failed, starting kernel STP
<7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
<7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
<7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
<6>lo: Disabled Privacy Extensions
<7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
<7>eth0: no IPv6 routers present
<7>eth2: no IPv6 routers present
<7>eth1: no IPv6 routers present
<7>eth3: no IPv6 routers present
<7>virbr0: no IPv6 routers present
0:mon> 


^ permalink raw reply

* Re: 2.6.31-rc5-git2 crash on a idle system.
From: Benjamin Herrenschmidt @ 2009-08-05  9:52 UTC (permalink / raw)
  To: Sachin Sant; +Cc: neilb, linuxppc-dev, linux-raid
In-Reply-To: <4A794E26.8080207@in.ibm.com>


> 2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) works fine
> on this box without any problem. So the problem was introduced between
> 2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) and
> 2.6.31-rc5-git2 (a33a052f19a21d727847391c8c1aff3fb221c472).
> 
> Looking at the changelog all the changes are confined to
> drivers/md/ directory ( probably following five commits ). I do have
> all the CONFIG_MD* options enabled in my kernel.
> 
> 449aad3e25358812c43afc60918c5ad3819488e7
> 70471dafe3390243c598a3165dfb86b8b8b3f4fe
> 3673f305faf1bc66ead751344f8262ace851ff44
> 3a981b03f38dc3b8a69b77cbc679e66c1318a44a
> ac5e7113e74872928844d00085bd47c988f12728
> 
> I will try to find out the exact commit.

Thanks. Since it's a memory corruption (or seems to be) however, it's
possible that the bisection will mislead you. IE. The culprit could be
somewhere else, and the commit you'll find via bisection just happens to
move things around in the kernel in such a way that the corruption hits
that code path instead of another rarely used one.

I would suggest using printk to print out the content of memory where
the code appears to have been smashed at different stages during boot
(maybe even in the initcalls loop in init/main.c) to try to point out
what appears to be causing the corruption.

Cheers,
Ben.

> Thanks
> -Sachin
> 
> 
> plain text document attachment (rc5-git2-log)
> [root@mjs22lp1 home]# cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
>     pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
>     lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
>     sp: c00000000ffffd10
>    msr: 8000000000089032
>   current = 0xc000000000f58b70
>   paca    = 0xc0000000010b2400
>     pid   = 0, comm = swapper
> enter ? for help
> [c00000000ffffda0] c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
> [c00000000ffffea0] c0000000000be8a0 .__do_softirq+0x174/0x2c8
> [c00000000fffff90] c0000000000307b0 .call_do_softirq+0x14/0x24
> [c000000001013870] c00000000000ecf8 .do_softirq+0xa0/0x104
> [c000000001013910] c0000000000be1d0 .irq_exit+0x74/0xd4
> [c000000001013990] c00000000002ce20 .timer_interrupt+0x1cc/0x200
> [c000000001013a30] c000000000003728 decrementer_common+0x128/0x180
> --- Exception: 901 (Decrementer) at c00000000000ec3c .raw_local_irq_restore+0xc0/0xdc
> [c000000001013dc0] c000000000015824 .cpu_idle+0x13c/0x1e0
> [c000000001013e60] c000000000009fe8 .rest_init+0x94/0xcc
> [c000000001013ee0] c000000000990cf4 .start_kernel+0x484/0x4a8
> [c000000001013f90] c000000000008408 .start_here_common+0x2c/0xa4
> 0:mon> e
> cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
>     pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
>     lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
>     sp: c00000000ffffd10
>    msr: 8000000000089032
>   current = 0xc000000000f58b70
>   paca    = 0xc0000000010b2400
>     pid   = 0, comm = swapper
> 0:mon> di c000000000600000 
> c000000000600000  00001010      .long 0x1010
> c000000000600004  00000008      .long 0x8
> c000000000600008  00001013      .long 0x1013
> c00000000060000c  0000000f      .long 0xf
> c000000000600010  7961626f      rldimi. r1,r11,44,41
> c000000000600014  6f740000      xoris   r20,r27,0
> c000000000600018  00101600      .long 0x101600
> c00000000060001c  00000c00      .long 0xc00
> c000000000600020  00000400      .long 0x400
> c000000000600024  00101100      .long 0x101100
> c000000000600028  000008e9      .long 0x8e9
> c00000000060002c  60000000      nop
> c000000000600030  e93e8050      ld      r9,-32688(r30)
> c000000000600034  7c6507b4      extsw   r5,r3
> c000000000600038  78ab4da4      rldicr  r11,r5,9,54
> c00000000060003c  396b0040      addi    r11,r11,64
> 0:mon> r
> R00 = c0000000000c6038   R16 = 0000000000000000
> R01 = c00000000ffffd10   R17 = 0000000000000100
> R02 = c000000001011110   R18 = c000000001059300
> R03 = 0000000000000000   R19 = c000000001102f98
> R04 = c00000000ffffd60   R20 = c000000001103398
> R05 = ffffffffffffffff   R21 = c000000001103798
> R06 = 0000000000000700   R22 = c000000001103b98
> R07 = 0000000000000001   R23 = 0000000000000000
> R08 = 0000000000830000   R24 = c00000000fffc000
> R09 = c00000000072f890   R25 = 0000000000000000
> R10 = c00000000120fbf8   R26 = 0000000000200200
> R11 = c000000000600090   R27 = c00000000ffffe10
> R12 = 0000000028000022   R28 = 0000000000000001
> R13 = c0000000010b2400   R29 = c0000000010805e8
> R14 = 0000000000382800   R30 = c000000000fb4f78
> R15 = 0000000000000000   R31 = c00000000ffffd10
> pc  = c000000000600000 .flow_cache_new_hashrnd+0x3c/0xcc
> lr  = c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
> msr = 8000000000089032   cr  = 28000024
> ctr = c0000000005fffc4   xer = 0000000000000000   trap =  700
> 0:mon> dl
> <6>Phyp-dump disabled at boot time
> <6>Using pSeries machine description
> <7>Page orders: linear mapping = 24, virtual = 16, io = 12, vmemmap = 24
> <6>Using 1TB segments
> <4>Found initrd at 0xc000000002000000:0xc000000002382800
> <6>console [udbg0] enabled
> <6>Partition configured for 8 cpus.
> <6>CPU maps initialized for 2 threads per core
> <7> (thread shift is 1)
> <4>Starting Linux PPC64 #1 SMP Tue Aug 4 12:15:55 IST 2009
> <4>-----------------------------------------------------
> <4>ppc64_pft_size                = 0x1a
> <4>physicalMemorySize            = 0xa0000000
> <4>htab_hash_mask                = 0x7ffff
> <4>-----------------------------------------------------
> <6>Initializing cgroup subsys cpuset
> <6>Initializing cgroup subsys cpu
> <5>Linux version 2.6.31-rc5-git2 (root@mjs22lp1) (gcc version 4.4.0 20090307 (Red Hat 4.4.0-0.23) (GCC) ) #1 SMP Tue Aug 4 12:15:55 IST 2009
> <4>[boot]0012 Setup Arch
> <7>Node 0 Memory: 0x0-0x54000000
> <7>Node 1 Memory: 0x54000000-0xa0000000
> <4>EEH: No capable adapters found
> <6>PPC64 nvram contains 15360 bytes
> <7>Using shared processor idle loop
> <4>Zone PFN ranges:
> <4>  DMA      0x00000000 -> 0x0000a000
> <4>  Normal   0x0000a000 -> 0x0000a000
> <4>Movable zone start PFN for each node
> <4>early_node_map[2] active PFN ranges
> <4>    0: 0x00000000 -> 0x00005400
> <4>    1: 0x00005400 -> 0x0000a000
> <7>On node 0 totalpages: 21504
> <7>  DMA zone: 19 pages used for memmap
> <7>  DMA zone: 0 pages reserved
> <7>  DMA zone: 21485 pages, LIFO batch:1
> <7>On node 1 totalpages: 19456
> <7>  DMA zone: 17 pages used for memmap
> <7>  DMA zone: 0 pages reserved
> <7>  DMA zone: 19439 pages, LIFO batch:1
> <4>[boot]0015 Setup Done
> <4>Built 2 zonelists in Node order, mobility grouping on.  Total pages: 40924
> <4>Policy zone: DMA
> <5>Kernel command line: ro console=hvc0 root=UUID=9448b379-7842-486c-8bc8-22a1427c4462 
> <4>PID hash table entries: 4096 (order: 12, 32768 bytes)
> <4>freeing bootmem node 0
> <4>freeing bootmem node 1
> <6>Memory: 2570560k/2621440k available (15296k kernel code, 50880k reserved, 1152k data, 1488k bss, 5504k init)
> <6>SLUB: Genslabs=18, HWalign=128, Order=0-3, MinObjects=0, CPUs=8, Nodes=16
> <6>Hierarchical RCU implementation.
> <6>NR_IRQS:512
> <4>[boot]0020 XICS Init
> <4>[boot]0021 XICS Done
> <7>pic: no ISA interrupt controller
> <7>time_init: decrementer frequency = 512.000000 MHz
> <7>time_init: processor frequency   = 4005.000000 MHz
> <6>clocksource: timebase mult[7d0000] shift[22] registered
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[0]
> <4>Console: colour dummy device 80x25
> <6>console handover: boot [udbg0] -> real [hvc0]
> <6>allocated 1638400 bytes of page_cgroup
> <6>please try 'cgroup_disable=memory' option if you don't want memory cgroups
> <6>Security Framework initialized
> <6>SELinux:  Initializing.
> <7>SELinux:  Starting in permissive mode
> <6>Dentry cache hash table entries: 524288 (order: 6, 4194304 bytes)
> <6>Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
> <4>Mount-cache hash table entries: 4096
> <6>Initializing cgroup subsys ns
> <6>Initializing cgroup subsys cpuacct
> <6>Initializing cgroup subsys memory
> <6>Initializing cgroup subsys devices
> <6>Initializing cgroup subsys freezer
> <6>Initializing cgroup subsys net_cls
> <6>ftrace: allocating 19543 entries in 8 pages
> <7>irq: irq 2 on host null mapped to virtual irq 16
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[1]
> <4>Processor 1 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[2]
> <4>Processor 2 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[3]
> <4>Processor 3 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[4]
> <4>Processor 4 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[5]
> <4>Processor 5 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[6]
> <4>Processor 6 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[7]
> <4>Processor 7 found.
> <6>Brought up 8 CPUs
> <7>Node 0 CPUs: 0-7
> <7>Node 1 CPUs:
> <7>CPU0 attaching sched-domain:
> <7> domain 0: span 0-1 level SIBLING
> <7>  groups: 0 1
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 0-1 2-3 4-5 6-7
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU1 attaching sched-domain:
> <7> domain 0: span 0-1 level SIBLING
> <7>  groups: 1 0
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 0-1 2-3 4-5 6-7
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU2 attaching sched-domain:
> <7> domain 0: span 2-3 level SIBLING
> <7>  groups: 2 3
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 2-3 4-5 6-7 0-1
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU3 attaching sched-domain:
> <7> domain 0: span 2-3 level SIBLING
> <7>  groups: 3 2
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 2-3 4-5 6-7 0-1
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU4 attaching sched-domain:
> <7> domain 0: span 4-5 level SIBLING
> <7>  groups: 4 5
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 4-5 6-7 0-1 2-3
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU5 attaching sched-domain:
> <7> domain 0: span 4-5 level SIBLING
> <7>  groups: 5 4
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 4-5 6-7 0-1 2-3
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU6 attaching sched-domain:
> <7> domain 0: span 6-7 level SIBLING
> <7>  groups: 6 7
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 6-7 0-1 2-3 4-5
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU7 attaching sched-domain:
> <7> domain 0: span 6-7 level SIBLING
> <7>  groups: 7 6
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 6-7 0-1 2-3 4-5
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <6>regulator: core version 0.5
> <6>NET: Registered protocol family 16
> <6>IBM eBus Device Driver
> <6>POWER6 performance monitor hardware support registered
> <6>PCI: Probing PCI hardware
> <7>PCI: Probing PCI hardware done
> <4>bio: create slab <bio-0> at 0
> <5>SCSI subsystem initialized
> <7>libata version 3.00 loaded.
> <6>usbcore: registered new interface driver usbfs
> <6>usbcore: registered new interface driver hub
> <6>usbcore: registered new device driver usb
> <6>NetLabel: Initializing
> <6>NetLabel:  domain hash size = 128
> <6>NetLabel:  protocols = UNLABELED CIPSOv4
> <6>NetLabel:  unlabeled traffic allowed by default
> <7>Switched to high resolution mode on CPU 0
> <7>Switched to high resolution mode on CPU 3
> <7>Switched to high resolution mode on CPU 4
> <7>Switched to high resolution mode on CPU 5
> <7>Switched to high resolution mode on CPU 1
> <7>Switched to high resolution mode on CPU 6
> <7>Switched to high resolution mode on CPU 2
> <7>Switched to high resolution mode on CPU 7
> <6>NET: Registered protocol family 2
> <6>IP route cache hash table entries: 32768 (order: 2, 262144 bytes)
> <6>TCP established hash table entries: 131072 (order: 5, 2097152 bytes)
> <6>TCP bind hash table entries: 65536 (order: 4, 1048576 bytes)
> <6>TCP: Hash tables configured (established 131072 bind 65536)
> <6>TCP reno registered
> <6>NET: Registered protocol family 1
> <6>Trying to unpack rootfs image as initramfs...
> <4>Freeing initrd memory: 3594k freed
> <7>irq: irq 655360 on host null mapped to virtual irq 17
> <7>irq: irq 655362 on host null mapped to virtual irq 18
> <6>IOMMU table initialized, virtual merging enabled
> <7>irq: irq 655364 on host null mapped to virtual irq 19
> <7>irq: irq 655365 on host null mapped to virtual irq 20
> <7>irq: irq 589825 on host null mapped to virtual irq 21
> <7>RTAS daemon started
> <7>RTAS: event: 23, Type: Platform Information Event, Severity: 1
> <6>audit: initializing netlink socket (disabled)
> <5>type=2000 audit(1249386596.125:1): initialized
> <6>HugeTLB registered 16 MB page size, pre-allocated 0 pages
> <6>HugeTLB registered 16 GB page size, pre-allocated 0 pages
> <5>VFS: Disk quotas dquot_6.5.2
> <4>Dquot-cache hash table entries: 8192 (order 0, 65536 bytes)
> <6>msgmni has been set to 5024
> <7>SELinux:  Registering netfilter hooks
> <6>alg: No test for stdrng (krng)
> <6>Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
> <6>io scheduler noop registered
> <6>io scheduler anticipatory registered
> <6>io scheduler deadline registered
> <6>io scheduler cfq registered (default)
> <6>pci_hotplug: PCI Hot Plug PCI Core version: 0.5
> <6>pciehp: PCI Express Hot Plug Controller Driver version: 0.4
> <7>vio_register_driver: driver hvc_console registering
> <7>HVSI: registered 0 devices
> <6>Linux agpgart interface v0.103
> <6>Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> <4>Platform driver 'serial8250' needs updating - please use dev_pm_ops
> <6>TX39/49 Serial driver version 1.11
> <4>Platform driver 'serial_txx9' needs updating - please use dev_pm_ops
> <6>brd: module loaded
> <6>loop: module loaded
> <6>input: Macintosh mouse button emulation as /devices/virtual/input/input0
> <6>Uniform Multi-Platform E-IDE driver
> <6>ide-gd driver 1.18
> <6>Fixed MDIO Bus: probed
> <6>ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> <6>ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> <6>uhci_hcd: USB Universal Host Controller Interface driver
> <6>mice: PS/2 mouse device common for all mice
> <6>device-mapper: uevent: version 1.0.3
> <6>device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
> <6>usbcore: registered new interface driver hiddev
> <6>usbcore: registered new interface driver usbhid
> <6>usbhid: v2.6:USB HID core driver
> <4>nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
> <4>CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use
> <4>nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or
> <4>sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
> <6>ip_tables: (C) 2000-2006 Netfilter Core Team
> <6>TCP cubic registered
> <6>Initializing XFRM netlink socket
> <6>NET: Registered protocol family 17
> <7>Running MSI bitmap self-tests ...
> <7>PM: Resume from disk failed.
> <4>registered taskstats version 1
> <6>Initalizing network drop monitor service
> <4>Freeing unused kernel memory: 5504k freed
> <7>vio_register_driver: driver ibmvscsi registering
> <6>ibmvscsi 30000002: SRP_VERSION: 16.a
> <6>scsi0 : IBM POWER Virtual SCSI Adapter 1.5.8
> <6>ibmvscsi 30000002: partner initialization complete
> <6>ibmvscsi 30000002: host srp version: 16.a, host partition 06-1C12A (1), OS 3, max io 262144
> <6>ibmvscsi 30000002: Client reserve enabled
> <6>ibmvscsi 30000002: sent SRP login
> <6>ibmvscsi 30000002: SRP_LOGIN succeeded
> <5>scsi 0:0:1:0: Direct-Access     AIX      VDASD            0001 PQ: 0 ANSI: 3
> <5>scsi 0:0:2:0: CD-ROM            AIX      VOPTA                 PQ: 0 ANSI: 4
> <6>scsi: waiting for bus probes to complete ...
> <5>sd 0:0:1:0: Attached scsi generic sg0 type 0
> <5>sd 0:0:1:0: [sda] 147324928 512-byte logical blocks: (75.4 GB/70.2 GiB)
> <5>sd 0:0:1:0: [sda] Write Protect is off
> <7>sd 0:0:1:0: [sda] Mode Sense: 17 00 00 08
> <5>sd 0:0:1:0: [sda] Cache data unavailable
> <3>sd 0:0:1:0: [sda] Assuming drive cache: write through
> <4>sr0: scsi-1 drive
> <6>Uniform CD-ROM driver Revision: 3.20
> <7>sr 0:0:2:0: Attached scsi CD-ROM sr0
> <5>sr 0:0:2:0: Attached scsi generic sg1 type 5
> <5>sd 0:0:1:0: [sda] Cache data unavailable
> <3>sd 0:0:1:0: [sda] Assuming drive cache: write through
> <6> sda: sda1 sda2 sda3 sda4 < sda5 sda6 sda7 sda8 >
> <5>sd 0:0:1:0: [sda] Cache data unavailable
> <3>sd 0:0:1:0: [sda] Assuming drive cache: write through
> <5>sd 0:0:1:0: [sda] Attached SCSI disk
> <6>EXT4-fs (sda3): INFO: recovery required on readonly filesystem
> <6>EXT4-fs (sda3): write access will be enabled during recovery
> <6>EXT4-fs (sda3): barriers enabled
> <6>kjournald2 starting: pid 126, dev sda3:8, commit interval 5 seconds
> <6>EXT4-fs (sda3): delayed allocation enabled
> <6>EXT4-fs: file extents enabled
> <6>EXT4-fs: mballoc enabled
> <6>EXT4-fs (sda3): recovery complete
> <6>EXT4-fs (sda3): mounted filesystem with ordered data mode
> <5>type=1404 audit(1249386597.188:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
> <7>SELinux: 8192 avtab hash slots, 117789 rules.
> <7>SELinux: 8192 avtab hash slots, 117789 rules.
> <7>SELinux:  8 users, 13 roles, 2653 types, 121 bools, 1 sens, 1024 cats
> <7>SELinux:  74 classes, 117789 rules
> <7>SELinux:  Completing initialization.
> <7>SELinux:  Setting up existing superblocks.
> <7>SELinux: initialized (dev sda3, type ext4), uses xattr
> <7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
> <7>SELinux: initialized (dev selinuxfs, type selinuxfs), uses genfs_contexts
> <7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
> <7>SELinux: initialized (dev hugetlbfs, type hugetlbfs), uses genfs_contexts
> <7>SELinux: initialized (dev devpts, type devpts), uses transition SIDs
> <7>SELinux: initialized (dev inotifyfs, type inotifyfs), uses genfs_contexts
> <7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
> <7>SELinux: initialized (dev anon_inodefs, type anon_inodefs), uses genfs_contexts
> <7>SELinux: initialized (dev pipefs, type pipefs), uses task SIDs
> <7>SELinux: initialized (dev debugfs, type debugfs), uses genfs_contexts
> <7>SELinux: initialized (dev sockfs, type sockfs), uses task SIDs
> <7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
> <7>SELinux: initialized (dev bdev, type bdev), uses genfs_contexts
> <7>SELinux: initialized (dev rootfs, type rootfs), uses genfs_contexts
> <7>SELinux: initialized (dev sysfs, type sysfs), uses genfs_contexts
> <5>type=1403 audit(1249386597.481:3): policy loaded auid=4294967295 ses=4294967295
> <6>udev: starting version 141
> <7>drivers/net/ibmveth.c: ibmveth: IBM i/pSeries Virtual Ethernet Driver 1.03
> <7>vio_register_driver: driver ibmveth registering
> <6>IBM eHEA ethernet device driver (Release EHEA_0101)
> <7>irq: irq 590080 on host null mapped to virtual irq 256
> <6>ehea: eth0: Jumbo frames are enabled
> <6>ehea: eth0 -> logical port id #3
> <6>ehea: eth2: Jumbo frames are enabled
> <6>ehea: eth2 -> logical port id #4
> <6>udev: renamed network interface eth1 to eth3
> <6>udev: renamed network interface eth0_rename to eth1
> <6>device-mapper: multipath: version 1.1.0 loaded
> <6>EXT4-fs (sda3): internal journal on sda3:8
> <6>kjournald starting.  Commit interval 5 seconds
> <6>EXT3 FS on sda2, internal journal
> <6>EXT3-fs: mounted filesystem with writeback data mode.
> <7>SELinux: initialized (dev sda2, type ext3), uses xattr
> <7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
> <7>SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts
> <6>NET: Registered protocol family 10
> <6>lo: Disabled Privacy Extensions
> <6>RPC: Registered udp transport module.
> <6>RPC: Registered tcp transport module.
> <7>SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
> <7>irq: irq 779 on host null mapped to virtual irq 267
> <6>ehea: eth2: Physical port up
> <6>ehea: External switch port is backup port
> <7>irq: irq 780 on host null mapped to virtual irq 268
> <7>irq: irq 781 on host null mapped to virtual irq 269
> <6>ehea: eth0: Physical port up
> <6>ehea: External switch port is backup port
> <7>irq: irq 782 on host null mapped to virtual irq 270
> <6>Bluetooth: Core ver 2.15
> <6>NET: Registered protocol family 31
> <6>Bluetooth: HCI device and connection manager initialized
> <6>Bluetooth: HCI socket layer initialized
> <6>Bluetooth: L2CAP ver 2.13
> <6>Bluetooth: L2CAP socket layer initialized
> <6>Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> <6>Bluetooth: BNEP filters: protocol multicast
> <6>Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
> <7>SELinux: initialized (dev nfsd, type nfsd), uses genfs_contexts
> <4>NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
> <6>NFSD: starting 90-second grace period
> <5>Bridge firewalling registered
> <6>Bluetooth: SCO (Voice Link) ver 0.6
> <6>Bluetooth: SCO socket layer initialized
> <6>virbr0: starting userspace STP failed, starting kernel STP
> <7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
> <7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
> <7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
> <6>lo: Disabled Privacy Extensions
> <7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
> <7>eth0: no IPv6 routers present
> <7>eth2: no IPv6 routers present
> <7>eth1: no IPv6 routers present
> <7>eth3: no IPv6 routers present
> <7>virbr0: no IPv6 routers present
> 0:mon> 
> 

^ permalink raw reply

* Re: linux-next: Tree for August 5
From: Stephen Rothwell @ 2009-08-05 10:13 UTC (permalink / raw)
  To: Boaz Harrosh; +Cc: linux-next, ppc-dev, LKML
In-Reply-To: <4A793EA8.50306@panasas.com>

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

Hi Boaz,

On Wed, 05 Aug 2009 11:11:20 +0300 Boaz Harrosh <bharrosh@panasas.com> wrote:
>
> On 08/05/2009 10:23 AM, Stephen Rothwell wrote:
> > 
> > This tree fails to build for powerpc allyesconfig (final link problem).
> 
> Above is reported for a long time. Is it related to this:
> http://www.spinics.net/lists/kernel/msg921978.html

No, it is this:

powerpc-linux-ld: TOC section size exceeds 64k

It is powerpc specific and the only way we can think of fixing it
involves stopping building the built-in.o files and linking the entire
kernel in one go at the end.  We just haven't had time (or the energy) to
try to fix it properly while it only affects the final link of the
allyesconfig kernel. 

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: Next July 29 : Hugetlb test failure (OOPS free_hugepte_range)
From: Sachin Sant @ 2009-08-05 10:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Stephen Rothwell, linux-next, linuxppc-dev
In-Reply-To: <1248957028.1509.85.camel@pasglop>

Benjamin Herrenschmidt wrote:
> Thanks. I'll have a look next week. I think when I changed the indices
> I may have forgotten to update something.
>   
Ben,

I can recreate this issue with today's next.
Let me know if i can help in any way to fix this issue.

Thanks
-Sachin

>> : ------------[ cut here ]------------
>> cpu 0x0: Vector: 700 (Program Check) at [c000000038923560]
>>     pc: c0000000000486d4: .free_hugepte_range+0x68/0xa0
>>     lr: c000000000048954: .hugetlb_free_pgd_range+0x248/0x38c
>>     sp: c0000000389237e0
>>    msr: 8000000000029032
>>   current = 0xc00000003b1d7780
>>   paca    = 0xc000000001002400
>>     pid   = 2839, comm = readback
>> kernel BUG at /home/linux-2.6.31-rc4/arch/powerpc/include/asm/pgalloc.h:36!
>> enter ? for help
>> [c000000038923880] c000000000048954 .hugetlb_free_pgd_range+0x248/0x38c
>> [c000000038923970] c000000000165a48 .free_pgtables+0xa0/0x154
>> [c000000038923a30] c000000000167f78 .exit_mmap+0x13c/0x1cc
>> [c000000038923ae0] c0000000000997ec .mmput+0x68/0x14c
>> [c000000038923b70] c00000000009f1d4 .exit_mm+0x190/0x1b8
>> [c000000038923c20] c0000000000a16e8 .do_exit+0x214/0x784
>> [c000000038923d00] c0000000000a1d1c .do_group_exit+0xc4/0xf8
>> [c000000038923da0] c0000000000a1d7c .SyS_exit_group+0x2c/0x48
>> [c000000038923e30] c0000000000085b4 syscall_exit+0x0/0x40
>> --- Exception: c01 (System Call) at 000000000fe15038
>> SP (ffb8e030) is in userspace
>> 0:mon> e
>> cpu 0x0: Vector: 700 (Program Check) at [c000000038923560]
>>     pc: c0000000000486d4: .free_hugepte_range+0x68/0xa0
>>     lr: c000000000048954: .hugetlb_free_pgd_range+0x248/0x38c
>>     sp: c0000000389237e0
>>    msr: 8000000000029032
>>   current = 0xc00000003b1d7780
>>   paca    = 0xc000000001002400
>>     pid   = 2839, comm = readback
>> kernel BUG at /home/linux-2.6.31-rc4/arch/powerpc/include/asm/pgalloc.h:36!
>> 0:mon> r
>> R00 = 0000000000000001   R16 = 0000000000000000
>> R01 = c0000000389237e0   R17 = 0000000000000001
>> R02 = c000000000f165a8   R18 = 000000003fffffff
>> R03 = c0000000014504d0   R19 = 0000000000000000
>> R04 = c000000039390001   R20 = 0000000000000000
>> R05 = 0000000000000007   R21 = 0000010000000000
>> R06 = 0000000000000000   R22 = 0000000040000000
>> R07 = 0000000040000000   R23 = c0000000014504d0
>> R08 = c00000003d708188   R24 = 000000003fffffff
>> R09 = c00000003eb40000   R25 = 0000000000000007
>> R10 = c00000003d708188   R26 = c00000003ebd41b8
>> R11 = 0000000000000018   R27 = c0000000014504d0
>> R12 = 0000000040000448   R28 = c00000003eb40018
>> R13 = c000000001002400   R29 = 0000000000000008
>> R14 = 00000000ffffffff   R30 = 0000000040000000
>> R15 = 00000000ffffffff   R31 = c0000000389237e0
>> pc  = c0000000000486d4 .free_hugepte_range+0x68/0xa0
>> lr  = c000000000048954 .hugetlb_free_pgd_range+0x248/0x38c
>> msr = 8000000000029032   cr  = 20042444
>> ctr = 800000000000b6f4   xer = 0000000000000001   trap =  700
>> 0:mon> 
>>
>> Line 36 of arch/powerpc/include/asm/pgalloc.h corresponds to
>>
>> BUG_ON(cachenum > PGF_CACHENUM_MASK);
>>
>> May be something to do with number of elements in huge_pgtable_cache_name ??
>>
>> Thanks
>> -Sachin
-- 

---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------

^ permalink raw reply

* Re: [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Josh Boyer @ 2009-08-05 11:32 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <1249443212-25588-1-git-send-email-galak@kernel.crashing.org>

On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
>Introduced a temporary variable into our iterating over the list cpus
>that are threads on the same core.  For some reason Ben forgot how for
>loops work.

Have the powerpoint demons corrupted him already??

josh

^ permalink raw reply

* ethernet phy attached to wrong driver
From: Stefan Strobl @ 2009-08-05 12:08 UTC (permalink / raw)
  To: linuxppc-dev

Hi

I'm having trouble with my Ethernet device on a TQM5200 based board with
LXT971 Phy. I'm running U-Boot 2009.03 and a Kernel 2.6.30.

When doing a ping under U-Boot before booting into Linux, Ethernet works
fine in Linux also. Dmesg reads:
[  262.369444] net eth0: Using PHY at MDIO address 0
[  263.265903] net eth0: attached phy 0 to driver LXT971

But if I start Linux without prior use of the fec under U-Boot, Ethernet
is not working in Linux. The wrong drivers seems to be attached to the
phy. Dmesg reads:
[    2.068285] net eth0: Using PHY at MDIO address 0
[    2.964774] net eth0: attached phy 0 to driver Generic PHY
                                                  ^^^^^^^^^^^
Is there a bootarg to tell linux which driver to use? Any ideas what I'm
doing wrong?

Regards
Stefan.

^ permalink raw reply

* Re: [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Michael Ellerman @ 2009-08-05 12:52 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20090805113230.GB8985@zod.rchland.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Wed, 2009-08-05 at 07:32 -0400, Josh Boyer wrote:
> On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
> >Introduced a temporary variable into our iterating over the list cpus
> >that are threads on the same core.  For some reason Ben forgot how for
> >loops work.
> 
> Have the powerpoint demons corrupted him already??

No I think one of his kids gave him swine flu.

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Josh Boyer @ 2009-08-05 13:16 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <1249476742.5607.2.camel@concordia>

On Wed, Aug 05, 2009 at 10:52:22PM +1000, Michael Ellerman wrote:
>On Wed, 2009-08-05 at 07:32 -0400, Josh Boyer wrote:
>> On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
>> >Introduced a temporary variable into our iterating over the list cpus
>> >that are threads on the same core.  For some reason Ben forgot how for
>> >loops work.
>> 
>> Have the powerpoint demons corrupted him already??
>
>No I think one of his kids gave him swine flu.

Whew.  You can recover from that at least ;)

josh

^ permalink raw reply

* [PATCH 4/4] drivers/serial/mpc52xx_uart.c: Use UPIO_MEM rather than SERIAL_IO_MEM
From: Julia Lawall @ 2009-08-05 13:25 UTC (permalink / raw)
  To: grant.likely, linuxppc-dev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

As in the commit 9b4a1617772d6d5ab5eeda0cd95302fae119e359, use UPIO_MEM
rather than SERIAL_IO_MEM.  Both have the same value.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@has_sc@
@@

#include <linux/serial_core.h>

@depends on has_sc@
@@

- SERIAL_IO_MEM
+ UPIO_MEM
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/serial/mpc52xx_uart.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -705,7 +705,7 @@ mpc52xx_uart_verify_port(struct uart_por
 		return -EINVAL;
 
 	if ((ser->irq != port->irq) ||
-	    (ser->io_type != SERIAL_IO_MEM) ||
+	    (ser->io_type != UPIO_MEM) ||
 	    (ser->baud_base != port->uartclk)  ||
 	    (ser->iomem_base != (void *)port->mapbase) ||
 	    (ser->hub6 != 0))

^ permalink raw reply

* Re: linux-next: Tree for August 5
From: Boaz Harrosh @ 2009-08-05 13:28 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, ppc-dev, LKML
In-Reply-To: <20090805201336.fd2de2ad.sfr@canb.auug.org.au>

On 08/05/2009 01:13 PM, Stephen Rothwell wrote:
> Hi Boaz,
> 
> On Wed, 05 Aug 2009 11:11:20 +0300 Boaz Harrosh <bharrosh@panasas.com> wrote:
>>
>> On 08/05/2009 10:23 AM, Stephen Rothwell wrote:
>>>
>>> This tree fails to build for powerpc allyesconfig (final link problem).
>>
>> Above is reported for a long time. Is it related to this:
>> http://www.spinics.net/lists/kernel/msg921978.html
> 
> No, it is this:
> 
> powerpc-linux-ld: TOC section size exceeds 64k
> 
> It is powerpc specific and the only way we can think of fixing it
> involves stopping building the built-in.o files and linking the entire
> kernel in one go at the end.  We just haven't had time (or the energy) to
> try to fix it properly while it only affects the final link of the
> allyesconfig kernel. 
> 

Ha, OK allyesconfig. Last time I attempted an allyesconfig for i386 I got
me the OOM killer attack on my KDE, half way into the final link.

That's why I use allmodconfig for when I need "try to compile everything ++"
I get just as much compilation coverage if not more. And is faster.
It'll not show symbol conflicts if any exist, though.

Thanks
Boaz

^ permalink raw reply

* [PATCH 0/3] cpu: idle state framework for offline CPUs.
From: Gautham R Shenoy @ 2009-08-05 14:25 UTC (permalink / raw)
  To: Joel Schopp, len.brown, Peter Zijlstra, Balbir Singh,
	Venkatesh Pallipadi, Benjamin Herrenschmidt, shaohua.li,
	Ingo Molnar, Vaidyanathan Srinivasan, Dipankar Sarma,
	Darrick J. Wong
  Cc: linuxppc-dev, linux-kernel

Hi,

**** RFC not for inclusion ****

When we perform a CPU-Offline operation today, we do not put the CPU
into the most energy efficient state. On x86, it loops in hlt as opposed to
going to one of the low-power C-states. On pSeries, we call rtas_stop_self()
and hand over the vCPU back to the resource pool, thereby deallocating
the vCPU.

Thus, when applications or platforms desire to put a particular CPU
to an extended low-power state for a short while, currently they have to
piggy-back on scheduler heuristics such as sched_mc_powersavings or play with
exclusive Cpusets. The former does a good job based on the workload, but fails
to provide any guarentee that the CPU won't be used for the next <> seconds,
while the latter might conflict with the existing CPUsets configurations.

There were efforts to alleviate these problems and various proposals have been
put forth. They include putting the CPU to the deepest possible idle-state
when offlined [1], removing the desired CPU from the topmost-cpuset [2],
a driver which forces a high-priority idle thread to run on the desired CPU
thereby putting it to idle [3].

In this patch-series, we propose to extend the CPU-Hotplug infrastructure
and allow the system administrator to choose the desired state the CPU should
go to when it is offlined. We think this approach addresses the concerns about
determinism as well as transparency, since CPU-Hotplug already provides
notification mechanism which the userspace can listen to for any change
in the configuration and correspondingly readjust any previously set
cpu-affinities. Also, approaches such as [1] can make use of this
extended infrastructure instead of putting the CPU to an arbitrary C-state
when it is offlined, thereby providing the system administrator a rope to hang
himself with should he feel the need to do so.

This patch-series tries to achieve this by implementing an architecture
independent framework that exposes sysfs tunables to allow the
system-adminstrator to choose the offline-state of a CPU.

	/sys/devices/system/cpu/cpu<number>/available_offline_states
and
	/sys/devices/system/cpu/cpu<number>/preferred_offline_states

For the purpose of proof-of-concept, we've implemented the backend for
pSeries. For pSeries, we define two available_offline_states. They are:

	deallocate: This is default behaviour which on an offline, deallocates
	the vCPU by invoking rtas_stop_self() and hands it back to
	the resource pool.

	deactivate: This calls H_CEDE, which will request the hypervisor to
	idle the vCPU in the lowest power mode and give it back as soon as
	we need it.


Any feedback on the patchset will be immensely valuable.

References:
-----------
[1] Pallipadi, Venkatesh: x86: Make offline cpus to go to deepest idle state
using mwait (URL: http://lkml.org/lkml/2009/5/22/431)

[2] Li, Shaohua: cpuset: add new API to change cpuset top group's cpus
(URL: http://lkml.org/lkml/2009/5/19/54)

[3] Li, Shaohua: new ACPI processor driver to force CPUs idle
(URL: http://www.spinics.net/lists/linux-acpi/msg22863.html)


Changelog:
---

Gautham R Shenoy (3):
      pSeries: cpu: Cede CPU during a deactivate-offline
      cpu: Implement cpu-offline-state callbacks for pSeries.
      cpu: Offline state Framework.


 arch/powerpc/platforms/pseries/hotplug-cpu.c    |  160 ++++++++++++++++++++++-
 arch/powerpc/platforms/pseries/offline_driver.h |   17 ++
 arch/powerpc/platforms/pseries/plpar_wrappers.h |    6 +
 arch/powerpc/platforms/pseries/smp.c            |   18 ++-
 drivers/base/cpu.c                              |  111 ++++++++++++++++
 include/linux/cpu.h                             |   15 ++
 6 files changed, 319 insertions(+), 8 deletions(-)
 create mode 100644 arch/powerpc/platforms/pseries/offline_driver.h

-- 
Thanks and Regards
gautham.

^ permalink raw reply

* [PATCH 2/3] cpu: Implement cpu-offline-state callbacks for pSeries.
From: Gautham R Shenoy @ 2009-08-05 14:26 UTC (permalink / raw)
  To: Joel Schopp, len.brown, Peter Zijlstra, Balbir Singh,
	Venkatesh Pallipadi, Benjamin Herrenschmidt, shaohua.li,
	Ingo Molnar, Vaidyanathan Srinivasan, Dipankar Sarma,
	Darrick J. Wong
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20090805142311.553.78286.stgit@sofia.in.ibm.com>

This patch implements the callbacks to handle the reads/writes into the sysfs
interfaces

/sys/devices/system/cpu/cpu<number>/available_offline_states
and
/sys/devices/system/cpu/cpu<number>/preferred_offline_state

Currently, the patch defines two states which the processor can go to when it
is offlined. They are

- deallocate: The current behaviour when the cpu is offlined.
  The CPU would call make an rtas_stop_self() call and hand over the
  CPU back to the resource pool, thereby effectively deallocating
  that vCPU from the LPAR.

- deactivate: This is expected to cede the processor to the hypervisor, so
  that on processors which support appropriate low-power states, they can
  be exploited. This can be considered as an extended tickless idle state.

The patch only implements the callbacks which will display the available
states, and record the preferred states. The code bits to call
rtas_stop_self() or H_CEDE, depending on the preferred_offline_state is
implemented in the next patch.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c    |   90 +++++++++++++++++++++++
 arch/powerpc/platforms/pseries/offline_driver.h |   16 ++++
 2 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/pseries/offline_driver.h

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index a20ead8..f15de99 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -30,6 +30,95 @@
 #include <asm/pSeries_reconfig.h>
 #include "xics.h"
 #include "plpar_wrappers.h"
+#include "offline_driver.h"
+
+struct cpu_offline_state {
+	enum cpu_state_vals state_val;
+	const char *state_name;
+} pSeries_cpu_offline_states[] = {
+	{CPU_DEACTIVATE, "deactivate"},
+	{CPU_DEALLOCATE, "deallocate"},
+};
+
+DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = CPU_DEALLOCATE;
+
+ssize_t pSeries_show_available_states(struct sys_device *dev,
+			struct sysdev_attribute *attr, char *buf)
+{
+	int state;
+	ssize_t ret = 0;
+
+	for (state = CPU_DEACTIVATE; state < CPU_MAX_OFFLINE_STATES; state++) {
+		if (state == CPU_STATE_ONLINE)
+			continue;
+
+		if (ret >= (ssize_t) ((PAGE_SIZE / sizeof(char))
+					- (CPU_STATES_LEN + 2)))
+			goto out;
+		ret += scnprintf(&buf[ret], CPU_STATES_LEN, "%s ",
+				pSeries_cpu_offline_states[state].state_name);
+	}
+
+out:
+	ret += sprintf(&buf[ret], "\n");
+	return ret;
+}
+
+ssize_t pSeries_show_preferred_state(struct sys_device *dev,
+			struct sysdev_attribute *attr, char *buf)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, sysdev);
+	int state = per_cpu(preferred_offline_state, cpu->sysdev.id);
+
+	return scnprintf(buf, CPU_STATES_LEN, "%s\n",
+			pSeries_cpu_offline_states[state].state_name);
+}
+
+ssize_t pSeries_store_preferred_state(struct sys_device *dev,
+			struct sysdev_attribute *attr,
+			const char *buf, size_t count)
+{
+	struct cpu *cpu = container_of(dev, struct cpu, sysdev);
+	unsigned int ret = -EINVAL;
+	char state_name[CPU_STATES_LEN];
+	int i;
+	cpu_maps_update_begin();
+	ret = sscanf(buf, "%15s", state_name);
+
+	if (ret != 1) {
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+	for (i = CPU_DEACTIVATE; i < CPU_MAX_OFFLINE_STATES; i++)
+		if (!strnicmp(state_name,
+				pSeries_cpu_offline_states[i].state_name,
+				CPU_STATES_LEN))
+			break;
+
+	if (i == CPU_MAX_OFFLINE_STATES) {
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+	per_cpu(preferred_offline_state, cpu->sysdev.id) =
+				pSeries_cpu_offline_states[i].state_val;
+	ret = 0;
+
+out_unlock:
+	cpu_maps_update_done();
+
+	if (ret)
+		return ret;
+	else
+		return count;
+}
+
+struct cpu_offline_driver pSeries_offline_driver = {
+	.show_available_states = pSeries_show_available_states,
+	.show_preferred_state = pSeries_show_preferred_state,
+	.store_preferred_state = pSeries_store_preferred_state,
+};
 
 /* This version can't take the spinlock, because it never returns */
 static struct rtas_args rtas_stop_self_args = {
@@ -281,6 +370,7 @@ static int __init pseries_cpu_hotplug_init(void)
 	ppc_md.cpu_die = pseries_mach_cpu_die;
 	smp_ops->cpu_disable = pseries_cpu_disable;
 	smp_ops->cpu_die = pseries_cpu_die;
+	register_cpu_offline_driver(&pSeries_offline_driver);
 
 	/* Processors can be added/removed only on LPAR */
 	if (firmware_has_feature(FW_FEATURE_LPAR))
diff --git a/arch/powerpc/platforms/pseries/offline_driver.h b/arch/powerpc/platforms/pseries/offline_driver.h
new file mode 100644
index 0000000..bdae76a
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/offline_driver.h
@@ -0,0 +1,16 @@
+#ifndef _OFFLINE_DRIVER_H_
+#define _OFFLINE_DRIVER_H_
+
+#define CPU_STATES_LEN	16
+
+/* Cpu offline states go here */
+enum cpu_state_vals {
+	CPU_DEACTIVATE,
+	CPU_DEALLOCATE,
+	CPU_STATE_ONLINE,
+	CPU_MAX_OFFLINE_STATES
+};
+
+DECLARE_PER_CPU(enum cpu_state_vals, preferred_offline_state);
+
+#endif

^ permalink raw reply related

* [PATCH 1/3] cpu: Offline state Framework.
From: Gautham R Shenoy @ 2009-08-05 14:25 UTC (permalink / raw)
  To: Joel Schopp, len.brown, Peter Zijlstra, Balbir Singh,
	Venkatesh Pallipadi, Benjamin Herrenschmidt, shaohua.li,
	Ingo Molnar, Vaidyanathan Srinivasan, Dipankar Sarma,
	Darrick J. Wong
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20090805142311.553.78286.stgit@sofia.in.ibm.com>

Provide an interface by which the system administrator can decide what state
should the CPU go to when it is offlined.

To query the available offline states, on needs to perform a read on:
/sys/devices/system/cpu/cpu<number>/available_offline_states

To query or set the preferred offline state for a particular CPU, one needs to
use the sysfs interface

/sys/devices/system/cpu/cpu<number>/preferred_offline_state

This patch implements the architecture independent bits of the
cpu-offline-state framework.

The architecture specific bits are expected to register the actual code which
implements the callbacks when the above mentioned sysfs interfaces are read or
written into. Thus the values provided by reading available_offline_states are
expected to vary with the architecture.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
---
 drivers/base/cpu.c  |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/cpu.h |   15 +++++++
 2 files changed, 126 insertions(+), 0 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index e62a4cc..1a63de0 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -56,26 +56,137 @@ static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribut
 }
 static SYSDEV_ATTR(online, 0644, show_online, store_online);
 
+static struct cpu_offline_driver *cpu_offline_driver;
+static SYSDEV_ATTR(available_offline_states, 0444, NULL, NULL);
+static SYSDEV_ATTR(preferred_offline_state, 0644, NULL, NULL);
+
+/* Should be called with cpu_add_remove_lock held */
+void cpu_offline_driver_add_cpu(struct sys_device *cpu_sys_dev)
+{
+	if (!cpu_offline_driver)
+		return;
+
+	sysdev_create_file(cpu_sys_dev, &attr_available_offline_states);
+	sysdev_create_file(cpu_sys_dev, &attr_preferred_offline_state);
+}
+
+/* Should be called with cpu_add_remove_lock held */
+void cpu_offline_driver_remove_cpu(struct sys_device *cpu_sys_dev)
+{
+	if (!cpu_offline_driver)
+		return;
+
+	sysdev_remove_file(cpu_sys_dev, &attr_available_offline_states);
+	sysdev_remove_file(cpu_sys_dev, &attr_preferred_offline_state);
+
+}
+
 static void __cpuinit register_cpu_control(struct cpu *cpu)
 {
 	sysdev_create_file(&cpu->sysdev, &attr_online);
+	cpu_offline_driver_add_cpu(&cpu->sysdev);
 }
+
 void unregister_cpu(struct cpu *cpu)
 {
 	int logical_cpu = cpu->sysdev.id;
 
 	unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
 
+	cpu_offline_driver_remove_cpu(&cpu->sysdev);
 	sysdev_remove_file(&cpu->sysdev, &attr_online);
 
 	sysdev_unregister(&cpu->sysdev);
 	per_cpu(cpu_sys_devices, logical_cpu) = NULL;
 	return;
 }
+
+static int __cpuinit
+cpu_driver_callback(struct notifier_block *nfb, unsigned long action,
+								void *hcpu)
+{
+	struct sys_device *cpu_sysdev = per_cpu(cpu_sys_devices,
+						(unsigned long)(hcpu));
+
+	switch (action) {
+	case CPU_DEAD:
+	case CPU_DEAD_FROZEN:
+		cpu_offline_driver_remove_cpu(cpu_sysdev);
+		break;
+
+	case CPU_ONLINE:
+	case CPU_ONLINE_FROZEN:
+		cpu_offline_driver_add_cpu(cpu_sysdev);
+		break;
+	default:
+		break;
+	}
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block __cpuinitdata cpu_driver_notifier = {
+	.notifier_call = cpu_driver_callback,
+	.priority = 0
+};
+
+int register_cpu_offline_driver(struct cpu_offline_driver *arch_cpu_driver)
+{
+	int ret = 0;
+	cpu_maps_update_begin();
+
+	if (cpu_offline_driver != NULL) {
+		ret = -EEXIST;
+		goto out_unlock;
+	}
+
+	if (!(arch_cpu_driver->show_available_states &&
+	      arch_cpu_driver->show_preferred_state &&
+	      arch_cpu_driver->store_preferred_state)) {
+		ret = -EINVAL;
+		goto out_unlock;
+	}
+
+	attr_available_offline_states.show =
+		arch_cpu_driver->show_available_states;
+	attr_preferred_offline_state.show =
+		arch_cpu_driver->show_preferred_state;
+	attr_preferred_offline_state.store =
+		arch_cpu_driver->store_preferred_state;
+
+	cpu_offline_driver = arch_cpu_driver;
+
+out_unlock:
+	cpu_maps_update_done();
+	if (!ret)
+		register_cpu_notifier(&cpu_driver_notifier);
+	return ret;
+}
+
+void unregister_cpu_offline_driver(struct cpu_offline_driver *arch_cpu_driver)
+{
+	cpu_maps_update_begin();
+
+	if (!cpu_offline_driver) {
+		WARN_ON(1);
+		cpu_maps_update_done();
+		return;
+	}
+
+	cpu_offline_driver = NULL;
+	attr_available_offline_states.show = NULL;
+	attr_preferred_offline_state.show = NULL;
+	attr_preferred_offline_state.store = NULL;
+
+	cpu_maps_update_done();
+	unregister_cpu_notifier(&cpu_driver_notifier);
+}
+
 #else /* ... !CONFIG_HOTPLUG_CPU */
 static inline void register_cpu_control(struct cpu *cpu)
 {
 }
+
 #endif /* CONFIG_HOTPLUG_CPU */
 
 #ifdef CONFIG_KEXEC
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 4d668e0..e2150be 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -51,6 +51,21 @@ struct notifier_block;
 #ifdef CONFIG_HOTPLUG_CPU
 extern int register_cpu_notifier(struct notifier_block *nb);
 extern void unregister_cpu_notifier(struct notifier_block *nb);
+
+struct cpu_offline_driver {
+	ssize_t (*show_available_states)(struct sys_device *dev,
+			struct sysdev_attribute *attr, char *buf);
+	ssize_t (*show_preferred_state)(struct sys_device *dev,
+			struct sysdev_attribute *attr, char *buf);
+
+	ssize_t (*store_preferred_state)(struct sys_device *dev,
+			struct sysdev_attribute *attr,
+			const char *buf, size_t count);
+};
+
+extern int register_cpu_offline_driver(struct cpu_offline_driver *driver);
+extern void unregister_cpu_offline_driver(struct cpu_offline_driver *driver);
+
 #else
 
 #ifndef MODULE

^ permalink raw reply related

* [PATCH 3/3] pSeries: cpu: Cede CPU during a deactivate-offline
From: Gautham R Shenoy @ 2009-08-05 14:26 UTC (permalink / raw)
  To: Joel Schopp, len.brown, Peter Zijlstra, Balbir Singh,
	Venkatesh Pallipadi, Benjamin Herrenschmidt, shaohua.li,
	Ingo Molnar, Vaidyanathan Srinivasan, Dipankar Sarma,
	Darrick J. Wong
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20090805142311.553.78286.stgit@sofia.in.ibm.com>

Implements the pSeries specific code bits to put the CPU into
rtas_stop_self() state or H_CEDE state depending on the
preferred_offline_state value for that CPU.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c    |   70 +++++++++++++++++++++--
 arch/powerpc/platforms/pseries/offline_driver.h |    3 +
 arch/powerpc/platforms/pseries/plpar_wrappers.h |    6 ++
 arch/powerpc/platforms/pseries/smp.c            |   18 ++++++
 4 files changed, 88 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index f15de99..5b47d6c 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -41,6 +41,8 @@ struct cpu_offline_state {
 };
 
 DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = CPU_DEALLOCATE;
+DEFINE_PER_CPU(enum cpu_state_vals, cpu_current_state);
+DEFINE_PER_CPU(int, cpu_offline_ack);
 
 ssize_t pSeries_show_available_states(struct sys_device *dev,
 			struct sysdev_attribute *attr, char *buf)
@@ -148,8 +150,47 @@ static void pseries_mach_cpu_die(void)
 	local_irq_disable();
 	idle_task_exit();
 	xics_teardown_cpu();
-	unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow()));
-	rtas_stop_self();
+	if (__get_cpu_var(preferred_offline_state) == CPU_DEACTIVATE) {
+
+		__get_cpu_var(cpu_offline_ack) = 1;
+		get_lppaca()->idle = 1;
+		if (!get_lppaca()->shared_proc)
+			get_lppaca()->donate_dedicated_cpu = 1;
+
+		printk(KERN_INFO "cpu %u (hwid %u) ceding\n",
+			smp_processor_id(), hard_smp_processor_id());
+
+		while (__get_cpu_var(cpu_current_state)	== CPU_DEACTIVATE) {
+			cede_processor();
+			printk(KERN_INFO "cpu %u (hwid %u) Returned from cede.\
+				Decrementer value: %x. Timebase value:%llx \n",
+			       smp_processor_id(), hard_smp_processor_id(),
+			       get_dec(), get_tb());
+		}
+
+		printk(KERN_INFO "cpu %u (hwid %u) Received online PROD \n",
+		       smp_processor_id(), hard_smp_processor_id());
+
+		if (!get_lppaca()->shared_proc)
+			get_lppaca()->donate_dedicated_cpu = 0;
+		get_lppaca()->idle = 0;
+
+		unregister_slb_shadow(hard_smp_processor_id(),
+						__pa(get_slb_shadow()));
+
+		/**
+		 * NOTE: Calling start_secondary() here, is not a very nice
+		 * way of beginning a new context.
+		 *
+		 * We need to reset the stack-pointer.
+		 * Find a cleaner way to do this.
+		 */
+		start_secondary(NULL);
+	} else {
+		unregister_slb_shadow(hard_smp_processor_id(),
+						__pa(get_slb_shadow()));
+		rtas_stop_self();
+	}
 	/* Should never get here... */
 	BUG();
 	for(;;);
@@ -192,6 +233,10 @@ static int pseries_cpu_disable(void)
 
 	/* FIXME: abstract this to not be platform specific later on */
 	xics_migrate_irqs_away();
+	__get_cpu_var(cpu_current_state) =
+		__get_cpu_var(preferred_offline_state);
+
+	__get_cpu_var(cpu_offline_ack) = 0;
 	return 0;
 }
 
@@ -201,11 +246,22 @@ static void pseries_cpu_die(unsigned int cpu)
 	int cpu_status;
 	unsigned int pcpu = get_hard_smp_processor_id(cpu);
 
-	for (tries = 0; tries < 25; tries++) {
-		cpu_status = query_cpu_stopped(pcpu);
-		if (cpu_status == 0 || cpu_status == -1)
-			break;
-		cpu_relax();
+	if (per_cpu(preferred_offline_state, cpu) == CPU_DEACTIVATE) {
+		/* Wait for some Ack */
+		for (tries = 0; tries < 10000; tries++) {
+			cpu_status = !per_cpu(cpu_offline_ack, cpu);
+			if (!cpu_status)
+				break;
+			cpu_relax();
+		}
+
+	} else {
+		for (tries = 0; tries < 25; tries++) {
+			cpu_status = query_cpu_stopped(pcpu);
+			if (cpu_status == 0 || cpu_status == -1)
+				break;
+			cpu_relax();
+		}
 	}
 	if (cpu_status != 0) {
 		printk("Querying DEAD? cpu %i (%i) shows %i\n",
diff --git a/arch/powerpc/platforms/pseries/offline_driver.h b/arch/powerpc/platforms/pseries/offline_driver.h
index bdae76a..571e085 100644
--- a/arch/powerpc/platforms/pseries/offline_driver.h
+++ b/arch/powerpc/platforms/pseries/offline_driver.h
@@ -12,5 +12,6 @@ enum cpu_state_vals {
 };
 
 DECLARE_PER_CPU(enum cpu_state_vals, preferred_offline_state);
-
+DECLARE_PER_CPU(enum cpu_state_vals, cpu_current_state);
+extern int start_secondary(void *unused);
 #endif
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index a24a6b2..ab7f5ab 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -14,6 +14,12 @@ static inline long cede_processor(void)
 	return plpar_hcall_norets(H_CEDE);
 }
 
+static inline long prod_processor(unsigned long cpu)
+{
+	unsigned long hcpuid = get_hard_smp_processor_id(cpu);
+	return plpar_hcall_norets(H_PROD, hcpuid);
+}
+
 static inline long vpa_call(unsigned long flags, unsigned long cpu,
 		unsigned long vpa)
 {
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 1f8f6cf..15d96a2 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -48,6 +48,7 @@
 #include "plpar_wrappers.h"
 #include "pseries.h"
 #include "xics.h"
+#include "offline_driver.h"
 
 
 /*
@@ -86,7 +87,10 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
 	/* Fixup atomic count: it exited inside IRQ handler. */
 	task_thread_info(paca[lcpu].__current)->preempt_count	= 0;
 
-	/* 
+	if (per_cpu(preferred_offline_state, lcpu) == CPU_DEACTIVATE)
+		goto out;
+
+	/*
 	 * If the RTAS start-cpu token does not exist then presume the
 	 * cpu is already spinning.
 	 */
@@ -100,6 +104,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
 		return 0;
 	}
 
+out:
 	return 1;
 }
 
@@ -119,6 +124,7 @@ static void __devinit smp_xics_setup_cpu(int cpu)
 
 static void __devinit smp_pSeries_kick_cpu(int nr)
 {
+	long rc;
 	BUG_ON(nr < 0 || nr >= NR_CPUS);
 
 	if (!smp_startup_cpu(nr))
@@ -130,6 +136,16 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
 	 * the processor will continue on to secondary_start
 	 */
 	paca[nr].cpu_start = 1;
+
+	per_cpu(cpu_current_state, nr) = CPU_STATE_ONLINE;
+	if (per_cpu(preferred_offline_state, nr) == CPU_DEACTIVATE) {
+
+		printk(KERN_INFO "Prodding processor %d to go online\n", nr);
+		rc = prod_processor(nr);
+		if (rc != H_SUCCESS)
+			panic("Prod to wake up processor %d returned \
+				with error code: %ld. Dying\n", nr, rc);
+	}
 }
 
 static int smp_pSeries_cpu_bootable(unsigned int nr)

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox