All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] spufs: don't need struct page for SPEs
@ 2007-02-07  4:50 Benjamin Herrenschmidt
  2007-02-07  4:50 ` [PATCH 1/3] add vm_insert_pfn() Benjamin Herrenschmidt
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-07  4:50 UTC (permalink / raw)
  To: linuxppc-dev, cbe-oss-dev; +Cc: Andrew Morton, Arnd Bergmann

This serie of patches removes the dependency of spufs on having
struct page for the SPE local stores and register spaces. That
means it technically also removes the need for sparsemem for
native Cell setups though Kconfig still forces it enabled when
CONFIG_NUMA is set (might be fixable separately).

The first patch is from Nick Piggin, it's part of his serie reworking
the nopage handling, though it's also perfectly useable standalone.

The second patch adds a NOPFN_REFAULT return option from ->nopfn()
equivalent to the NOPAGE_REFAULT I added a while ago for ->nopage() so
I can use nopfn instead of nopage and thus use VM_PFNMAP for my VMAs

The third patch converts the spufs code to not use struct page and
removes the code in the cell platform that creates them

I have no firm feeling on wether those should be in 2.6.21 or not,
they are pre-requisite for some other work I'm doing with spufs but
which won't be in 2.6.21 (well, I don't think it will be ready in time
and it doesn't really matter) so I'm mostly posting this here for
review/comment/backup :-) I would appreciate testing too, I did some
tests here and they seem to pass but heh, the more the better.

Ben.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] add vm_insert_pfn()
  2007-02-07  4:50 [PATCH 0/3] spufs: don't need struct page for SPEs Benjamin Herrenschmidt
@ 2007-02-07  4:50 ` Benjamin Herrenschmidt
  2007-02-07  4:50 ` [PATCH 2/3] Add NOPFN_REFAULT result from vm_ops->nopfn() Benjamin Herrenschmidt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-07  4:50 UTC (permalink / raw)
  To: linuxppc-dev, cbe-oss-dev; +Cc: Andrew Morton, Arnd Bergmann

From: Nick Piggin <npiggin@suse.de>

Add a vm_insert_pfn helper, so that ->fault handlers can have nopfn
functionality by installing their own pte and returning NULL.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

 include/linux/mm.h |    1 +
 mm/memory.c        |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

Index: linux-cell/include/linux/mm.h
===================================================================
--- linux-cell.orig/include/linux/mm.h	2007-01-22 10:34:06.000000000 +1100
+++ linux-cell/include/linux/mm.h	2007-02-06 13:46:51.000000000 +1100
@@ -1120,6 +1120,7 @@ unsigned long vmalloc_to_pfn(void *addr)
 int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
 			unsigned long pfn, unsigned long size, pgprot_t);
 int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
+int vm_insert_pfn(struct vm_area_struct *, unsigned long addr, unsigned long pfn);
 
 struct page *follow_page(struct vm_area_struct *, unsigned long address,
 			unsigned int foll_flags);
Index: linux-cell/mm/memory.c
===================================================================
--- linux-cell.orig/mm/memory.c	2007-01-12 14:49:15.000000000 +1100
+++ linux-cell/mm/memory.c	2007-02-06 13:46:51.000000000 +1100
@@ -1277,6 +1277,50 @@ int vm_insert_page(struct vm_area_struct
 }
 EXPORT_SYMBOL(vm_insert_page);
 
+/**
+ * vm_insert_pfn - insert single pfn into user vma
+ * @vma: user vma to map to
+ * @addr: target user address of this page
+ * @pfn: source kernel pfn
+ *
+ * Similar to vm_inert_page, this allows drivers to insert individual pages
+ * they've allocated into a user vma. Same comments apply.
+ *
+ * This function should only be called from a vm_ops->fault handler, and
+ * in that case the handler should return NULL.
+ */
+int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
+{
+	struct mm_struct *mm = vma->vm_mm;
+	int retval;
+	pte_t *pte, entry;
+	spinlock_t *ptl;
+
+	BUG_ON(!(vma->vm_flags & VM_PFNMAP));
+	BUG_ON(is_cow_mapping(vma->vm_flags));
+
+	retval = -ENOMEM;
+	pte = get_locked_pte(mm, addr, &ptl);
+	if (!pte)
+		goto out;
+	retval = -EBUSY;
+	if (!pte_none(*pte))
+		goto out_unlock;
+
+	/* Ok, finally just insert the thing.. */
+	entry = pfn_pte(pfn, vma->vm_page_prot);
+	set_pte_at(mm, addr, pte, entry);
+	update_mmu_cache(vma, addr, entry);
+
+	retval = 0;
+out_unlock:
+	pte_unmap_unlock(pte, ptl);
+
+out:
+	return retval;
+}
+EXPORT_SYMBOL(vm_insert_pfn);
+
 /*
  * maps a range of physical memory into the requested pages. the old
  * mappings are removed. any references to nonexistent pages results

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/3] Add NOPFN_REFAULT result from vm_ops->nopfn()
  2007-02-07  4:50 [PATCH 0/3] spufs: don't need struct page for SPEs Benjamin Herrenschmidt
  2007-02-07  4:50 ` [PATCH 1/3] add vm_insert_pfn() Benjamin Herrenschmidt
