RE: [PATCH 1/2] powerpc: document the MPIC device tree binding

2011-01-20 Thread Yoder Stuart-B08248


 -Original Message-
 From: Meador Inge [mailto:meador_i...@mentor.com]
 Sent: Wednesday, January 19, 2011 6:08 PM
 To: Yoder Stuart-B08248
 Cc: Wood Scott-B07421; linuxppc-dev@lists.ozlabs.org; devicetree-
 disc...@lists.ozlabs.org; Blanchard, Hollis
 Subject: Re: [PATCH 1/2] powerpc: document the MPIC device tree binding
 
 On 01/19/2011 04:14 PM, Yoder Stuart-B08248 wrote:
 
  +** Optional properties:
  +
  +   - no-reset : The presence of this property indicates that the MPIC
  +should not be reset during runtime initialization.
  +   - protected-sources : Specifies a list of interrupt sources that
  + are not
  + available for use and whose corresponding
  + vectors
  + should not be initialized.  A typical use
  + case for
  + this property is in AMP systems where multiple
  + independent operating systems need to share
  + the MPIC
  + without clobbering each other.
 
  Is protected-sources really needed for AMP systems to tell the OSes
  not to clobber each other?  Won't each OS be given a device tree with
  only its interrupt sources?  ...so you know what you are allowed to
  touch.
 
 This was discussed a little bit already [1, 2].  The MPIC driver currently
 initializes the VECPRI register for all interrupt sources, which can lead
 to the aforementioned clobbering.

For sources that are protected and not to be touched, it seems
that the other need is for the OS to know (be guaranteed?) that
those sources have been put in state where the source is masked
or directed to other cores.   You can't have interrupts occurring
on sources that you are not allowed to initialize.

So the no-reset property could potentially cover this as well-- if it was
defined to mean don't reset the mpic and boot firmware has put all sources
in a sane initial state.   And we wouldn't need the protected-sources
property any longer.

Stuart


Right...so it would seem that the no-reset property if prop

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 0/4] De-couple sysfs memory directories from memory sections

2011-01-20 Thread Nathan Fontenot
This is a re-send of the remaining patches that did not make it
into the last kernel release for de-coupling sysfs memory
directories from memory sections.  The first three patches of the
previous set went in, and this is the remaining patches that
need to be applied.

The patches decouple the concept that a single memory section corresponds
to a single directory in /sys/devices/system/memory/.  On systems
with large amounts of memory (1+ TB) there are performance issues
related to creating the large number of sysfs directories.  For
a powerpc machine with 1 TB of memory we are creating 63,000+
directories.  This is resulting in boot times of around 45-50
minutes for systems with 1 TB of memory and 8+ hours for systems
with 2 TB of memory.  With this patch set applied I am now seeing
boot times of 5 minutes or less.

The root of this issue is in sysfs directory creation. Every time
a directory is created a string compare is done against sibling
directories ( see sysfs_find_dirent() ) to ensure we do not create 
duplicates.  The list of directory nodes in sysfs is kept as an
unsorted list which results in this being an exponentially longer
operation as the number of directories are created.

The solution solved by this patch set is to allow a single
directory in sysfs to span multiple memory sections.  This is
controlled by an optional architecturally defined function
memory_block_size_bytes().  The default definition of this
routine returns a memory block size equal to the memory section
size. This maintains the current layout of sysfs memory
directories as it appears to userspace to remain the same as it
is today.

For architectures that define their own version of this routine,
as is done for powerpc and x86 in this patchset, the view in userspace
would change such that each memoryXXX directory would span
multiple memory sections.  The number of sections spanned would
depend on the value reported by memory_block_size_bytes.

-Nathan Fontenot
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/4] Allow memory blocks to span multiple memory sections

2011-01-20 Thread Nathan Fontenot
Update the memory sysfs code such that each sysfs memory directory is now
considered a memory block that can span multiple memory sections per
memory block.  The default size of each memory block is SECTION_SIZE_BITS
to maintain the current behavior of having a single memory section per
memory block (i.e. one sysfs directory per memory section).

For architectures that want to have memory blocks span multiple
memory sections they need only define their own memory_block_size_bytes()
routine.

Update the memory hotplug documentation to reflect the new behaviors of
memory blocks reflected in sysfs.

Signed-off-by: Nathan Fontenot nf...@austin.ibm.com
Reviewed-by: Robin Holt h...@sgi.com
Reviewed-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com

---
 Documentation/memory-hotplug.txt |   47 +++
 drivers/base/memory.c|  155 +++
 2 files changed, 139 insertions(+), 63 deletions(-)

Index: linux-2.6/Documentation/memory-hotplug.txt
===
--- linux-2.6.orig/Documentation/memory-hotplug.txt 2011-01-05 
10:08:16.0 -0600
+++ linux-2.6/Documentation/memory-hotplug.txt  2011-01-05 10:17:37.0 
-0600
@@ -126,36 +126,51 @@ config options.
 
 4 sysfs files for memory hotplug
 
-All sections have their device information under /sys/devices/system/memory as
+All sections have their device information in sysfs.  Each section is part of
+a memory block under /sys/devices/system/memory as
 
 /sys/devices/system/memory/memoryXXX
-(XXX is section id.)
+(XXX is the section id.)
 
-Now, XXX is defined as start_address_of_section / section_size.
+Now, XXX is defined as (start_address_of_section / section_size) of the first
+section contained in the memory block.  The files 'phys_index' and
+'end_phys_index' under each directory report the beginning and end section id's
+for the memory block covered by the sysfs directory.  It is expected that all
+memory sections in this range are present and no memory holes exist in the
+range. Currently there is no way to determine if there is a memory hole, but
+the existence of one should not affect the hotplug capabilities of the memory
+block.
 
 For example, assume 1GiB section size. A device for a memory starting at
 0x1 is /sys/device/system/memory/memory4
 (0x1 / 1Gib = 4)
 This device covers address range [0x1 ... 0x14000)
 
-Under each section, you can see 4 files.
+Under each section, you can see 4 or 5 files, the end_phys_index file being
+a recent addition and not present on older kernels.
 
-/sys/devices/system/memory/memoryXXX/phys_index
+/sys/devices/system/memory/memoryXXX/start_phys_index
+/sys/devices/system/memory/memoryXXX/end_phys_index
 /sys/devices/system/memory/memoryXXX/phys_device
 /sys/devices/system/memory/memoryXXX/state
 /sys/devices/system/memory/memoryXXX/removable
 
-'phys_index' : read-only and contains section id, same as XXX.
-'state'  : read-write
-   at read:  contains online/offline state of memory.
-   at write: user can specify online, offline command
-'phys_device': read-only: designed to show the name of physical memory device.
-   This is not well implemented now.
-'removable'  : read-only: contains an integer value indicating
-   whether the memory section is removable or not
-   removable.  A value of 1 indicates that the memory
-   section is removable and a value of 0 indicates that
-   it is not removable.
+'phys_index'  : read-only and contains section id of the first section
+   in the memory block, same as XXX.
+'end_phys_index'  : read-only and contains section id of the last section
+   in the memory block.
+'state'   : read-write
+at read:  contains online/offline state of memory.
+at write: user can specify online, offline command
+which will be performed on al sections in the block.
+'phys_device' : read-only: designed to show the name of physical memory
+device.  This is not well implemented now.
+'removable'   : read-only: contains an integer value indicating
+whether the memory block is removable or not
+removable.  A value of 1 indicates that the memory
+block is removable and a value of 0 indicates that
+it is not removable. A memory block is removable only if
+every section in the block is removable.
 
 NOTE:
   These directories/files appear after physical memory hotplug phase.
Index: linux-2.6/drivers/base/memory.c
===
--- linux-2.6.orig/drivers/base/memory.c2011-01-05 10:08:16.0 
-0600
+++ 

[PATCH 2/4] Update phys_index to [start|end]_section_nr

2011-01-20 Thread Nathan Fontenot
Update the 'phys_index' property of a the memory_block struct to be
called start_section_nr, and add a end_section_nr property.  The
data tracked here is the same but the updated naming is more in line
with what is stored here, namely the first and last section number
that the memory block spans.

The names presented to userspace remain the same, phys_index for
start_section_nr and end_phys_index for end_section_nr, to avoid breaking
anything in userspace.

This also updates the node sysfs code to be aware of the new capability for
a memory block to contain multiple memory sections and be aware of the memory
block structure name changes (start_section_nr).  This requires an additional
parameter to unregister_mem_sect_under_nodes so that we know which memory
section of the memory block to unregister.

Signed-off-by: Nathan Fontenot nf...@austin.ibm.com
Reviewed-by: Robin Holt h...@sgi.com
Reviewed-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com

---
 drivers/base/memory.c  |   41 +++--
 drivers/base/node.c|   12 
 include/linux/memory.h |3 ++-
 include/linux/node.h   |6 --
 4 files changed, 45 insertions(+), 17 deletions(-)