@ 2007-02-07  4:50 ` Benjamin Herrenschmidt
  2007-02-07  4:50 ` [PATCH 3/3] spufs: remove need for struct page for SPEs Benjamin Herrenschmidt
  2007-02-07 14:39 ` [PATCH 0/3] spufs: don't need " Arnd Bergmann
  3 siblings, 0 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-07  4:50 UTC (permalink / raw)
  To: linuxppc-dev, cbe-oss-dev; +Cc: Andrew Morton, Arnd Bergmann

Add a NOPFN_REFAULT return code for vm_ops->nopfn() equivalent
to NOPAGE_REFAULT for vmops->nopage() indicating that the handler
requests a re-execution of the faulting instruction

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

 include/linux/mm.h |    1 +
 mm/memory.c        |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: linux-cell/include/linux/mm.h
===================================================================
--- linux-cell.orig/include/linux/mm.h	2007-02-06 14:40:45.000000000 +1100
+++ linux-cell/include/linux/mm.h	2007-02-06 14:40:52.000000000 +1100
@@ -637,6 +637,7 @@ static inline int page_mapped(struct pag
  */
 #define NOPFN_SIGBUS	((unsigned long) -1)
 #define NOPFN_OOM	((unsigned long) -2)
+#define NOPFN_REFAULT	((unsigned long) -3)
 
 /*
  * Different kinds of faults, as returned by handle_mm_fault().
Index: linux-cell/mm/memory.c
===================================================================
--- linux-cell.orig/mm/memory.c	2007-02-06 14:41:10.000000000 +1100
+++ linux-cell/mm/memory.c	2007-02-06 14:41:45.000000000 +1100
@@ -2357,10 +2357,12 @@ static noinline int do_no_pfn(struct mm_
 	BUG_ON(is_cow_mapping(vma->vm_flags));
 
 	pfn = vma->vm_ops->nopfn(vma, address & PAGE_MASK);
-	if (pfn == NOPFN_OOM)
+	if (unlikely(pfn == NOPFN_OOM))
 		return VM_FAULT_OOM;
-	if (pfn == NOPFN_SIGBUS)
+	else if (unlikely(pfn == NOPFN_SIGBUS))
 		return VM_FAULT_SIGBUS;
+	else if (unlikely(pfn == NOPFN_REFAULT))
+		return VM_FAULT_MINOR;
 
 	page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/3] spufs: remove need for struct page for SPEs
  2007-02-07  4:50 [PATCH 0/3] spufs: don't need struct page for SPEs Benjamin Herrenschmidt
  2007-02-07  4:50 ` [PATCH 1/3] add vm_insert_pfn() Benjamin Herrenschmidt
  2007-02-07  4:50 ` [PATCH 2/3] Add NOPFN_REFAULT result from vm_ops->nopfn() Benjamin Herrenschmidt
@ 2007-02-07  4:50 ` Benjamin Herrenschmidt
  2007-02-07  4:55   ` Benjamin Herrenschmidt
                     ` (2 more replies)
  2007-02-07 14:39 ` [PATCH 0/3] spufs: don't need " Arnd Bergmann
  3 siblings, 3 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-07  4:50 UTC (permalink / raw)
  To: linuxppc-dev, cbe-oss-dev; +Cc: Andrew Morton, Arnd Bergmann

This patch removes the need for struct page for SPE local store
and registers from spufs. It also makes the locking much more
obvious and no longer relying on the truncate logic black magic
for protecting against races between unmap_mapping_range() and
new pages faulted in. It does so by switching to a nopfn() handler
and using the new vm_insert_pfn() to setup the PTEs itself while
holding a lock on the SPE.

The nice thing is that this patch actually removes a lot more code
than it adds :-)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

 Kconfig                         |    2

Index: linux-cell/arch/powerpc/platforms/cell/spu_priv1_mmio.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/cell/spu_priv1_mmio.c	2007-02-06 15:39:25.000000000 +1100
+++ linux-cell/arch/powerpc/platforms/cell/spu_priv1_mmio.c	2007-02-06 15:39:35.000000000 +1100
@@ -57,37 +57,6 @@ struct device_node *spu_devnode(struct s
 
 EXPORT_SYMBOL_GPL(spu_devnode);
 
-static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
-		const char *prop)
-{
-	const struct address_prop {
-		unsigned long address;
-		unsigned int len;
-	} __attribute__((packed)) *p;
-	int proplen;
-
-	unsigned long start_pfn, nr_pages;
-	struct pglist_data *pgdata;
-	struct zone *zone;
-	int ret;
-
-	p = get_property(spe, prop, &proplen);
-	WARN_ON(proplen != sizeof (*p));
-
-	start_pfn = p->address >> PAGE_SHIFT;
-	nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
-
-	pgdata = NODE_DATA(spu->node);
-	zone = pgdata->node_zones;
-
-	/* XXX rethink locking here */
-	mutex_lock(&add_spumem_mutex);
-	ret = __add_pages(zone, start_pfn, nr_pages);
-	mutex_unlock(&add_spumem_mutex);
-
-	return ret;
-}
-
 static void __iomem * __init map_spe_prop(struct spu *spu,
 		struct device_node *n, const char *name)
 {
@@ -98,23 +67,13 @@ static void __iomem * __init map_spe_pro
 
 	const void *p;
 	int proplen;
-	void __iomem *ret = NULL;
-	int err = 0;
 
 	p = get_property(n, name, &proplen);
 	if (proplen != sizeof (struct address_prop))
 		return NULL;
 
 	prop = p;
-
-	err = cell_spuprop_present(spu, n, name);
-	if (err && (err != -EEXIST))
-		goto out;
-
-	ret = ioremap(prop->address, prop->len);
-
- out:
-	return ret;
+	return ioremap(prop->address, prop->len);
 }
 
 static void spu_unmap(struct spu *spu)
@@ -239,37 +198,21 @@ static int spu_map_resource(struct spu *
 			    void __iomem** virt, unsigned long *phys)
 {
 	struct device_node *np = spu_get_pdata(spu)->devnode;
-	unsigned long start_pfn, nr_pages;
-	struct pglist_data *pgdata;
-	struct zone *zone;
 	struct resource resource = { };
 	unsigned long len;
 	int ret;
 
 	ret = of_address_to_resource(np, nr, &resource);
 	if (ret)
-		goto out;
+		return ret;
 
 	if (phys)
 		*phys = resource.start;
 	len = resource.end - resource.start + 1;
 	*virt = ioremap(resource.start, len);
 	if (!*virt)
-		ret = -EINVAL;
-
-	start_pfn = resource.start >> PAGE_SHIFT;
-	nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
-
-	pgdata = NODE_DATA(spu->node);
-	zone = pgdata->node_zones;
-
-	/* XXX rethink locking here */
-	mutex_lock(&add_spumem_mutex);
-	ret = __add_pages(zone, start_pfn, nr_pages);
-	mutex_unlock(&add_spumem_mutex);
-
-out:
-	return ret;
+		return -EINVAL;
+	return 0;
 }
 
 static int __init spu_map_device(struct spu *spu)
Index: linux-cell/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- linux-cell.orig/arch/powerpc/platforms/cell/spufs/file.c	2007-02-06 15:39:25.000000000 +1100
+++ linux-cell/arch/powerpc/platforms/cell/spufs/file.c	2007-02-06 15:39:35.000000000 +1100
@@ -95,14 +95,12 @@ spufs_mem_write(struct file *file, const
 	return ret;
 }
 
-static struct page *
-spufs_mem_mmap_nopage(struct vm_area_struct *vma,
-		      unsigned long address, int *type)
+static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma,
+					  unsigned long address)
 {
-	struct page *page = NOPAGE_SIGBUS;
-
 	struct spu_context *ctx = vma->vm_file->private_data;
-	unsigned long offset = address - vma->vm_start;
+	unsigned long pfn, offset = address - vma->vm_start;
+
 	offset += vma->vm_pgoff << PAGE_SHIFT;
 
 	spu_acquire(ctx);
@@ -110,24 +108,22 @@ spufs_mem_mmap_nopage(struct vm_area_str
 	if (ctx->state == SPU_STATE_SAVED) {
 		vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
 							& ~_PAGE_NO_CACHE);
-		page = vmalloc_to_page(ctx->csa.lscsa->ls + offset);
+		pfn = vmalloc_to_pfn(ctx->csa.lscsa->ls + offset);
 	} else {
 		vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
-							| _PAGE_NO_CACHE);
-		page = pfn_to_page((ctx->spu->local_store_phys + offset)
-				   >> PAGE_SHIFT);
+					     | _PAGE_NO_CACHE);
+		pfn = (ctx->spu->local_store_phys + offset) >> PAGE_SHIFT;
 	}
-	spu_release(ctx);
+	vm_insert_pfn(vma, address, pfn);
 
-	if (type)
-		*type = VM_FAULT_MINOR;
+	spu_release(ctx);
 
-	page_cache_get(page);
-	return page;
+	return NOPFN_REFAULT;
 }
 
+
 static struct vm_operations_struct spufs_mem_mmap_vmops = {
-	.nopage = spufs_mem_mmap_nopage,
+	.nopfn = spufs_mem_mmap_nopfn,
 };
 
 static int
@@ -136,7 +132,7 @@ spufs_mem_mmap(struct file *file, struct
 	if (!(vma->vm_flags & VM_SHARED))
 		return -EINVAL;
 
-	vma->vm_flags |= VM_IO;
+	vma->vm_flags |= VM_IO | VM_PFNMAP;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
 				     | _PAGE_NO_CACHE);
 
@@ -152,49 +148,42 @@ static struct file_operations spufs_mem_
 	.mmap    = spufs_mem_mmap,
 };
 
-static struct page *spufs_ps_nopage(struct vm_area_struct *vma,
+static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma,
 				    unsigned long address,
-				    int *type, unsigned long ps_offs,
+				    unsigned long ps_offs,
 				    unsigned long ps_size)
 {
-	struct page *page = NOPAGE_SIGBUS;
-	int fault_type = VM_FAULT_SIGBUS;
 	struct spu_context *ctx = vma->vm_file->private_data;
-	unsigned long offset = address - vma->vm_start;
-	unsigned long area;
+	unsigned long area, offset = address - vma->vm_start;
 	int ret;
 
 	offset += vma->vm_pgoff << PAGE_SHIFT;
 	if (offset >= ps_size)
-		goto out;
+		return NOPFN_SIGBUS;
 
+	/* error here usually means a signal.. we might want to test
+	 * the error code more precisely though
+	 */
 	ret = spu_acquire_runnable(ctx);
 	if (ret)
-		goto out;
+		return NOPFN_REFAULT;
 
 	area = ctx->spu->problem_phys + ps_offs;
-	page = pfn_to_page((area + offset) >> PAGE_SHIFT);
-	fault_type = VM_FAULT_MINOR;
-	page_cache_get(page);
-
+	vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT);
 	spu_release(ctx);
 
-      out:
-	if (type)
-		*type = fault_type;
-
-	return page;
+	return NOPFN_REFAULT;
 }
 
 #if SPUFS_MMAP_4K
-static struct page *spufs_cntl_mmap_nopage(struct vm_area_struct *vma,
-					   unsigned long address, int *type)
+static unsigned long spufs_cntl_mmap_nopfn(struct vm_area_struct *vma,
+					   unsigned long address)
 {
-	return spufs_ps_nopage(vma, address, type, 0x4000, 0x1000);
+	return spufs_ps_nopfn(vma, address, 0x4000, 0x1000);
 }
 
 static struct vm_operations_struct spufs_cntl_mmap_vmops = {
-	.nopage = spufs_cntl_mmap_nopage,
+	.nopfn = spufs_cntl_mmap_nopfn,
 };
 
 /*
@@ -205,7 +194,7 @@ static int spufs_cntl_mmap(struct file *
 	if (!(vma->vm_flags & VM_SHARED))
 		return -EINVAL;
 
-	vma->vm_flags |= VM_IO;
+	vma->vm_flags |= VM_IO | VM_PFNMAP;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
 				     | _PAGE_NO_CACHE | _PAGE_GUARDED);
 
@@ -791,23 +780,23 @@ static ssize_t spufs_signal1_write(struc
 	return 4;
 }
 
-static struct page *spufs_signal1_mmap_nopage(struct vm_area_struct *vma,
-					      unsigned long address, int *type)
+static unsigned long spufs_signal1_mmap_nopfn(struct vm_area_struct *vma,
+					      unsigned long address)
 {
 #if PAGE_SIZE == 0x1000
-	return spufs_ps_nopage(vma, address, type, 0x14000, 0x1000);
+	return spufs_ps_nopfn(vma, address, 0x14000, 0x1000);
 #elif PAGE_SIZE == 0x10000
 	/* For 64k pages, both signal1 and signal2 can be used to mmap the whole
 	 * signal 1 and 2 area
 	 */
-	return spufs_ps_nopage(vma, address, type, 0x10000, 0x10000);
+	return spufs_ps_nopfn(vma, address, 0x10000, 0x10000);
 #else
 #error unsupported page size
 #endif
 }
 
 static struct vm_operations_struct spufs_signal1_mmap_vmops = {
-	.nopage = spufs_signal1_mmap_nopage,
+	.nopfn = spufs_signal1_mmap_nopfn,
 };
 
 static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
@@ -899,23 +888,23 @@ static ssize_t spufs_signal2_write(struc
 }
 
 #if SPUFS_MMAP_4K
-static struct page *spufs_signal2_mmap_nopage(struct vm_area_struct *vma,
-					      unsigned long address, int *type)
+static unsigned long spufs_signal2_mmap_nopfn(struct vm_area_struct *vma,
+					      unsigned long address)
 {
 #if PAGE_SIZE == 0x1000
-	return spufs_ps_nopage(vma, address, type, 0x1c000, 0x1000);
+	return spufs_ps_nopfn(vma, address, 0x1c000, 0x1000);
 #elif PAGE_SIZE == 0x10000
 	/* For 64k pages, both signal1 and signal2 can be used to mmap the whole
 	 * signal 1 and 2 area
 	 */
-	return spufs_ps_nopage(vma, address, type, 0x10000, 0x10000);
+	return spufs_ps_nopfn(vma, address, 0x10000, 0x10000);
 #else
 #error unsupported page size
 #endif
 }
 
 static struct vm_operations_struct spufs_signal2_mmap_vmops = {
-	.nopage = spufs_signal2_mmap_nopage,
+	.nopfn = spufs_signal2_mmap_nopfn,
 };
 
 static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
@@ -1000,14 +989,14 @@ DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_ty
 					spufs_signal2_type_set, "%llu");
 
 #if SPUFS_MMAP_4K
-static struct page *spufs_mss_mmap_nopage(struct vm_area_struct *vma,
-					   unsigned long address, int *type)
+static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma,
+					  unsigned long address)
 {
-	return spufs_ps_nopage(vma, address, type, 0x0000, 0x1000);
+	return spufs_ps_nopfn(vma, address, 0x0000, 0x1000);
 }
 
 static struct vm_operations_struct spufs_mss_mmap_vmops = {
-	.nopage = spufs_mss_mmap_nopage,
+	.nopfn = spufs_mss_mmap_nopfn,
 };
 
 /*
@@ -1042,14 +1031,14 @@ static struct file_operations spufs_mss_
 	.mmap	 = spufs_mss_mmap,
 };
 
-static struct page *spufs_psmap_mmap_nopage(struct vm_area_struct *vma,
-					   unsigned long address, int *type)
+static unsigned long spufs_psmap_mmap_nopfn(struct vm_area_struct *vma,
+					    unsigned long address)
 {
-	return spufs_ps_nopage(vma, address, type, 0x0000, 0x20000);
+	return spufs_ps_nopfn(vma, address, 0x0000, 0x20000);
 }
 
 static struct vm_operations_struct spufs_psmap_mmap_vmops = {
-	.nopage = spufs_psmap_mmap_nopage,
+	.nopfn = spufs_psmap_mmap_nopfn,
 };
 
 /*
@@ -1083,14 +1072,14 @@ static struct file_operations spufs_psma
 
 
 #if SPUFS_MMAP_4K
-static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma,
-					   unsigned long address, int *type)
+static unsigned long spufs_mfc_mmap_nopfn(struct vm_area_struct *vma,
+					  unsigned long address)
 {
-	return spufs_ps_nopage(vma, address, type, 0x3000, 0x1000);
+	return spufs_ps_nopfn(vma, address, 0x3000, 0x1000);
 }
 
 static struct vm_operations_struct spufs_mfc_mmap_vmops = {
-	.nopage = spufs_mfc_mmap_nopage,
+	.nopfn = spufs_mfc_mmap_nopfn,
 };
 
 /*
Index: linux-cell/arch/powerpc/Kconfig
===================================================================
--- linux-cell.orig/arch/powerpc/Kconfig	2007-02-06 15:39:25.000000000 +1100
+++ linux-cell/arch/powerpc/Kconfig	2007-02-06 15:39:35.000000000 +1100
@@ -832,7 +832,7 @@ config ARCH_SPARSEMEM_ENABLE
 
 config ARCH_SPARSEMEM_DEFAULT
 	def_bool y
-	depends on (SMP && PPC_PSERIES) || PPC_CELL
+	depends on (SMP && PPC_PSERIES) || PPC_PS3
 
 config ARCH_POPULATES_NODE_MAP
 	def_bool y

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] spufs: remove need for struct page for SPEs
  2007-02-07  4:50 ` [PATCH 3/3] spufs: remove need for struct page for SPEs Benjamin Herrenschmidt