Index: linux-2.6/drivers/base/memory.c
===
--- linux-2.6.orig/drivers/base/memory.c2011-01-20 08:20:54.0 
-0600
+++ linux-2.6/drivers/base/memory.c 2011-01-20 08:20:56.0 -0600
@@ -97,7 +97,7 @@ int register_memory(struct memory_block
int error;
 
memory-sysdev.cls = memory_sysdev_class;
-   memory-sysdev.id = memory-phys_index / sections_per_block;
+   memory-sysdev.id = memory-start_section_nr / sections_per_block;
 
error = sysdev_register(memory-sysdev);
return error;
@@ -138,12 +138,26 @@ static unsigned long get_memory_block_si
  * uses.
  */
 
-static ssize_t show_mem_phys_index(struct sys_device *dev,
+static ssize_t show_mem_start_phys_index(struct sys_device *dev,
struct sysdev_attribute *attr, char *buf)
 {
struct memory_block *mem =
container_of(dev, struct memory_block, sysdev);
-   return sprintf(buf, %08lx\n, mem-phys_index / sections_per_block);
+   unsigned long phys_index;
+
+   phys_index = mem-start_section_nr / sections_per_block;
+   return sprintf(buf, %08lx\n, phys_index);
+}
+
+static ssize_t show_mem_end_phys_index(struct sys_device *dev,
+   struct sysdev_attribute *attr, char *buf)
+{
+   struct memory_block *mem =
+   container_of(dev, struct memory_block, sysdev);
+   unsigned long phys_index;
+
+   phys_index = mem-end_section_nr / sections_per_block;
+   return sprintf(buf, %08lx\n, phys_index);
 }
 
 /*
@@ -158,7 +172,7 @@ static ssize_t show_mem_removable(struct
container_of(dev, struct memory_block, sysdev);
 
for (i = 0; i  sections_per_block; i++) {
-   pfn = section_nr_to_pfn(mem-phys_index + i);
+   pfn = section_nr_to_pfn(mem-start_section_nr + i);
ret = is_mem_section_removable(pfn, PAGES_PER_SECTION);
}
 
@@ -275,14 +289,15 @@ static int memory_block_change_state(str
mem-state = MEM_GOING_OFFLINE;
 
for (i = 0; i  sections_per_block; i++) {
-   ret = memory_section_action(mem-phys_index + i, to_state);
+   ret = memory_section_action(mem-start_section_nr + i,
+   to_state);
if (ret)
break;
}
 
if (ret) {
for (i = 0; i  sections_per_block; i++)
-   memory_section_action(mem-phys_index + i,
+   memory_section_action(mem-start_section_nr + i,
  from_state_req);
 
mem-state = from_state_req;
@@ -330,7 +345,8 @@ static ssize_t show_phys_device(struct s
return sprintf(buf, %d\n, mem-phys_device);
 }
 
-static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL);
+static SYSDEV_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL);
+static SYSDEV_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL);
 static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state);
 static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL);
 static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL);
@@ -522,17 +538,21 @@ static int init_memory_block(struct memo
return -ENOMEM;
 
scn_nr = __section_nr(section);
-   mem-phys_index = base_memory_block_id(scn_nr) * sections_per_block;
+   mem-start_section_nr =
+   base_memory_block_id(scn_nr) * sections_per_block;
+   mem-end_section_nr = mem-start_section_nr + sections_per_block - 1;
mem-state = state;
mem-section_count++;
mutex_init(mem-state_mutex);
-   start_pfn = 

[PATCH 3/4]Define memory_block_size_bytes for powerpc/pseries

2011-01-20 Thread Nathan Fontenot
Define a version of memory_block_size_bytes() for powerpc/pseries such that
a memory block spans an entire lmb.

Signed-off-by: Nathan Fontenot nf...@austin.ibm.com
Reviewed-by: Robin Holt h...@sgi.com

---
 arch/powerpc/platforms/pseries/hotplug-memory.c |   66 +++-
 1 file changed, 53 insertions(+), 13 deletions(-)

Index: linux-2.6/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- linux-2.6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c  
2011-01-20 08:18:21.0 -0600
+++ linux-2.6/arch/powerpc/platforms/pseries/hotplug-memory.c   2011-01-20 
08:21:07.0 -0600
@@ -17,6 +17,54 @@
 #include asm/pSeries_reconfig.h
 #include asm/sparsemem.h
 
+static unsigned long get_memblock_size(void)
+{
+   struct device_node *np;
+   unsigned int memblock_size = 0;
+
+   np = of_find_node_by_path(/ibm,dynamic-reconfiguration-memory);
+   if (np) {
+   const unsigned long *size;
+
+   size = of_get_property(np, ibm,lmb-size, NULL);
+   memblock_size = size ? *size : 0;
+
+   of_node_put(np);
+   } else {
+   unsigned int memzero_size = 0;
+   const unsigned int *regs;
+
+   np = of_find_node_by_path(/memory@0);
+   if (np) {
+   regs = of_get_property(np, reg, NULL);
+   memzero_size = regs ? regs[3] : 0;
+   of_node_put(np);
+   }
+
+   if (memzero_size) {
+   /* We now know the size of memory@0, use this to find
+* the first memoryblock and get its size.
+*/
+   char buf[64];
+
+   sprintf(buf, /memory@%x, memzero_size);
+   np = of_find_node_by_path(buf);
+   if (np) {
+   regs = of_get_property(np, reg, NULL);
+   memblock_size = regs ? regs[3] : 0;
+   of_node_put(np);
+   }
+   }
+   }
+
+   return memblock_size;
+}
+
+unsigned long memory_block_size_bytes(void)
+{
+   return get_memblock_size();
+}
+
 static int pseries_remove_memblock(unsigned long base, unsigned int 
memblock_size)
 {
unsigned long start, start_pfn;
@@ -127,30 +175,22 @@ static int pseries_add_memory(struct dev
 
 static int pseries_drconf_memory(unsigned long *base, unsigned int action)
 {
-   struct device_node *np;
-   const unsigned long *lmb_size;
+   unsigned long memblock_size;
int rc;
 
-   np = of_find_node_by_path(/ibm,dynamic-reconfiguration-memory);
-   if (!np)
+   memblock_size = get_memblock_size();
+   if (!memblock_size)
return -EINVAL;
 
-   lmb_size = of_get_property(np, ibm,lmb-size, NULL);
-   if (!lmb_size) {
-   of_node_put(np);
-   return -EINVAL;
-   }
-
if (action == PSERIES_DRCONF_MEM_ADD) {
-   rc = memblock_add(*base, *lmb_size);
+   rc = memblock_add(*base, memblock_size);
rc = (rc  0) ? -EINVAL : 0;
} else if (action == PSERIES_DRCONF_MEM_REMOVE) {
-   rc = pseries_remove_memblock(*base, *lmb_size);
+   rc = pseries_remove_memblock(*base, memblock_size);
} else {
rc = -EINVAL;
}
 
-   of_node_put(np);
return rc;
 }
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 4/4] Define memory_block_size_bytes for x86_64 with CONFIG_X86_UV

2011-01-20 Thread Nathan Fontenot
Define a version of memory_block_size_bytes for x86_64 when CONFIG_X86_UV is
set.

Signed-off-by: Robin Holt h...@sgi.com
Signed-off-by: Jack Steiner stei...@sgi.com
Signed-off-by: Nathan Fontenot nf...@austin.ibm.com

---
 arch/x86/mm/init_64.c |   14 ++
 1 file changed, 14 insertions(+)

Index: linux-2.6/arch/x86/mm/init_64.c
===
--- linux-2.6.orig/arch/x86/mm/init_64.c2011-01-20 08:18:20.0 
-0600
+++ linux-2.6/arch/x86/mm/init_64.c 2011-01-20 08:21:10.0 -0600
@@ -51,6 +51,7 @@
 #include asm/numa.h
 #include asm/cacheflush.h
 #include asm/init.h
+#include asm/uv/uv.h
 
 static int __init parse_direct_gbpages_off(char *arg)
 {
@@ -908,6 +909,19 @@ const char *arch_vma_name(struct vm_area
return NULL;
 }
 
+#ifdef CONFIG_X86_UV
+#define MIN_MEMORY_BLOCK_SIZE   (1  SECTION_SIZE_BITS)
+
+unsigned long memory_block_size_bytes(void)
+{
+   if (is_uv_system()) {
+   printk(KERN_INFO UV: memory block size 2GB\n);
+   return 2UL * 1024 * 1024 * 1024;
+   }
+   return MIN_MEMORY_BLOCK_SIZE;
+}
+#endif
+
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 /*
  * Initialise the sparsemem vmemmap using huge-pages at the PMD level.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 0/4] De-couple sysfs memory directories from memory sections

2011-01-20 Thread Greg KH
On Thu, Jan 20, 2011 at 10:36:40AM -0600, Nathan Fontenot wrote:
 The root of this issue is in sysfs directory creation. Every time
 a directory is created a string compare is done against sibling
 directories ( see sysfs_find_dirent() ) to ensure we do not create 
 duplicates.  The list of directory nodes in sysfs is kept as an
 unsorted list which results in this being an exponentially longer
 operation as the number of directories are created.

Again, are you sure about this?  I thought we resolved this issue in the
past, but you were going to check it.  Did you?

thanks,

greg k-h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 0/4] De-couple sysfs memory directories from memory sections

2011-01-20 Thread Nathan Fontenot
On 01/20/2011 10:45 AM, Greg KH wrote:
 On Thu, Jan 20, 2011 at 10:36:40AM -0600, Nathan Fontenot wrote:
 The root of this issue is in sysfs directory creation. Every time
 a directory is created a string compare is done against sibling
 directories ( see sysfs_find_dirent() ) to ensure we do not create 
 duplicates.  The list of directory nodes in sysfs is kept as an
 unsorted list which results in this being an exponentially longer
 operation as the number of directories are created.
 
 Again, are you sure about this?  I thought we resolved this issue in the
 past, but you were going to check it.  Did you?
 

Yes, the string compare is still present in the sysfs code.  There was
discussion around this sometime last year when I sent a patch out that
stored the directory entries in something other than a linked list.
That patch was rejected but it was agreed that something should be done.

-Nathan
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 0/4] De-couple sysfs memory directories from memory sections

2011-01-20 Thread Dave Hansen
On Thu, 2011-01-20 at 08:45 -0800, Greg KH wrote:
 On Thu, Jan 20, 2011 at 10:36:40AM -0600, Nathan Fontenot wrote:
  The root of this issue is in sysfs directory creation. Every time
  a directory is created a string compare is done against sibling
  directories ( see sysfs_find_dirent() ) to ensure we do not create 
  duplicates.  The list of directory nodes in sysfs is kept as an
  unsorted list which results in this being an exponentially longer
  operation as the number of directories are created.
 
 Again, are you sure about this?  I thought we resolved this issue in the
 past, but you were going to check it.  Did you?

Just to be clear, simply reducing the number of kobjects can make these
patches worthwhile on their own.  I originally figured that the
SECTION_SIZE would go up over time as systems got larger, and _that_
would keep the number of sections and number of sysfs objects down.
Well, that turned out to be wrong, and we're eating up a ton of memory
now.  We can't fix the SECTION_SIZE easily, but we can reduce the number
of kobjects that we need to track the sections.  *That* is the main
benefit I see from these patches.

I think there's a problem worth fixing, even ignoring the directory
creation issue (if it still exists).

-- Dave

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 0/4] De-couple sysfs memory directories from memory sections

2011-01-20 Thread Greg KH
On Thu, Jan 20, 2011 at 10:51:44AM -0600, Nathan Fontenot wrote:
 On 01/20/2011 10:45 AM, Greg KH wrote:
  On Thu, Jan 20, 2011 at 10:36:40AM -0600, Nathan Fontenot wrote:
  The root of this issue is in sysfs directory creation. Every time
  a directory is created a string compare is done against sibling
  directories ( see sysfs_find_dirent() ) to ensure we do not create 
  duplicates.  The list of directory nodes in sysfs is kept as an
  unsorted list which results in this being an exponentially longer
  operation as the number of directories are created.
  
  Again, are you sure about this?  I thought we resolved this issue in the
  past, but you were going to check it.  Did you?
  
 
 Yes, the string compare is still present in the sysfs code.  There was
 discussion around this sometime last year when I sent a patch out that
 stored the directory entries in something other than a linked list.
 That patch was rejected but it was agreed that something should be done.

Ah, ok, thanks for verifying.

greg k-h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] change acquire/release_console_sem() to console_lock/unlock()

2011-01-20 Thread Greg KH
On Thu, Jan 20, 2011 at 04:58:13PM +0100, Torben Hohn wrote:
 the -rt patches change the console_semaphore to console_mutex.
 so a quite large chunk of the patches changes all
 acquire/release_console_sem() to acquire/release_console_mutex()

Why not just change the functionality of the existing function to be a
mutex in the rt patches, instead of having to rename it everywhere?

 this commit makes things use more neutral function names
 which dont make implications about the underlying lock.
 
 the only real change is the return value of console_trylock
 which is inverted from try_acquire_console_sem()
 
 Signed-off-by: Torben Hohn torb...@gmx.de
 CC: Thomas Gleixner t...@tglx.de

I don't mind this rename, but is it really going to help anything out?
What's the odds of the -rt portion of this patch ever making it to
mainline?

thanks,

greg k-h
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] change acquire/release_console_sem() to console_lock/unlock()

2011-01-20 Thread torbenh
On Thu, Jan 20, 2011 at 08:34:48AM -0800, Greg KH wrote:
 On Thu, Jan 20, 2011 at 04:58:13PM +0100, Torben Hohn wrote:
  the -rt patches change the console_semaphore to console_mutex.
  so a quite large chunk of the patches changes all
  acquire/release_console_sem() to acquire/release_console_mutex()
 
 Why not just change the functionality of the existing function to be a
 mutex in the rt patches, instead of having to rename it everywhere?

i hope that Thomas already did this in his upcoming -rt series.

 
  this commit makes things use more neutral function names
  which dont make implications about the underlying lock.
  
  the only real change is the return value of console_trylock
  which is inverted from try_acquire_console_sem()
  
  Signed-off-by: Torben Hohn torb...@gmx.de
  CC: Thomas Gleixner t...@tglx.de
 
 I don't mind this rename, but is it really going to help anything out?
 What's the odds of the -rt portion of this patch ever making it to
 mainline?

the -rt portion only changes the semaphore to a mutex.
since the console_sem is used with mutex semantics, i dont see any
reason, not to merge that portion too. 

i am just trying to shrink the -rt patch to make it more maintanable :)

 
 thanks,
 
 greg k-h

-- 
torben Hohn
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] change acquire/release_console_sem() to console_lock/unlock()

2011-01-20 Thread Andrew Morton
On Thu, 20 Jan 2011 17:55:02 +0100
torbenh torb...@gmx.de wrote:

 On Thu, Jan 20, 2011 at 08:34:48AM -0800, Greg KH wrote:
  On Thu, Jan 20, 2011 at 04:58:13PM +0100, Torben Hohn wrote:
   the -rt patches change the console_semaphore to console_mutex.
   so a quite large chunk of the patches changes all
   acquire/release_console_sem() to acquire/release_console_mutex()
  
  Why not just change the functionality of the existing function to be a
  mutex in the rt patches, instead of having to rename it everywhere?
 
 i hope that Thomas already did this in his upcoming -rt series.
 
  
   this commit makes things use more neutral function names
   which dont make implications about the underlying lock.
   
   the only real change is the return value of console_trylock
   which is inverted from try_acquire_console_sem()
   
   Signed-off-by: Torben Hohn torb...@gmx.de
   CC: Thomas Gleixner t...@tglx.de
  
  I don't mind this rename, but is it really going to help anything out?
  What's the odds of the -rt portion of this patch ever making it to
  mainline?
 
 the -rt portion only changes the semaphore to a mutex.
 since the console_sem is used with mutex semantics, i dont see any
 reason, not to merge that portion too. 
 
 i am just trying to shrink the -rt patch to make it more maintanable :)
 

Yeah, I think it's a better name and if we can indeed switch that
semaphore to a mutex then that's a good thing to do.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Oops in trace_hardirqs_on (powerpc)

2011-01-20 Thread Steven Rostedt
On Wed, 2010-12-22 at 21:42 -0500, Steven Rostedt wrote:
 On Sun, 2010-12-19 at 14:27 +0100, Jörg Sommer wrote:
  Hi Steven,
  
 
  Did you've fixed this problem? The bug report is still marked as open.
  https://bugzilla.kernel.org/show_bug.cgi?id=16573
  
 
 I just posted a patch to that BZ. I have it here below too. Could you
 see if it fixes you problem. I only fixed the one place that you
 reported, it may need more fixes (and in that case a macro to do the
 work).
 
 I hit the same bug on my ppc64 box, and have a fix for that, that I'll
 post to LKML tomorrow.


Here's my official:

Signed-off-by: Steven Rostedt rost...@goodmis.org

-- Steve

 -- Steve
 
 diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
 index ed4aeb9..915cc03 100644
 --- a/arch/powerpc/kernel/entry_32.S
 +++ b/arch/powerpc/kernel/entry_32.S
 @@ -879,7 +879,18 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
*/
   andi.   r10,r9,MSR_EE
   beq 1f
 + /*
 +  * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
 +  * which is the stack frame here, we need to force a stack frame
 +  * in case we came from user space.
 +  */
 + stwur1,-32(r1)
 + mflrr0
 + stw r0,4(r1)
 + stwur1,-32(r1)
   bl  trace_hardirqs_on
 + lwz r1,0(r1)
 + lwz r1,0(r1)
   lwz r9,_MSR(r1)
  1:
  #endif /* CONFIG_TRACE_IRQFLAGS */
 


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


of_flat_dt_match() helper build FAIL

2011-01-20 Thread Benjamin Herrenschmidt
a4f740cf33f7f6c164bbde3c0cdbcc77b0c4997c introduces:

/arch/powerpc/platforms/83xx/mpc831x_rdb.c:63: error: expected '{'
before 'const'

 and more...

This hunk is obviously bogus:

+struct const char *board[] __initdata = {
+   MPC8313ERDB,
+   fsl,mpc8315erdb,
+   NULL
+}
+

You should at least compile test your changes :-(

Please send Linus a fix.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: of_flat_dt_match() helper build FAIL

2011-01-20 Thread Stephen Rothwell
Hi Ben,

On Fri, 21 Jan 2011 13:15:22 +1100 Benjamin Herrenschmidt 
b...@kernel.crashing.org wrote:

 a4f740cf33f7f6c164bbde3c0cdbcc77b0c4997c introduces:
 
 /arch/powerpc/platforms/83xx/mpc831x_rdb.c:63: error: expected '{'
 before 'const'
 
  and more...
 
 This hunk is obviously bogus:
 
 +struct const char *board[] __initdata = {
 + MPC8313ERDB,
 + fsl,mpc8315erdb,
 + NULL
 +}
 +
 
 You should at least compile test your changes :-(
 
 Please send Linus a fix.

Its already in Grant's devicetree/merge branch (which I assume he will
ask you to pull soon) and has been in linux-next for the past 2 days.

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


pgpxB7MKAewpw.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 7/8] powerpc/kdump: Move crash_kexec_stop_spus to kdump crash handler

2011-01-20 Thread Anton Blanchard

And here's a version that actually compiles. Sorry Ben :)

Anton
--

Use the crash handler hooks to run the SPU stop code, just like we do for
ehea and cell RAS code.

While I'm here I noticed CPUSs reliabally

so fix the spelling MISTAKESs reliabally.

Signed-off-by: Anton Blanchard an...@samba.org
---

Index: powerpc.git/arch/powerpc/kernel/crash.c
===
--- powerpc.git.orig/arch/powerpc/kernel/crash.c2011-01-21 
13:41:01.192747292 +1100
+++ powerpc.git/arch/powerpc/kernel/crash.c 2011-01-21 13:41:07.272364454 
+1100
@@ -48,7 +48,7 @@ int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 cpumask_t cpus_in_sr = CPU_MASK_NONE;
 
-#define CRASH_HANDLER_MAX 2
+#define CRASH_HANDLER_MAX 3
 /* NULL terminated list of shutdown handles */
 static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
 static DEFINE_SPINLOCK(crash_handlers_lock);
@@ -125,7 +125,7 @@ static void crash_kexec_prepare_cpus(int
smp_wmb();
 
/*
-* FIXME: Until we will have the way to stop other CPUSs reliabally,
+* FIXME: Until we will have the way to stop other CPUs reliably,
 * the crash CPU will send an IPI and wait for other CPUs to
 * respond.
 * Delay of at least 10 seconds.
@@ -254,72 +254,6 @@ void crash_kexec_secondary(struct pt_reg
cpus_in_sr = CPU_MASK_NONE;
 }
 #endif
-#ifdef CONFIG_SPU_BASE
-
-#include asm/spu.h
-#include asm/spu_priv1.h
-
-struct crash_spu_info {
-   struct spu *spu;
-   u32 saved_spu_runcntl_RW;
-   u32 saved_spu_status_R;
-   u32 saved_spu_npc_RW;
-   u64 saved_mfc_sr1_RW;
-   u64 saved_mfc_dar;
-   u64 saved_mfc_dsisr;
-};
-
-#define CRASH_NUM_SPUS 16  /* Enough for current hardware */
-static struct crash_spu_info crash_spu_info[CRASH_NUM_SPUS];
-
-static void crash_kexec_stop_spus(void)
-{
-   struct spu *spu;
-   int i;
-   u64 tmp;
-
-   for (i = 0; i  CRASH_NUM_SPUS; i++) {
-   if (!crash_spu_info[i].spu)
-   continue;
-
-   spu = crash_spu_info[i].spu;
-
-   crash_spu_info[i].saved_spu_runcntl_RW =
-   in_be32(spu-problem-spu_runcntl_RW);
-   crash_spu_info[i].saved_spu_status_R =
-   in_be32(spu-problem-spu_status_R);
-   crash_spu_info[i].saved_spu_npc_RW =
-   in_be32(spu-problem-spu_npc_RW);
-
-   crash_spu_info[i].saved_mfc_dar= spu_mfc_dar_get(spu);
-   crash_spu_info[i].saved_mfc_dsisr  = spu_mfc_dsisr_get(spu);
-   tmp = spu_mfc_sr1_get(spu);
-   crash_spu_info[i].saved_mfc_sr1_RW = tmp;
-
-   tmp = ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
-   spu_mfc_sr1_set(spu, tmp);
-
-   __delay(200);
-   }
-}
-
-void crash_register_spus(struct list_head *list)
-{
-   struct spu *spu;
-
-   list_for_each_entry(spu, list, full_list) {
-   if (WARN_ON(spu-number = CRASH_NUM_SPUS))
-   continue;
-
-   crash_spu_info[spu-number].spu = spu;
-   }
-}
-
-#else
-static inline void crash_kexec_stop_spus(void)
-{
-}
-#endif /* CONFIG_SPU_BASE */
 
 /*
  * Register a function to be called on shutdown.  Only use this if you
@@ -439,8 +373,6 @@ void default_machine_crash_shutdown(stru
crash_shutdown_cpu = -1;
__debugger_fault_handler = old_handler;
 
-   crash_kexec_stop_spus();
-
if (ppc_md.kexec_cpu_down)
ppc_md.kexec_cpu_down(1, 0);
 }
Index: powerpc.git/arch/powerpc/platforms/cell/spu_base.c
===
--- powerpc.git.orig/arch/powerpc/platforms/cell/spu_base.c 2011-01-21 
13:41:01.192747292 +1100
+++ powerpc.git/arch/powerpc/platforms/cell/spu_base.c  2011-01-21 
13:42:12.358265951 +1100
@@ -37,6 +37,7 @@
 #include asm/spu_csa.h
 #include asm/xmon.h
 #include asm/prom.h
+#include asm/kexec.h
 
 const struct spu_management_ops *spu_management_ops;
 EXPORT_SYMBOL_GPL(spu_management_ops);
@@ -727,6 +728,75 @@ static ssize_t spu_stat_show(struct sys_
 
 static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);
 
+#ifdef CONFIG_KEXEC
+
+struct crash_spu_info {
+   struct spu *spu;
+   u32 saved_spu_runcntl_RW;
+   u32 saved_spu_status_R;
+   u32 saved_spu_npc_RW;
+   u64 saved_mfc_sr1_RW;
+   u64 saved_mfc_dar;
+   u64 saved_mfc_dsisr;
+};
+
+#define CRASH_NUM_SPUS 16  /* Enough for current hardware */
+static struct crash_spu_info crash_spu_info[CRASH_NUM_SPUS];
+
+static void crash_kexec_stop_spus(void)
+{
+   struct spu *spu;
+   int i;
+   u64 tmp;
+
+   for (i = 0; i  CRASH_NUM_SPUS; i++) {
+   if (!crash_spu_info[i].spu)
+   continue;
+
+   spu = crash_spu_info[i].spu;
+
+   crash_spu_info[i].saved_spu_runcntl_RW =
+   

[git pull] Please pull powerpc.git merge branch

2011-01-20 Thread Benjamin Herrenschmidt
Hi Linus !

Here's a bunch of powerpc stuff for you to pull. There's a whole series from
Anton which is in large part trivial cleanups, but it's all obvious enough
stuff or worthy enough fixes that I decided to not wait until the next merge
window (besides it's from Anton :-)

The rest is generally minor fixes. The two simple_write_to_buffer changes
from Akinobu were around for a while (and Andrew had picked them up already),
I just happen to have missed them in my collection for the previous batch.

Cheers,
Ben.

The following changes since commit 12fcdba1b7ae8b25696433f420b775aeb556d89b:

  Merge branch 'x86-fixes-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip (2011-01-19 
20:27:25 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

Akinobu Mita (2):
  powerpc/spufs: Use simple_write_to_buffer
  powerpc/rtas_flash: Use simple_read_from_buffer

Anton Blanchard (19):
  powerpc/kexec: Move all ppc_md kexec function pointers together
  powerpc/kexec: Remove ppc_md.machine_kexec_cleanup
  powerpc/kexec: Remove ppc_md.machine_kexec
  powerpc/kdump: Remove ppc_md.machine_crash_shutdown
  powerpc/kexec: Don't initialise kexec hooks to default handlers
  powerpc/kexec: Remove empty ppc_md.machine_kexec_prepare
  powerpc/kdump: Move crash_kexec_stop_spus to kdump crash handler
  powerpc/kdump: Disable ftrace during kexec
  powerpc: Print 32 bits of DSISR in show_regs
  powerpc: Don't force MSR_RI in machine_check_exception
  powerpc: Never halt RTAS error logging after receiving an unrecoverable 
machine check
  powerpc: Remove duplicate debugger hook in machine_check_exception
  powerpc: Don't silently handle machine checks from userspace
  powerpc: Rework pseries machine check handler
  powerpc: Fix corruption when grabbing FWNMI data
  powerpc: Check RTAS extended log flag before checking length
  powerpc: machine_check_generic is wrong on 64bit
  powerpc: Disable mcount tracers in pseries defconfig
  powerpc: Enable 64kB pages and 1024 threads in pseries config

Ben Hutchings (1):
  powerpc/boot/dts: Install dts from the right directory

Benjamin Herrenschmidt (1):
  Merge remote branch 'kumar/next' into merge

Ilya Yanok (1):
  powerpc/mpc8308: fix USB DR controller initialization

Li Yang (1):
  powerpc/85xx: add e500 HID1 bit definition

Michael Ellerman (1):
  powerpc: Ensure the else case of feature sections will fit

Nishanth Aravamudan (1):
  powerpc/pseries: Add BNX2=m to defconfig

Scott Wood (1):
  powerpc/mpic: Fix mask/unmask timeout message

Shaohui Xie (1):
  powerpc/fsl_rio: Fix non-standard HID1 register access

Steven Rostedt (2):
  powerpc/ppc64/tracing: Add stack frame to calls of trace_hardirqs_on/off
  powerpc/ppc32/tracing: Add stack frame to calls of trace_hardirqs_on/off

Tejun Heo (1):
  powerpc/cell: Use system_wq in cpufreq_spudemand

Timur Tabi (2):
  powerpc/85xx: fix compatible properties of the P1022DS DMA nodes used for 
audio
  powerpc: fix warning when compiling immap_qe.h

roel kluin (1):
  powerpc/macintosh: Fix wrong test in fan_{read,write}_reg()

 arch/powerpc/boot/Makefile  |2 +-
 arch/powerpc/boot/dts/mpc8308rdb.dts|2 +-
 arch/powerpc/boot/dts/p1022ds.dts   |4 +-
 arch/powerpc/configs/pseries_defconfig  |7 +-
 arch/powerpc/include/asm/feature-fixups.h   |   27 ---
 arch/powerpc/include/asm/immap_qe.h |   21 --
 arch/powerpc/include/asm/irqflags.h |   40 +++--
 arch/powerpc/include/asm/machdep.h  |   18 +
 arch/powerpc/include/asm/reg.h  |2 +
 arch/powerpc/include/asm/reg_booke.h|   14 +++
 arch/powerpc/include/asm/spu.h  |8 --
 arch/powerpc/kernel/cpu_setup_fsl_booke.S   |6 ++
 arch/powerpc/kernel/cputable.c  |   23 -
 arch/powerpc/kernel/crash.c |   72 +
 arch/powerpc/kernel/entry_32.S  |   11 +++
 arch/powerpc/kernel/machine_kexec.c |   19 ++--
 arch/powerpc/kernel/process.c   |2 +-
 arch/powerpc/kernel/rtas_flash.c|   53 ++---
 arch/powerpc/kernel/rtasd.c |2 +-
 arch/powerpc/kernel/time.c  |   25 +-
 arch/powerpc/kernel/traps.c |   12 +---
 arch/powerpc/lib/feature-fixups-test.S  |   19 
 arch/powerpc/platforms/83xx/mpc83xx.h   |2 +
 arch/powerpc/platforms/83xx/usb.c   |   21 -
 arch/powerpc/platforms/cell/cpufreq_spudemand.c |   20 +
 arch/powerpc/platforms/cell/qpace_setup.c   |5 -
 arch/powerpc/platforms/cell/spu_base.c  |   70 
 arch/powerpc/platforms/cell/spufs/file.c|  

[PATCH 0/4] powerpc/pseries: VPHN code cleanups

2011-01-20 Thread Jesse Larrew
From: Jesse Larrew jlar...@linux.vnet.ibm.com

This patch set includes some simple style cleanups for VPHN:

PATCH 1/4: powerpc/pseries: Fix typo in VPHN comments
PATCH 2/4: powerpc/pseries: Fix brace placement in numa.c
PATCH 3/4: powerpc/pseries: Remove unnecessary initializations in numa.c
PATCH 4/4: powerpc/pseries: Reorder VPHN functions to reduce forward 
declarations

 arch/powerpc/mm/numa.c |  143 +++-
 1 files changed, 69 insertions(+), 74 deletions(-)

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/4] powerpc/pseries: Fix typo in VPHN comments

2011-01-20 Thread Jesse Larrew
From: Jesse Larrew jlar...@linux.vnet.ibm.com

Correct a spelling error in VPHN comments in numa.c.

Signed-off-by: Jesse Larrew jlar...@linux.vnet.ibm.com
---
 arch/powerpc/mm/numa.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 8f8845e..5259dde 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1263,7 +1263,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
 
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
-/* Vrtual Processor Home Node (VPHN) support */
+/* Virtual Processor Home Node (VPHN) support */
 #ifdef CONFIG_PPC_SPLPAR
 #define VPHN_NR_CHANGE_CTRS (8)
 static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
-- 
1.7.3.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/4] powerpc/pseries: Fix brace placement in numa.c

2011-01-20 Thread Jesse Larrew
From: Jesse Larrew jlar...@linux.vnet.ibm.com

Fix brace placement in VPHN code.

Signed-off-by: Jesse Larrew jlar...@linux.vnet.ibm.com
---
 arch/powerpc/mm/numa.c |9 +++--
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5259dde..db36a2c 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1285,9 +1285,8 @@ static void setup_cpu_associativity_change_counters(void)
u8 *counts = vphn_cpu_change_counts[cpu];
volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
 
-   for (i = 0; i  VPHN_NR_CHANGE_CTRS; i++) {
+   for (i = 0; i  VPHN_NR_CHANGE_CTRS; i++)
counts[i] = hypervisor_counts[i];
-   }
}
 }
 
@@ -1354,14 +1353,12 @@ static int vphn_unpack_associativity(const long 
*packed, unsigned int *unpacked)
 */
unpacked[i] = *((u32*)field);
field += 2;
-   }
-   else if (*field  VPHN_FIELD_MSB) {
+   } else if (*field  VPHN_FIELD_MSB) {
/* Data is in the lower 15 bits of this field */
unpacked[i] = *field  VPHN_FIELD_MASK;
field++;
nr_assoc_doms++;
-   }
-   else {
+   } else {
/* Data is in the lower 15 bits of this field
 * concatenated with the next 16 bit field
 */
-- 
1.7.3.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 4/4] powerpc/pseries: Reorder VPHN functions to reduce forward declarations

2011-01-20 Thread Jesse Larrew
From: Jesse Larrew jlar...@linux.vnet.ibm.com

Reorder VPHN functions to reduce the need for forward declarations.

Signed-off-by: Jesse Larrew jlar...@linux.vnet.ibm.com
---
 arch/powerpc/mm/numa.c |  115 
 1 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f7971d2..2010a17 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1270,7 +1270,6 @@ static u8 
vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
 static cpumask_t cpu_associativity_changes_mask;
 static int vphn_enabled;
 static void set_topology_timer(void);
-int stop_topology_update(void);
 
 /*
  * Store the current values of the associativity change counters in the
@@ -1328,6 +1327,63 @@ static int update_cpu_associativity_changes_mask(void)
return nr_cpus;
 }
 
+static void topology_work_fn(struct work_struct *work)
+{
+   rebuild_sched_domains();
+}
+static DECLARE_WORK(topology_work, topology_work_fn);
+
+void topology_schedule_update(void)
+{
+   schedule_work(topology_work);
+}
+
+static void topology_timer_fn(unsigned long ignored)
+{
+   if (!vphn_enabled)
+   return;
+   if (update_cpu_associativity_changes_mask()  0)
+   topology_schedule_update();
+   set_topology_timer();
+}
+static struct timer_list topology_timer =
+   TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+
+static void set_topology_timer(void)
+{
+   topology_timer.data = 0;
+   topology_timer.expires = jiffies + 60 * HZ;
+   add_timer(topology_timer);
+}
+
+/*
+ * Start polling for VPHN associativity changes.
+ */
+int start_topology_update(void)
+{
+   int rc = 0;
+
+   if (firmware_has_feature(FW_FEATURE_VPHN)) {
+   vphn_enabled = 1;
+   setup_cpu_associativity_change_counters();
+   init_timer_deferrable(topology_timer);
+   set_topology_timer();
+   rc = 1;
+   }
+
+   return rc;
+}
+__initcall(start_topology_update);
+
+/*
+ * Disable polling for VPHN associativity changes.
+ */
+int stop_topology_update(void)
+{
+   vphn_enabled = 0;
+   return del_timer_sync(topology_timer);
+}
+
 /* 6 64-bit registers unpacked into 12 32-bit associativity values */
 #define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32))
 
@@ -1446,61 +1502,4 @@ int arch_update_cpu_topology(void)
 
return 1;
 }
-
-static void topology_work_fn(struct work_struct *work)
-{
-   rebuild_sched_domains();
-}
-static DECLARE_WORK(topology_work, topology_work_fn);
-
-void topology_schedule_update(void)
-{
-   schedule_work(topology_work);
-}
-
-static void topology_timer_fn(unsigned long ignored)
-{
-   if (!vphn_enabled)
-   return;
-   if (update_cpu_associativity_changes_mask()  0)
-   topology_schedule_update();
-   set_topology_timer();
-}
-static struct timer_list topology_timer =
-   TIMER_INITIALIZER(topology_timer_fn, 0, 0);
-
-static void set_topology_timer(void)
-{
-   topology_timer.data = 0;
-   topology_timer.expires = jiffies + 60 * HZ;
-   add_timer(topology_timer);
-}
-
-/*
- * Start polling for VPHN associativity changes.
- */
-int start_topology_update(void)
-{
-   int rc = 0;
-
-   if (firmware_has_feature(FW_FEATURE_VPHN)) {
-   vphn_enabled = 1;
-   setup_cpu_associativity_change_counters();
-   init_timer_deferrable(topology_timer);
-   set_topology_timer();
-   rc = 1;
-   }
-
-   return rc;
-}
-__initcall(start_topology_update);
-
-/*
- * Disable polling for VPHN associativity changes.
- */
-int stop_topology_update(void)
-{
-   vphn_enabled = 0;
-   return del_timer_sync(topology_timer);
-}
 #endif /* CONFIG_PPC_SPLPAR */