@ 2007-02-07  4:55   ` Benjamin Herrenschmidt
  2007-02-07 14:52   ` [Cbe-oss-dev] " Christoph Hellwig
  2007-02-07 22:21   ` Andrew Morton
  2 siblings, 0 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-07  4:55 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Andrew Morton, cbe-oss-dev, Arnd Bergmann

On Wed, 2007-02-07 at 15:50 +1100, Benjamin Herrenschmidt wrote:
> This patch removes the need for struct page for SPE local store
> and registers from spufs. It also makes the locking much more
> obvious and no longer relying on the truncate logic black magic
> for protecting against races between unmap_mapping_range() and
> new pages faulted in. It does so by switching to a nopfn() handler
> and using the new vm_insert_pfn() to setup the PTEs itself while
> holding a lock on the SPE.
> 
> The nice thing is that this patch actually removes a lot more code
> than it adds :-)
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> 
>  Kconfig                         |    2

Hrm... diffstat got screwed up by my script, should be:

 Kconfig                         |    2
 platforms/cell/spu_priv1_mmio.c |   65 +----------------------
 platforms/cell/spufs/file.c     |  111 ++++++++++++++++++----------------------
 3 files changed, 55 insertions(+), 123 deletions(-)

Ben.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] spufs: don't need struct page for SPEs
  2007-02-07  4:50 [PATCH 0/3] spufs: don't need struct page for SPEs Benjamin Herrenschmidt
                   ` (2 preceding siblings ...)
  2007-02-07  4:50 ` [PATCH 3/3] spufs: remove need for struct page for SPEs Benjamin Herrenschmidt
@ 2007-02-07 14:39 ` Arnd Bergmann
  3 siblings, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2007-02-07 14:39 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Andrew Morton, cbe-oss-dev

On Wednesday 07 February 2007 05:50, Benjamin Herrenschmidt wrote:
> I have no firm feeling on wether those should be in 2.6.21 or not,
> they are pre-requisite for some other work I'm doing with spufs but
> which won't be in 2.6.21 (well, I don't think it will be ready in time
> and it doesn't really matter) so I'm mostly posting this here for
> review/comment/backup :-) I would appreciate testing too, I did some
> tests here and they seem to pass but heh, the more the better.

I'd say they should go in. The code is clearly moving things into
the right direction. In fact, we have recently discovered a bug
in the SPU management that might be fixed by just applying your
patch, but that still needs to be investigated.

	Arnd <><

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cbe-oss-dev] [PATCH 3/3] spufs: remove need for struct page for SPEs
  2007-02-07  4:50 ` [PATCH 3/3] spufs: remove need for struct page for SPEs Benjamin Herrenschmidt
  2007-02-07  4:55   ` Benjamin Herrenschmidt
@ 2007-02-07 14:52   ` Christoph Hellwig
  2007-02-07 22:21   ` Andrew Morton
  2 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2007-02-07 14:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Andrew Morton, linuxppc-dev, cbe-oss-dev, Arnd Bergmann

On Wed, Feb 07, 2007 at 03:50:52PM +1100, Benjamin Herrenschmidt wrote:
> This patch removes the need for struct page for SPE local store
> and registers from spufs. It also makes the locking much more
> obvious and no longer relying on the truncate logic black magic
> for protecting against races between unmap_mapping_range() and
> new pages faulted in. It does so by switching to a nopfn() handler
> and using the new vm_insert_pfn() to setup the PTEs itself while
> holding a lock on the SPE.
> 
> The nice thing is that this patch actually removes a lot more code
> than it adds :-)