-- 
1.7.3.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/4] powerpc/pseries: Remove unnecessary variable initializations in numa.c

2011-01-20 Thread Jesse Larrew
From: Jesse Larrew jlar...@linux.vnet.ibm.com

Remove unnecessary variable initializations in VPHN functions.

Signed-off-by: Jesse Larrew jlar...@linux.vnet.ibm.com
---
 arch/powerpc/mm/numa.c |   17 -
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index db36a2c..f7971d2 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1278,10 +1278,10 @@ int stop_topology_update(void);
  */
 static void setup_cpu_associativity_change_counters(void)
 {
-   int cpu = 0;
+   int cpu;
 
for_each_possible_cpu(cpu) {
-   int i = 0;
+   int i;
u8 *counts = vphn_cpu_change_counts[cpu];
volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
 
@@ -1303,7 +1303,7 @@ static void setup_cpu_associativity_change_counters(void)
  */
 static int update_cpu_associativity_changes_mask(void)
 {
-   int cpu = 0, nr_cpus = 0;
+   int cpu, nr_cpus = 0;
cpumask_t *changes = cpu_associativity_changes_mask;
 
cpumask_clear(changes);
@@ -1337,8 +1337,7 @@ static int update_cpu_associativity_changes_mask(void)
  */
 static int vphn_unpack_associativity(const long *packed, unsigned int 
*unpacked)
 {
-   int i = 0;
-   int nr_assoc_doms = 0;
+   int i, nr_assoc_doms = 0;
const u16 *field = (const u16*) packed;
 
 #define VPHN_FIELD_UNUSED  (0x)
@@ -1377,7 +1376,7 @@ static int vphn_unpack_associativity(const long *packed, 
unsigned int *unpacked)
  */
 static long hcall_vphn(unsigned long cpu, unsigned int *associativity)
 {
-   long rc = 0;
+   long rc;
long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
u64 flags = 1;
int hwcpu = get_hard_smp_processor_id(cpu);
@@ -1391,7 +1390,7 @@ static long hcall_vphn(unsigned long cpu, unsigned int 
*associativity)
 static long vphn_get_associativity(unsigned long cpu,
unsigned int *associativity)
 {
-   long rc = 0;
+   long rc;
 
rc = hcall_vphn(cpu, associativity);
 
@@ -1417,9 +1416,9 @@ static long vphn_get_associativity(unsigned long cpu,
  */
 int arch_update_cpu_topology(void)
 {
-   int cpu = 0, nid = 0, old_nid = 0;
+   int cpu, nid, old_nid;
unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
-   struct sys_device *sysdev = NULL;
+   struct sys_device *sysdev;
 
for_each_cpu_mask(cpu, cpu_associativity_changes_mask) {
vphn_get_associativity(cpu, associativity);
-- 
1.7.3.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[git pull] devicetree build failure fix

2011-01-20 Thread Grant Likely
Hi Linus,

Here's a fix for a stupid bug I introduced.

g.

The following changes since commit c56eb8fb6dccb83d9fe62fd4dc00c834de9bc470:

  Linux 2.6.38-rc1 (2011-01-18 15:14:02 -0800)

are available in the git repository at:
  git://git.secretlab.ca/git/linux-2.6 devicetree/merge

Grant Likely (1):
  powerpc/83xx: fix build failures on dt compatible list.

 arch/powerpc/platforms/83xx/mpc830x_rdb.c |4 ++--
 arch/powerpc/platforms/83xx/mpc831x_rdb.c |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: of_flat_dt_match() helper build FAIL

2011-01-20 Thread Grant Likely
On Thu, Jan 20, 2011 at 7:15 PM, Benjamin Herrenschmidt
b...@kernel.crashing.org wrote:
 a4f740cf33f7f6c164bbde3c0cdbcc77b0c4997c introduces:

 /arch/powerpc/platforms/83xx/mpc831x_rdb.c:63: error: expected '{'
 before 'const'

  and more...

 This hunk is obviously bogus:

 +struct const char *board[] __initdata = {
 +       MPC8313ERDB,
 +       fsl,mpc8315erdb,
 +       NULL
 +}
 +

 You should at least compile test your changes :-(

I do.  Always.  Over Christmas I even set up an autotest instance to
automate a bunch of the sanity testing so I'd get better coverage, and
I always get changes into linux-next, this commit included. Sometimes
I miss a configuration though, and I apologize.  Sorry.

 Please send Linus a fix.

I wrote and pushed out the fix yesterday and I just sent Linus the pull req.

g.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc: Fix some 6xx/7xxx CPU setup functions

2011-01-20 Thread Benjamin Herrenschmidt
Some of those functions try to adjust the CPU features, for example
to remove NAP support on some revisions. However, they seem to use
r5 as an index into the CPU table entry, which might have been right
a long time ago but no longer is. r4 is the right register to use.

This probably caused some off behaviours on some PowerMac variants
using 750cx or 7455 processor revisions.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---

Can somebody with one of these PowerMacs test this ? I only managed to
find a 7448 which not directly affected...

In absence of good testing I would appreciate a close inspection of the patch
by different pairs of eyes :-)

Cheers,
Ben.

diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S 
b/arch/powerpc/kernel/cpu_setup_6xx.S
index 55cba4a..f8cd9fb 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -18,7 +18,7 @@
 #include asm/mmu.h
 
 _GLOBAL(__setup_cpu_603)
-   mflrr4
+   mflrr5
 BEGIN_MMU_FTR_SECTION
li  r10,0
mtspr   SPRN_SPRG_603_LRU,r10   /* init SW LRU tracking */
@@ -27,60 +27,60 @@ BEGIN_FTR_SECTION
bl  __init_fpu_registers
 END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE)
bl  setup_common_caches
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_604)
-   mflrr4
+   mflrr5
bl  setup_common_caches
bl  setup_604_hid0
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_750)
-   mflrr4
+   mflrr5
bl  __init_fpu_registers
bl  setup_common_caches
bl  setup_750_7400_hid0
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_750cx)
-   mflrr4
+   mflrr5
bl  __init_fpu_registers
bl  setup_common_caches
bl  setup_750_7400_hid0
bl  setup_750cx
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_750fx)
-   mflrr4
+   mflrr5
bl  __init_fpu_registers
bl  setup_common_caches
bl  setup_750_7400_hid0
bl  setup_750fx
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_7400)
-   mflrr4
+   mflrr5
bl  __init_fpu_registers
bl  setup_7400_workarounds
bl  setup_common_caches
bl  setup_750_7400_hid0
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_7410)
-   mflrr4
+   mflrr5
bl  __init_fpu_registers
bl  setup_7410_workarounds
bl  setup_common_caches
bl  setup_750_7400_hid0
li  r3,0
mtspr   SPRN_L2CR2,r3
-   mtlrr4
+   mtlrr5
blr
 _GLOBAL(__setup_cpu_745x)
-   mflrr4
+   mflrr5
bl  setup_common_caches
bl  setup_745x_specifics
-   mtlrr4
+   mtlrr5
blr
 
 /* Enable caches for 603's, 604, 750  7400 */
@@ -194,10 +194,10 @@ setup_750cx:
cror4*cr0+eq,4*cr0+eq,4*cr1+eq
cror4*cr0+eq,4*cr0+eq,4*cr2+eq
bnelr
-   lwz r6,CPU_SPEC_FEATURES(r5)
+   lwz r6,CPU_SPEC_FEATURES(r4)
li  r7,CPU_FTR_CAN_NAP
andcr6,r6,r7
-   stw r6,CPU_SPEC_FEATURES(r5)
+   stw r6,CPU_SPEC_FEATURES(r4)
blr
 
 /* 750fx specific
@@ -225,12 +225,12 @@ BEGIN_FTR_SECTION
andis.  r11,r11,L3CR_L3E@h
beq 1f
 END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
-   lwz r6,CPU_SPEC_FEATURES(r5)
+   lwz r6,CPU_SPEC_FEATURES(r4)
andi.   r0,r6,CPU_FTR_L3_DISABLE_NAP
beq 1f
li  r7,CPU_FTR_CAN_NAP
andcr6,r6,r7
-   stw r6,CPU_SPEC_FEATURES(r5)
+   stw r6,CPU_SPEC_FEATURES(r4)
 1:
mfspr   r11,SPRN_HID0
 



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] powerpc: Pass the right cpu_spec to -setup_cpu() on 64-bit

2011-01-20 Thread Benjamin Herrenschmidt
When calling setup_cpu() on 64-bit, we pass a pointer to the
cputable entry we have found. This used to be fine when cur_cpu_spec
was a pointer to that entry, but nowadays, we copy the entry into
a separate variable, and we do so before we call the setup_cpu()
callback. That means that any attempt by that callback at patching
the CPU table entry (to adjust CPU features for example) will patch
the wrong table.

Signed-off-by: Benjamin Herrenschmidt b...@kernel.crashing.org
---
 arch/powerpc/kernel/cputable.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 843abf7..fb83d36 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2105,8 +2105,8 @@ static void __init setup_cpu_spec(unsigned long offset, 
struct cpu_spec *s)
 * pointer on ppc64 and booke as we are running at 0 in real mode
 * on ppc64 and reloc_offset is always 0 on booke.
 */
-   if (s-cpu_setup) {
-   s-cpu_setup(offset, s);
+   if (t-cpu_setup) {
+   t-cpu_setup(offset, t);
}
 #endif /* CONFIG_PPC64 || CONFIG_BOOKE */
 }


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: mpc880 linux-2.6.32 slow running processes

2011-01-20 Thread Heiko Schocher
Hello Joakim,

Joakim Tjernlund wrote:
 Sent by: linuxppc-dev-bounces+joakim.tjernlund=transmode...@lists.ozlabs.org

 Rafael Beims rbe...@gmail.com wrote on 2011/01/10 17:35:38:
 Once you have tested it and it works, please send a patch to remove the 
 8xx workaround.
 Make sure Scott is cc:ed


 I tested linux-2.6.33 on my ppc880 board today, and even without the
 slowdown.patch applied, the board runs processes with good
 performance.
 It really seems that the problem is solved from linux-2.6.33 on.

 I'm not sure what you mean by sending a patch to remove the
 workaround. The only thing that I did in the 2.6.32 version was to
 apply the slowdown.patch attached in the message from Michael.

 Could you clarify please?
 Yes, this part in arch/powerpc/mm/pgtable.c:
 #ifdef CONFIG_8xx
  /* On 8xx, cache control instructions (particularly
   * dcbst from flush_dcache_icache) fault as write
   * operation if there is an unpopulated TLB entry
   * for the address in question. To workaround that,
   * we invalidate the TLB here, thus avoiding dcbst
   * misbehaviour.
   */
  /* 8xx doesn't care about PID, size or ind args */
  _tlbil_va(addr, 0, 0, 0);
 #endif /* CONFIG_8xx */

 Should be removed in = 2.6.33 kernels.
 My 8xx TLB work fixes this problem more efficiently.
 
 Can you test these 2 patches on recent 2.6 linux:
From 9024200169bf86b4f34cb3b1ebf68e0056237bc0 Mon Sep 17 00:00:00 2001
 From: Joakim Tjernlund joakim.tjernl...@transmode.se
 Date: Tue, 11 Jan 2011 13:43:42 +0100
 Subject: [PATCH 1/2] powerpc: Move 8xx invalidation of non present TLBs
[...]
 and
 
From 0ef93601290a75b087495dddeee6062a870f1dc6 Mon Sep 17 00:00:00 2001
 From: Joakim Tjernlund joakim.tjernl...@transmode.se
 Date: Tue, 11 Jan 2011 13:55:22 +0100
 Subject: [PATCH 2/2] powerpc: Remove 8xx redundant dcbst workaround.

Tested this on a board similliar to the mainline tqm8xx board with
lmbench:

-bash-3.2# cat /proc/cpuinfo
processor   : 0
cpu : 8xx
clock   : 80.00MHz
revision: 0.0 (pvr 0050 )
bogomips: 10.00
timebase: 500
platform: KUP4K
model   : KUP4K
Memory  : 96 MB
-bash-3.2#

-bash-3.2# cat /proc/version
Linux version 2.6.34-00064-g3e81b6b (h...@pollux.denx.de) (gcc version 4.2.2) 
#89 Thu Jan 20 08:39:52 CET 2011
-bash-3.2#

(First run of lmbench without your 2 patches, the two other runs with it)

-bash-3.2# make see
cd results  make summary summary.out 2summary.errs
cd results  make percent percent.out 2percent.errs
-bash-3.2# cat results/summary.out
make[1]: Entering directory `/home/hs/lmbench-3.0-a9/results'

 L M B E N C H  3 . 0   S U M M A R Y
 
 (Alpha software, do not distribute)

Basic system parameters
--
Host OS Description  Mhz  tlb  cache  mem   scal
 pages line   par   load
   bytes
- - ---  - - -- 
kup4k Linux 2.6.34-   powerpc-linux-gnu   792816 1.14001
kup4k Linux 2.6.34-   powerpc-linux-gnu   792816 1.02001
kup4k Linux 2.6.34-   powerpc-linux-gnu   792816 1.10001

Processor, Processes - times in microseconds - smaller is better
--
Host OS  Mhz null null  open slct sig  sig  fork exec sh
 call  I/O stat clos TCP  inst hndl proc proc proc
- -           
kup4k Linux 2.6.34-   79 2.58 12.3 126. 1285 353. 22.8 149. 8418 34.K 101K
kup4k Linux 2.6.34-   79 2.59 13.1 127. 1273 320. 23.4 127. 8251 33.K 100K
kup4k Linux 2.6.34-   79 2.47 13.1 127. 1288 315. 23.6 128. 8413 34.K 101K

Basic integer operations - times in nanoseconds - smaller is better
---
Host OS  intgr intgr  intgr  intgr  intgr
  bit   addmuldivmod
- - -- -- -- -- --
kup4k Linux 2.6.34-   12.6   14.4 1.3500  103.9  170.6
kup4k Linux 2.6.34-   13.2   15.0 1.3100  100.0  170.5
kup4k Linux 2.6.34-   13.2   14.4 1.2900  104.1  162.1

Basic uint64 operations - times in nanoseconds - smaller is better
--
Host OS int64  int64  int64  int64  int64
 bitaddmuldivmod
- - -- -- -- -- --
kup4k Linux 2.6.34-12.  11.1 1637.9 1602.4
kup4k Linux 2.6.34-13.