Looks good to me.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] spufs: remove need for struct page for SPEs
  2007-02-07  4:50 ` [PATCH 3/3] spufs: remove need for struct page for SPEs Benjamin Herrenschmidt
  2007-02-07  4:55   ` Benjamin Herrenschmidt
  2007-02-07 14:52   ` [Cbe-oss-dev] " Christoph Hellwig
@ 2007-02-07 22:21   ` Andrew Morton
  2007-02-07 23:15     ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2007-02-07 22:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann

On Wed, 07 Feb 2007 15:50:52 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> This patch removes the need for struct page for SPE local store
> and registers from spufs. It also makes the locking much more
> obvious and no longer relying on the truncate logic black magic
> for protecting against races between unmap_mapping_range() and
> new pages faulted in. It does so by switching to a nopfn() handler
> and using the new vm_insert_pfn() to setup the PTEs itself while
> holding a lock on the SPE.

Some of this patch seems to already be in Paul's tree.  Or something.
I'll duck this patch.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] spufs: remove need for struct page for SPEs
  2007-02-07 22:21   ` Andrew Morton
@ 2007-02-07 23:15     ` Benjamin Herrenschmidt
  2007-02-09  3:59       ` [Cbe-oss-dev] " Benjamin Herrenschmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-07 23:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann

On Wed, 2007-02-07 at 14:21 -0800, Andrew Morton wrote:
> On Wed, 07 Feb 2007 15:50:52 +1100
> Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> > This patch removes the need for struct page for SPE local store
> > and registers from spufs. It also makes the locking much more
> > obvious and no longer relying on the truncate logic black magic
> > for protecting against races between unmap_mapping_range() and
> > new pages faulted in. It does so by switching to a nopfn() handler
> > and using the new vm_insert_pfn() to setup the PTEs itself while
> > holding a lock on the SPE.
> 
> Some of this patch seems to already be in Paul's tree.  Or something.
> I'll duck this patch.

Yeah, the vm_insert_pfn from nick and my NOPFN_REFAULT are in -mm
already (though not via paulus tree).

Only the 3rd patch in the serie is "new". Duck it for now, I posted it
mostly for review/comments, if it goes it, it will go through Paulus
though I will need Nick's vm_insert_pfn and and my NOPFN_REFAULT in
first and that's where you get involved :-)

Ben.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cbe-oss-dev] [PATCH 3/3] spufs: remove need for struct page for SPEs
  2007-02-07 23:15     ` Benjamin Herrenschmidt
@ 2007-02-09  3:59       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 10+ messages in thread
From: Benjamin Herrenschmidt @ 2007-02-09  3:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann


> Only the 3rd patch in the serie is "new". Duck it for now, I posted it
> mostly for review/comments, if it goes it, it will go through Paulus
> though I will need Nick's vm_insert_pfn and and my NOPFN_REFAULT in
> first and that's where you get involved :-)

BTW, Patch has a bug, it doesn't set VM_PFNMAP in all mmap calls, fixing
that now.

Ben.
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-02-09  3:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07  4:50 [PATCH 0/3] spufs: don't need struct page for SPEs Benjamin Herrenschmidt
2007-02-07  4:50 ` [PATCH 1/3] add vm_insert_pfn() Benjamin Herrenschmidt
2007-02-07  4:50 ` [PATCH 2/3] Add NOPFN_REFAULT result from vm_ops->nopfn() Benjamin Herrenschmidt
2007-02-07  4:50 ` [PATCH 3/3] spufs: remove need for struct page for SPEs Benjamin Herrenschmidt
2007-02-07  4:55   ` Benjamin Herrenschmidt
2007-02-07 14:52   ` [Cbe-oss-dev] " Christoph Hellwig
2007-02-07 22:21   ` Andrew Morton
2007-02-07 23:15     ` Benjamin Herrenschmidt
2007-02-09  3:59       ` [Cbe-oss-dev] " Benjamin Herrenschmidt
2007-02-07 14:39 ` [PATCH 0/3] spufs: don't need " Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.