Re: [PATCH] powerpc: add setclrbits macros

2007-08-16 Thread Geert Uytterhoeven
On Thu, 16 Aug 2007, Timur Tabi wrote:
> This patch adds the setclrbits_xxx() macros, which are used to set and clear
> multiple bits in a single read-modify-write operation.  Specify the bits
> to set in the 'set' parameter and the bits to clear in the 'clear' parameter.
> These macros can also be used to set a multiple-bit bit pattern using a mask,
> by specifying the mask in the 'clear' parameter and the new bit pattern in the
> 'set' parameter.  There are big-endian and little-endian versions for 8, 16,
> 32, and 64 bits.

Sorry for nitpicking again, but since the clear is done before the set (cfr.
the expanded functionality), perhaps they should be changed to
clrsetbits_X(addr, clear, set)?

> Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
> ---
> 
> Changed the macros from setmaskedbits_xxx to setclrbits_xxx and added a 
> comment
> indicating the expanded functionality.
> 
>  include/asm-powerpc/io.h |   27 +++
>  1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
> index bb8d965..58c8b96 100644
> --- a/include/asm-powerpc/io.h
> +++ b/include/asm-powerpc/io.h
> @@ -734,6 +734,33 @@ static inline void * bus_to_virt(unsigned long address)
>  #define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) |  (_v))
>  #define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
>  
> +/* Set and clear bits in one shot.  These macros can be used to clear and
> + * set multiple bits in a register using a single read-modify-write.  These
> + * macros can also be used to set a multiple-bit bit pattern using a mask,
> + * by specifying the mask in the 'clear' parameter and the new bit pattern
> + * in the 'set' parameter.
> + */
> +
> +#ifdef __powerpc64__
> +#define setclrbits_be64(addr, set, clear) \
> + out_be64((addr), (in_be64(addr) & ~(clear)) | (set))
> +#define setclrbits_le64(addr, set, clear) \
> + out_le64((addr), (in_le64(addr) & ~(clear)) | (set))
> +#endif
> +
> +#define setclrbits_be32(addr, set, clear) \
> + out_be32((addr), (in_be32(addr) & ~(clear)) | (set))
> +#define setclrbits_be16(addr, set, clear) \
> + out_be16((addr), (in_be16(addr) & ~(clear)) | (set))
> +
> +#define setclrbits_le32(addr, set, clear) \
> + out_le32((addr), (in_le32(addr) & ~(clear)) | (set))
> +#define setclrbits_le16(addr, set, clear) \
> + out_le16((addr), (in_le16(addr) & ~(clear)) | (set))
> +
> +#define setclrbits_8(addr, set, clear) \
> + out_8((addr), (in_8(addr) & ~(clear)) | (set))
> +
>  #endif /* __KERNEL__ */
>  
>  #endif /* _ASM_POWERPC_IO_H */
> -- 
> 1.5.2.4
> 

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] fix compile warning in arch/powerpc/kernel/sysfs.c

2007-08-16 Thread Michael Neuling
It seems I missed a long discussion about this warning... Please ignore.

Mikey

In message <[EMAIL PROTECTED]> you wrote:
> This fixes the following warning:
> arch/powerpc/kernel/sysfs.c:388: warning: ignoring return value of
> 'sysfs_create_group', declared with attribute warn_unused_result
> 
> Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/kernel/sysfs.c |8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6-ozlabs/arch/powerpc/kernel/sysfs.c
> ===
> --- linux-2.6-ozlabs.orig/arch/powerpc/kernel/sysfs.c
> +++ linux-2.6-ozlabs/arch/powerpc/kernel/sysfs.c
> @@ -378,14 +378,18 @@ EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr);
>  
>  int cpu_add_sysdev_attr_group(struct attribute_group *attrs)
>  {
> - int cpu;
> + int cpu, err;
>   struct sys_device *sysdev;
>  
>   mutex_lock(&cpu_mutex);
>  
>   for_each_possible_cpu(cpu) {
>   sysdev = get_cpu_sysdev(cpu);
> - sysfs_create_group(&sysdev->kobj, attrs);
> + err = sysfs_create_group(&sysdev->kobj, attrs);
> + if (err) {
> + mutex_unlock(&cpu_mutex);
> + return err;
> + }
>   }
>  
>   mutex_unlock(&cpu_mutex);
> 
> 
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
> 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] serial: Add pci ids for PA Semi PWRficient onchip uarts

2007-08-16 Thread Olof Johansson
Add PCI IDs for the onchip UARTs on PA Semi PWRficient.

Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>


Index: linux-2.6/drivers/serial/8250_pci.c
===
--- linux-2.6.orig/drivers/serial/8250_pci.c
+++ linux-2.6/drivers/serial/8250_pci.c
@@ -984,6 +984,7 @@ enum pci_board_num_t {
pbn_exar_XR17C152,
pbn_exar_XR17C154,
pbn_exar_XR17C158,
+   pbn_pasemi_1682M,
 };
 
 /*
@@ -1511,6 +1512,14 @@ static struct pciserial_board pci_boards
.base_baud  = 921600,
.uart_offset= 0x200,
},
+   /*
+* PA Semi PWRficient PA6T-1682M on-chip UART
+*/
+   [pbn_pasemi_1682M] = {
+   .flags  = FL_BASE0,
+   .num_ports  = 1,
+   .base_baud  = 833,
+   },
 };
 
 /*
@@ -2402,6 +2411,13 @@ static struct pci_device_id serial_pci_t
PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
0, 0, pbn_b2_8_921600 },
/*
+* PA Semi PA6T-1682M on-chip UART
+*/
+   {   PCI_VENDOR_ID_PASEMI, 0xa004,
+   PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+   pbn_pasemi_1682M },
+
+   /*
 * These entries match devices with class COMMUNICATION_SERIAL,
 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
 */
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [POWERPC] Fix interrupt routing and setup of ULI M1575 on FSL boards

2007-08-16 Thread Kumar Gala
The interrupt routing in the device trees for the ULI M1575 was
inproperly using the interrupt line field as pci function.  Fixed
up the device tree's to actual conform for to specification and
changed the interrupt mapping code so it just uses a static mapping
setup as follows:

PIRQA - IRQ9
PIRQB - IRQ10
PIRQC - IRQ11
PIRQD - IRQ12
USB 1.1 OCHI (1c.0) - IRQ12
USB 1.1 OCHI (1c.1) - IRQ9
USB 1.1 OCHI (1c.2) - IRQ10
USB 1.1 ECHI (1c.3) - IRQ11
LAN (1b.0) - IRQ6
AC97 (1d.0) - IRQ6
Modem (1d.1) - IRQ6
HD Audio (1d.2) - IRQ6
SATA (1f.1) - IRQ5
SMB (1e.1) - IRQ7
PMU (1e.2) - IRQ7
PATA (1f.0) - IRQ14/15

Took the oppurtunity to refactor the code into a single file so we
don't have to duplicate these fixes on the two current boards in the
tree and several forth coming boards that will also need the code.

Fixed RTC support that requires a dummy memory read on the P2P bridge
to unlock the RTC and setup the default of the RTC alarm registers to
match with a basic x86 style CMOS RTC.

Moved code that poked ISA registers to a FIXUP_FINAL quirk to ensure
the PCI IO space has been setup properly before we start poking ISA
registers at random locations.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc8544ds.dts|   88 --
 arch/powerpc/boot/dts/mpc8641_hpcn.dts |  114 +++--
 arch/powerpc/platforms/85xx/Kconfig|1 +
 arch/powerpc/platforms/85xx/mpc8544_ds.c   |  214 ++--
 arch/powerpc/platforms/86xx/Kconfig|1 +
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |  224 ++---
 arch/powerpc/platforms/Kconfig |8 +
 arch/powerpc/platforms/Makefile|3 +
 arch/powerpc/platforms/fsl_uli1575.c   |  255 
 9 files changed, 363 insertions(+), 545 deletions(-)
 create mode 100644 arch/powerpc/platforms/fsl_uli1575.c

diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts 
b/arch/powerpc/boot/dts/mpc8544ds.dts
index 4680e20..3e79bf0 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -44,8 +44,18 @@
#size-cells = <1>;
#interrupt-cells = <2>;
device_type = "soc";
-   ranges = <0 e000 0010>;
-   reg = ;  // CCSRBAR 1M
+
+
+   ranges = <1000 e0001000 000ff000
+ 8000 8000 2000
+ a000 a000 1000
+ b000 b000 0010
+ c000 c000 2000
+ b010 b010 0010
+ e100 e100 0001
+ e101 e101 0001
+ e102 e102 0001>;
+   reg = ;  // CCSRBAR 1M
bus-frequency = <0>;// Filled out by uboot.

[EMAIL PROTECTED] {
@@ -161,8 +171,8 @@
interrupt-parent = <&mpic>;
interrupts = <18 2>;
bus-range = <0 ff>;
-   ranges = <0200 0 8000 8000 0 1000
- 0100 0  e200 0 0080>;
+   ranges = <0200 0 c000 c000 0 2000
+ 0100 0  e100 0 0001>;
clock-frequency = <3f940aa>;
#interrupt-cells = <1>;
#size-cells = <2>;
@@ -178,8 +188,8 @@
#address-cells = <3>;
reg = <9000 1000>;
bus-range = <0 ff>;
-   ranges = <0200 0 9000 9000 0 1000
- 0100 0  e300 0 0080>;
+   ranges = <0200 0 8000 8000 0 2000
+ 0100 0  e101 0 0001>;
clock-frequency = <1fca055>;
interrupt-parent = <&mpic>;
interrupts = <1a 2>;
@@ -202,7 +212,7 @@
reg = ;
bus-range = <0 ff>;
ranges = <0200 0 a000 a000 0 1000
- 0100 0  e280 0 0080>;
+ 0100 0  e102 0 0001>;
clock-frequency = <1fca055>;
interrupt-parent = <&mpic>;
interrupts = <19 2>;
@@ -224,49 +234,29 @@
#address-cells = <3>;
reg = ;
bus-range = <0 ff>;
-   ranges = <0200 0 b000 b000 0 1000
- 0100 0  e380 0 0080>;
+   ranges = <0200 0 b000 b000 0 0010

[PATCH] [POWERPC] Add interrupt resource for RTC CMOS driver

2007-08-16 Thread Kumar Gala
The RTC CMOS driver expects the interrupt to be a resource of the platform
device.  Use a fixed interrupt value of 8 since on PPC if we are using this
its off an i8259 which we ensure has interrupt numbers 0..15.

Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/rtc_cmos_setup.c |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c 
b/arch/powerpc/sysdev/rtc_cmos_setup.c
index e276048..1d2be7d 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -20,14 +20,16 @@ static int  __init add_rtc(void)
 {
struct device_node *np;
struct platform_device *pd;
-   struct resource res;
+   struct resource res[2];
int ret;

+   memset(&res, 0, sizeof(res));
+
np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
if (!np)
return -ENODEV;

-   ret = of_address_to_resource(np, 0, &res);
+   ret = of_address_to_resource(np, 0, &res[0]);
of_node_put(np);
if (ret)
return ret;
@@ -36,11 +38,16 @@ static int  __init add_rtc(void)
 * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h.  Verify that the
 * address provided by the device node matches.
 */
-   if (res.start != RTC_PORT(0))
+   if (res[0].start != RTC_PORT(0))
return -EINVAL;

+   res[1].start = 8;
+   res[1].end = 8;
+   res[1].flags = IORESOURCE_IRQ;
+
pd = platform_device_register_simple("rtc_cmos", -1,
-&res, 1);
+&res[0], 2);
+
if (IS_ERR(pd))
return PTR_ERR(pd);

-- 
1.5.2.2

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


Please pull from 'fixes-2.6.23' branch

2007-08-16 Thread Kumar Gala
Please pull from 'fixes-2.6.23' branch of

master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git 
fixes-2.6.23

to receive the following updates:

 arch/powerpc/boot/dts/mpc8544ds.dts|   88 --
 arch/powerpc/boot/dts/mpc8641_hpcn.dts |  114 ++--
 arch/powerpc/kernel/traps.c|4
 arch/powerpc/platforms/85xx/Kconfig|1
 arch/powerpc/platforms/85xx/mpc8544_ds.c   |  214 +---
 arch/powerpc/platforms/86xx/Kconfig|1
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |  224 +
 arch/powerpc/platforms/Kconfig |8
 arch/powerpc/platforms/Makefile|3
 arch/powerpc/platforms/fsl_uli1575.c   |  255 +
 arch/powerpc/sysdev/rtc_cmos_setup.c   |   15 +
 include/asm-powerpc/reg_booke.h|   12 +
 12 files changed, 386 insertions(+), 553 deletions(-)

Becky Bruce (1):
  [POWERPC] Fix FSL BookE machine check reporting

Kumar Gala (2):
  [POWERPC] Add interrupt resource for RTC CMOS driver
  [POWERPC] Fix interrupt routing and setup of ULI M1575 on FSL boards

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


Re: [PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Michael Neuling
In message <[EMAIL PROTECTED]> you wrote:
> Michael Neuling wrote:
> >> I'd also request for you to add a cpu_scaled_run_real_total for use
> >> by delay accounting. cpu_scaled_run_real_total should be similar in
> >> functionality to cpu_run_real_total.
> > 
> > Will do.  Should I add cpu_scaled_run_real_total to the end of the
> > struct taskstat, or next to cpu_run_real_total?
> > 
> 
> Please add it to the end, that helps maintain binary compatibility
> across all versions of taskstats.

OK

> 
> >>>   /* Note: this timer irq context must be accounted for as well. */
> >>> - if (user_tick)
> >>> + if (user_tick) {
> >>>   account_user_time(p, jiffies_to_cputime(1));
> >>> - else
> >>> + account_user_time_scaled(p, jiffies_to_cputime(1));
> >>> + } else {
> >>>   account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
> >>> + account_system_time_scaled(p, jiffies_to_cputime(1));
> >>> + }
> >> I am a little confused here, scaled accounting and regular accounting
> >> go hand in hand?
> > 
> > We need to account for scaled and normal time in this generic code.
> > All other calls to account_(user|system)_time are in arch code.  
> > 
> 
> So the assumption here is that we ran at full frequency during
> this time, is my understanding correct?

Yes.  

I guess we could keep a per CPU last scaling factor for this case
(similar to what we are storing in the POWERPC paca)

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


[PATCH] pasemi: Another IOMMU bugfix for 64K PAGE_SIZE

2007-08-16 Thread Olof Johansson
More fallout from the switch from PAGE_SIZE based IOMMU to the native page
size for the driver. By pure luck it happened to work most of the time, since
we end up invalidating the wrong entries in the TLB.

Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>


Index: linux-2.6/arch/powerpc/platforms/pasemi/iommu.c
===
--- linux-2.6.orig/arch/powerpc/platforms/pasemi/iommu.c
+++ linux-2.6/arch/powerpc/platforms/pasemi/iommu.c
@@ -93,7 +93,7 @@ static void iobmap_build(struct iommu_ta
 
pr_debug("iobmap: build at: %lx, %lx, addr: %lx\n", index, npages, 
uaddr);
 
-   bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
+   bus_addr = (tbl->it_offset + index) << IOBMAP_PAGE_SHIFT;
 
ip = ((u32 *)tbl->it_base) + index;
 
@@ -118,7 +118,7 @@ static void iobmap_free(struct iommu_tab
 
pr_debug("iobmap: free at: %lx, %lx\n", index, npages);
 
-   bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
+   bus_addr = (tbl->it_offset + index) << IOBMAP_PAGE_SHIFT;
 
ip = ((u32 *)tbl->it_base) + index;
 
@@ -137,7 +137,7 @@ static void iommu_table_iobmap_setup(voi
iommu_table_iobmap.it_busno = 0;
iommu_table_iobmap.it_offset = 0;
/* it_size is in number of entries */
-   iommu_table_iobmap.it_size = 0x8000 >> PAGE_SHIFT;
+   iommu_table_iobmap.it_size = 0x8000 >> IOBMAP_PAGE_SHIFT;
 
/* Initialize the common IOMMU code */
iommu_table_iobmap.it_base = (unsigned long)iob_l2_base;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Balbir Singh
Michael Neuling wrote:
>> I'd also request for you to add a cpu_scaled_run_real_total for use
>> by delay accounting. cpu_scaled_run_real_total should be similar in
>> functionality to cpu_run_real_total.
> 
> Will do.  Should I add cpu_scaled_run_real_total to the end of the
> struct taskstat, or next to cpu_run_real_total?
> 

Please add it to the end, that helps maintain binary compatibility
across all versions of taskstats.

>>> /* Note: this timer irq context must be accounted for as well. */
>>> -   if (user_tick)
>>> +   if (user_tick) {
>>> account_user_time(p, jiffies_to_cputime(1));
>>> -   else
>>> +   account_user_time_scaled(p, jiffies_to_cputime(1));
>>> +   } else {
>>> account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
>>> +   account_system_time_scaled(p, jiffies_to_cputime(1));
>>> +   }
>> I am a little confused here, scaled accounting and regular accounting
>> go hand in hand?
> 
> We need to account for scaled and normal time in this generic code.
> All other calls to account_(user|system)_time are in arch code.  
> 

So the assumption here is that we ran at full frequency during
this time, is my understanding correct?

-- 
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Machine automagically reboots with 2.6.23-rc2-mm2

2007-08-16 Thread Balbir Singh
Michael Neuling wrote:
> 
> SLB shadow was bust.  Make sure you have
> edd0622bd2e8f755c960827e15aa6908c3c5aa94
> 
> [POWERPC] Fix potential duplicate entry in SLB shadow buffer
> 
> We were getting a duplicate entry in the SLB shadow buffer in
> slb_flush_and_rebolt() if the kernel stack was in the same segment
> as PAGE_OFFSET, which on POWER6 causes the hypervisor to terminate
> the partition with an error.  This fixes it.
> 
> Also we were not creating an SLB entry (or an SLB shadow buffer
> entry) for the kernel stack on secondary CPUs when starting the
> CPU.  This isn't a major problem, since an appropriate entry will
> be created on demand, but this fixes that also for consistency.
> 
> Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
> 

Thanks for pointing that out, I'll get the fix and retry.

Balbir Singh.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] fix compile warning in arch/powerpc/kernel/sysfs.c

2007-08-16 Thread Michael Neuling
This fixes the following warning:
arch/powerpc/kernel/sysfs.c:388: warning: ignoring return value of
'sysfs_create_group', declared with attribute warn_unused_result

Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
---
 arch/powerpc/kernel/sysfs.c |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/sysfs.c
===
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/sysfs.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/sysfs.c
@@ -378,14 +378,18 @@ EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr);
 
 int cpu_add_sysdev_attr_group(struct attribute_group *attrs)
 {
-   int cpu;
+   int cpu, err;
struct sys_device *sysdev;
 
mutex_lock(&cpu_mutex);
 
for_each_possible_cpu(cpu) {
sysdev = get_cpu_sysdev(cpu);
-   sysfs_create_group(&sysdev->kobj, attrs);
+   err = sysfs_create_group(&sysdev->kobj, attrs);
+   if (err) {
+   mutex_unlock(&cpu_mutex);
+   return err;
+   }
}
 
mutex_unlock(&cpu_mutex);


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


for-2.6.24 branch in powerpc.git created

2007-08-16 Thread Paul Mackerras
I have made a for-2.6.24 branch in powerpc.git and pushed the
following patches to it.

Paul.

Becky Bruce (1):
  [POWERPC] Update lmb.h include protection to ASM_POWERPC

David Gibson (4):
  [POWERPC] Fixes to allow use of Ebony's flash chips through physmap_of
  [POWERPC] Fix setting of irq trigger type in UIC driver
  [POWERPC] Fix irq flow handler for 4xx UIC
  [POWERPC] Improve robustness of the UIC cascade handler

Gabriel C (1):
  [POWERPC] Typo fixes interrrupt -> interrupt

Grant Likely (1):
  [POWERPC] Only ignore arch/ppc/include, not arch/ppc/boot/include

Guennadi Liakhovetski (1):
  [POWERPC] Fix i2c device string format

Ishizaki Kou (4):
  [POWERPC] Fix celleb pci section warnings
  [POWERPC] Fix celleb sio section warning
  [POWERPC] Init markings for celleb
  [POWERPC] Init markings for hvc_beat

Jesper Juhl (1):
  [POWERPC] Clean out a bunch of duplicate includes

Jon Loeliger (3):
  [POWERPC] 52xx: Remove unnecessary loops_per_jiffy initialization code
  [POWERPC] 8xx: Remove unnecessary loops_per_jiffy initialization code
  [POWERPC] embedded6xx: Remove unnecessary loops_per_jiffy initialization 
code

Linas Vepstas (10):
  [POWERPC] EEH: Tweak printk message
  [POWERPC] EEH: Fix PCI bridge handling bug
  [POWERPC] EEH: Dump PCI bridge status on event
  [POWERPC] pseries: Avoid excess rtas_token calls
  [POWERPC] pseries: Use rtas_token instead of hand-rolled code
  [POWERPC] pseries: Simplify rtasd initialization
  [POWERPC] Remove nvram forward declarations
  [POWERPC] pseries: Fix jumbled no_logging flag
  [POWERPC] pseries: Eliminate global error_log_cnt variable
  [POWERPC] pseries: Remove dead EEH video code

Mariusz Kozlowski (1):
  [POWERPC] drivers/macintosh/therm_adt746x.c: kmalloc + memset conversion 
to kzalloc

Michael Buesch (1):
  [POWERPC] via-pmu: Fix typo in printk

Murali Iyer (1):
  [POWERPC] Export DCR symbols for modules

Nathan Lynch (14):
  [POWERPC] Remove gratuitous reads from maple PCI config space methods
  [POWERPC] rtas_pci_ops: Use named structure member initializers
  [POWERPC] celleb_fake_pci_ops: Use named structure member initializers
  [POWERPC] celleb_epci_ops: Use named structure member initializers
  [POWERPC] maple pci_ops: Use named structure member initializers
  [POWERPC] pa_pxp_ops: Use named structure member initializers
  [POWERPC] powermac pci_ops: Use named structure member initializers
  [POWERPC] null_pci_ops: Use named structure member initializers
  [POWERPC] efika rtas_pci_ops: Use named structure member initializers
  [POWERPC] chrp pci_ops: Use named structure member initializers
  [POWERPC] indirect_pci_ops: Use named structure member initializers
  [POWERPC] tsi108_direct_pci_ops: Use named structure member initializers
  [POWERPC] Remove gratuitous reads from pasemi pci config space methods
  [POWERPC] Remove gratuitous reads from powermac pci config space methods

Paul Mackerras (1):
  [POWERPC] Handle alignment faults on new FP load/store instructions

Segher Boessenkool (2):
  [POWERPC] Replace a few #defines with empty inline functions
  [POWERPC] Implement atomic{, 64}_{read, write}() without volatile

Stephen Rothwell (10):
  [POWERPC] Fix non HUGETLB_PAGE build warning
  [POWERPC] Use of_get_property in ipmi code
  [POWERPC] Remove get_property and device_is_compatible
  [POWERPC] Tidy up CONFIG_PPC_MM_SLICES code
  [POWERPC] Comment out a currently unused function
  [POWERPC] Fix section mismatch in crash_dump.c
  [POWERPC] Fix section mismatch in dart_iommu.c
  [POWERPC] Fix section mismatches in udbg_adb.c
  [POWERPC] Fix section mismatch in pasemi/iommu.c
  [POWERPC] Remove some duplicate declarations from pmac.h

 arch/powerpc/boot/dts/ebony.dts   |1 
 arch/powerpc/boot/ebony.c |   39 +++
 arch/powerpc/configs/ebony_defconfig  |  246 ++---
 arch/powerpc/kernel/align.c   |   57 -
 arch/powerpc/kernel/btext.c   |1 
 arch/powerpc/kernel/crash.c   |1 
 arch/powerpc/kernel/crash_dump.c  |2 
 arch/powerpc/kernel/iommu.c   |1 
 arch/powerpc/kernel/nvram_64.c|   23 --
 arch/powerpc/kernel/pci_32.c  |4 
 arch/powerpc/kernel/prom.c|1 
 arch/powerpc/kernel/rtas_pci.c|4 
 arch/powerpc/kernel/time.c|1 
 arch/powerpc/mm/hash_utils_64.c   |7 -
 arch/powerpc/mm/hugetlbpage.c |3 
 arch/powerpc/mm/init_32.c |1 
 arch/powerpc/mm/mem.c |1 
 arch/powerpc/mm/mmu_context_64.c  |   11 -
 arch/powe

Re: Machine automagically reboots with 2.6.23-rc2-mm2

2007-08-16 Thread Michael Neuling
> Hi,
> 
> My machine reboots automatically after a few seconds of booting 2.6.23-rc2-mm
2.
> I've tried several ways to debug the problem, but I've had no success.
> I am not sure if this problem has been reported already, a few simple searche
s
> did not indicate that the problem had been reported
> 
> 2.6.23-rc1-mm1 did not have this problem.

SLB shadow was bust.  Make sure you have
edd0622bd2e8f755c960827e15aa6908c3c5aa94

[POWERPC] Fix potential duplicate entry in SLB shadow buffer

We were getting a duplicate entry in the SLB shadow buffer in
slb_flush_and_rebolt() if the kernel stack was in the same segment
as PAGE_OFFSET, which on POWER6 causes the hypervisor to terminate
the partition with an error.  This fixes it.

Also we were not creating an SLB entry (or an SLB shadow buffer
entry) for the kernel stack on secondary CPUs when starting the
CPU.  This isn't a major problem, since an appropriate entry will
be created on demand, but this fixes that also for consistency.

Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>


> 
> 
> .config is attached with this email.
> 
> /proc/cpuinfo shows
> 
> processor   : 0
> cpu : POWER5 (gr)
> clock   : 1654.344000MHz
> revision: 2.3 (pvr 003a 0203)
> 
> processor   : 1
> cpu : POWER5 (gr)
> clock   : 1654.344000MHz
> revision: 2.3 (pvr 003a 0203)
> 
> processor   : 2
> cpu : POWER5 (gr)
> clock   : 1654.344000MHz
> revision: 2.3 (pvr 003a 0203)
> 
> processor   : 3
> cpu : POWER5 (gr)
> clock   : 1654.344000MHz
> revision: 2.3 (pvr 003a 0203)
> 
> timebase: 206998000
> machine : CHRP IBM,9123-710
> 
> lspci shows
> 
> 00:02.0 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> 00:02.2 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> 00:02.3 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> 00:02.4 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> c0:01.0 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet Contr
oller (Copper) (rev 01)
> c0:01.1 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet Contr
oller (Copper) (rev 01)
> c8:01.0 USB Controller: NEC Corporation USB (rev 43)
> c8:01.1 USB Controller: NEC Corporation USB (rev 43)
> c8:01.2 USB Controller: NEC Corporation USB 2.0 (rev 04)
> cc:01.0 Mass storage controller: Promise Technology, Inc. 20275 (rev 01)
> d0:01.0 SCSI storage controller: Mylex Corporation AcceleRAID 600/500/400/Sap
phire support Device (rev 04)
> 0001:00:02.2 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> 0001:00:02.4 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> 0001:00:02.6 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
> 0001:d0:01.0 Ethernet controller: Intel Corporation 82545GM Gigabit Ethernet 
Controller (rev 04)
> 
> Normal kernel boot (memory info)
> 
> EEH: PCI Enhanced I/O Error Handling Enabled
> PPC64 nvram contains 7168 bytes
> Using dedicated idle loop
> Top of RAM: 0xe900, Total RAM: 0xe900
> Memory hole size: 0MB
> On node 0 totalpages: 954368
>   DMA zone: 954368 pages, LIFO batch:31
>   DMA32 zone: 0 pages, LIFO batch:0
>   Normal zone: 0 pages, LIFO batch:0
>   HighMem zone: 0 pages, LIFO batch:0
> [boot]0015 Setup Done
> Built 1 zonelists
> 
> 
> -- 
>   Warm Regards,
>   Balbir Singh
>   Linux Technology Center
>   IBM, ISTL
> 
> --000300070303050202020703
> Content-Type: text/plain;
>  name="config.txt"
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline;
>  filename="config.txt"
> 
> #
> # Automatically generated make config: don't edit
> # Linux kernel version: 2.6.23-rc2-mm2
> # Thu Aug 16 15:02:55 2007
> #
> CONFIG_PPC64=y
> 
> #
> # Processor support
> #
> # CONFIG_POWER4_ONLY is not set
> CONFIG_POWER3=y
> CONFIG_POWER4=y
> CONFIG_PPC_FPU=y
> CONFIG_ALTIVEC=y
> CONFIG_PPC_STD_MMU=y
> CONFIG_PPC_MM_SLICES=y
> CONFIG_VIRT_CPU_ACCOUNTING=y
> CONFIG_SMP=y
> CONFIG_NR_CPUS=32
> CONFIG_64BIT=y
> CONFIG_PPC_MERGE=y
> CONFIG_MMU=y
> CONFIG_GENERIC_HARDIRQS=y
> CONFIG_IRQ_PER_CPU=y
> CONFIG_RWSEM_XCHGADD_ALGORITHM=y
> CONFIG_ARCH_HAS_ILOG2_U32=y
> CONFIG_ARCH_HAS_ILOG2_U64=y
> CONFIG_GENERIC_HWEIGHT=y
> CONFIG_GENERIC_CALIBRATE_DELAY=y
> CONFIG_GENERIC_FIND_NEXT_BIT=y
> CONFIG_ARCH_NO_VIRT_TO_BUS=y
> CONFIG_PPC=y
> CONFIG_EARLY_PRINTK=y
> CONFIG_COMPAT=y
> CONFIG_SYSVIPC_COMPAT=y
> CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
> CONFIG_ARCH_MAY_HAVE_PC_FDC=y
> CONFIG_PPC_OF=y
> CONFIG_OF=y
> CONFIG_PPC_UDBG_16550=y
> CONFIG_GENERIC_TBSYNC=y
> CONFIG_AUDIT_ARCH=y
> CONFIG_GENERIC_BUG=y
> # CONFIG_DEFAULT_UIMAGE is not set
> CONFIG_PPC64_SWSUSP=y
> # CONFIG_PPC_DCR_NATIVE is not set
> CONFIG_PPC_DCR_MMIO=y
> CONFIG_PPC_DCR=y
> CONFIG_PPC_OF_PLATFORM_PCI=y
> CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
> 
> #
> # General setup
> #
> CONFIG_EXPERIMENTAL=y
> CONFIG_LOCK_KERNEL=y
> CONFIG_INIT_EN

Please pull powerpc.git merge branch

2007-08-16 Thread Paul Mackerras
Linus,

Please do

git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge

I have added one more patch from Ilpo Järvinen since the last pull
request, removing an incorrect semicolon.

Paul.

 arch/powerpc/boot/flatdevtree.c|   18 --
 arch/powerpc/kernel/Makefile   |1 +
 arch/powerpc/kernel/misc_32.S  |   12 +++-
 arch/powerpc/mm/hash_utils_64.c|2 +-
 arch/powerpc/platforms/cell/spu_syscalls.c |1 +
 arch/powerpc/platforms/ps3/device-init.c   |2 +-
 arch/ppc/kernel/misc.S |   12 +++-
 7 files changed, 26 insertions(+), 22 deletions(-)

commit 2b02d13996fe28478e45605de9bd8bdca25718de
Author: Ilpo Järvinen <[EMAIL PROTECTED]>
Date:   Thu Aug 16 08:03:35 2007 +1000

[POWERPC] Fix invalid semicolon after if statement

A similar fix to netfilter from Eric Dumazet inspired me to
look around a bit by using some grep/sed stuff as looking for
this kind of bugs seemed easy to automate.  This is one of them
I found where it looks like this semicolon is not valid.

Signed-off-by: Ilpo Järvinen <[EMAIL PROTECTED]>
Acked-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

commit 2de69124e86682c3427adb4136e097854841e467
Author: Geert Uytterhoeven <[EMAIL PROTECTED]>
Date:   Wed Aug 15 02:30:13 2007 +1000

[POWERPC] ps3: Fix no storage devices found

Fix probing of PS3 storage devices: in the success case, we should set
`error' to zero, not `result'.

Without this patch no storage devices are found.

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

commit 55a910a81d0c3014abc20b9efa73c595b3e68339
Author: Roland McGrath <[EMAIL PROTECTED]>
Date:   Sat Aug 11 09:03:11 2007 +1000

[POWERPC] Fix for assembler -g

ppc64 does the unusual thing of using #include on a compiler-generated
assembly file (lparmap.s) from an assembly source file (head_64.S).
This runs afoul of my recent patch to pass -gdwarf2 to the assembler
under CONFIG_DEBUG_INFO.  This patch avoids the problem by disabling
DWARF generation (-g0) when producing lparmap.s.

Signed-off-by: Roland McGrath <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

commit aa1cf632bd6f998cb4567ccf1a9d2e5daaa9fb44
Author: David Gibson <[EMAIL PROTECTED]>
Date:   Tue Aug 7 14:20:50 2007 +1000

[POWERPC] Fix small race in 44x tlbie function

The 440 family of processors don't have a tlbie instruction.  So, we
implement TLB invalidates by explicitly searching the TLB with tlbsx.,
then clobbering the relevant entry, if any.  Unfortunately the PID for
the search needs to be stored in the MMUCR register, which is also
used by the TLB miss handler.  Interrupts were enabled in _tlbie(), so
an interrupt between loading the MMUCR and the tlbsx could cause
incorrect search results, and thus a failure to invalide TLB entries
which needed to be invalidated.

This fixes the problem in both arch/ppc and arch/powerpc by inhibiting
interrupts (even critical and debug interrupts) across the relevant
instructions.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>
Acked-by: Josh Boyer <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

commit fa6b769a8e981afea869285982640168f76774df
Author: Becky Bruce <[EMAIL PROTECTED]>
Date:   Sat May 12 03:49:39 2007 +1000

[POWERPC] Remove unused code causing a compile warning

AFAICT, nobody is using ft_ordered(), and it causes a build warning
to be generated.  This patch cleans that up by removing the function
and the commented-out code that calls it.

Signed-off-by: Becky Bruce <[EMAIL PROTECTED]>
Acked-by: David Gibson <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>

commit ad941fe4b6b83999863f49dfba7b3d2cebc4ced5
Author: Jeremy Kerr <[EMAIL PROTECTED]>
Date:   Mon Aug 13 13:22:44 2007 +1000

[POWERPC] cell: Fix errno for modular spufs_create with invalid neighbour

At present, spu_create with an invalid neighbo(u)r will return -ENOSYS,
not -EBADF, but only when spufs.o is built as a module.

This change adds the appropriate errno, making the behaviour the same
as the built-in case.

Signed-off-by: Jeremy Kerr <[EMAIL PROTECTED]>
Acked-by: Arnd Bergmann <[EMAIL PROTECTED]>
Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Michael Neuling
This adds items to the taststats struct to account for user and system
time based on scaling the CPU frequency and instruction issue rates.

Adds account_(user|system)_time_scaled callbacks which architectures
can use to account for time using this mechanism.

Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
---
Updated based on comments from Balbir

 include/linux/kernel_stat.h |2 ++
 include/linux/sched.h   |2 +-
 include/linux/taskstats.h   |   11 +--
 kernel/delayacct.c  |6 ++
 kernel/fork.c   |2 ++
 kernel/sched.c  |   21 +
 kernel/timer.c  |7 +--
 kernel/tsacct.c |4 
 8 files changed, 50 insertions(+), 5 deletions(-)

Index: linux-2.6-ozlabs/include/linux/kernel_stat.h
===
--- linux-2.6-ozlabs.orig/include/linux/kernel_stat.h
+++ linux-2.6-ozlabs/include/linux/kernel_stat.h
@@ -52,7 +52,9 @@ static inline int kstat_irqs(int irq)
 }
 
 extern void account_user_time(struct task_struct *, cputime_t);
+extern void account_user_time_scaled(struct task_struct *, cputime_t);
 extern void account_system_time(struct task_struct *, int, cputime_t);
+extern void account_system_time_scaled(struct task_struct *, cputime_t);
 extern void account_steal_time(struct task_struct *, cputime_t);
 
 #endif /* _LINUX_KERNEL_STAT_H */
Index: linux-2.6-ozlabs/include/linux/sched.h
===
--- linux-2.6-ozlabs.orig/include/linux/sched.h
+++ linux-2.6-ozlabs/include/linux/sched.h
@@ -1020,7 +1020,7 @@ struct task_struct {
int __user *clear_child_tid;/* CLONE_CHILD_CLEARTID */
 
unsigned int rt_priority;
-   cputime_t utime, stime;
+   cputime_t utime, stime, utimescaled, stimescaled;
unsigned long nvcsw, nivcsw; /* context switch counts */
struct timespec start_time; /* monotonic time */
struct timespec real_start_time;/* boot based time */
Index: linux-2.6-ozlabs/include/linux/taskstats.h
===
--- linux-2.6-ozlabs.orig/include/linux/taskstats.h
+++ linux-2.6-ozlabs/include/linux/taskstats.h
@@ -31,7 +31,7 @@
  */
 
 
-#define TASKSTATS_VERSION  5
+#define TASKSTATS_VERSION  6
 #define TS_COMM_LEN32  /* should be >= TASK_COMM_LEN
 * in linux/sched.h */
 
@@ -85,9 +85,12 @@ struct taskstats {
 * On some architectures, value will adjust for cpu time stolen
 * from the kernel in involuntary waits due to virtualization.
 * Value is cumulative, in nanoseconds, without a corresponding count
-* and wraps around to zero silently on overflow
+* and wraps around to zero silently on overflow.  The
+* _scaled_ version accounts for cpus which can scale the
+* number of instructions executed each cycle.
 */
__u64   cpu_run_real_total;
+   __u64   cpu_scaled_run_real_total;
 
/* cpu "virtual" running time
 * Uses time intervals seen by the kernel i.e. no adjustment
@@ -142,6 +145,10 @@ struct taskstats {
__u64   write_char; /* bytes written */
__u64   read_syscalls;  /* read syscalls */
__u64   write_syscalls; /* write syscalls */
+
+   /* time accounting for SMT machines */
+   __u64   ac_utimescaled; /* utime scaled on frequency etc */
+   __u64   ac_stimescaled; /* stime scaled on frequency etc */
/* Extended accounting fields end */
 
 #define TASKSTATS_HAS_IO_ACCOUNTING
Index: linux-2.6-ozlabs/kernel/delayacct.c
===
--- linux-2.6-ozlabs.orig/kernel/delayacct.c
+++ linux-2.6-ozlabs/kernel/delayacct.c
@@ -115,6 +115,12 @@ int __delayacct_add_tsk(struct taskstats
tmp += timespec_to_ns(&ts);
d->cpu_run_real_total = (tmp < (s64)d->cpu_run_real_total) ? 0 : tmp;
 
+   tmp = (s64)d->cpu_scaled_run_real_total;
+   cputime_to_timespec(tsk->utimescaled + tsk->stimescaled, &ts);
+   tmp += timespec_to_ns(&ts);
+   d->cpu_scaled_run_real_total =
+   (tmp < (s64)d->cpu_scaled_run_real_total) ? 0 : tmp;
+
/*
 * No locking available for sched_info (and too expensive to add one)
 * Mitigate by taking snapshot of values
Index: linux-2.6-ozlabs/kernel/fork.c
===
--- linux-2.6-ozlabs.orig/kernel/fork.c
+++ linux-2.6-ozlabs/kernel/fork.c
@@ -1045,6 +1045,8 @@ static struct task_struct *copy_process(
 
p->utime = cputime_zero;
p->stime = cputime_zero;
+   p->utimescaled = cputime_zero;
+   p->stimescaled = cputime_zero;
 
 #ifdef CONFIG_TASK_XACCT
p->rchar = 0;   /* I/O counter: bytes read */
Index: 

Re: [PATCH] powerpc: Implement atomic{, 64}_{read, write}() without volatile

2007-08-16 Thread Paul Mackerras
Segher Boessenkool writes:

> Instead, use asm() like all other atomic operations already do.

> +static __inline__ long atomic64_read(const atomic_t *v)

> +static __inline__ void atomic64_set(atomic_t *v, long i)

s/atomic_t/atomic64_t/ in both lines.  I've edited my copy of the patch.

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


Re: [PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Michael Neuling


In message <[EMAIL PROTECTED]> you wrote:
> Hi, Michael,
> 
> Thanks for doing this, this is really useful.
> 
> Michael Neuling wrote:
> > This adds two items to the taststats struct to account for user and
> > system time based on scaling the CPU frequency and instruction issue
> > rates.
> > 
> > Adds account_(user|system)_time_scaled callbacks which architectures
> > can use to account for time using this mechanism.
> > 
> > Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
> > 
> > ---
> > 
> >  include/linux/kernel_stat.h |2 ++
> >  include/linux/sched.h   |2 +-
> >  include/linux/taskstats.h   |6 +-
> >  kernel/fork.c   |2 ++
> >  kernel/sched.c  |   21 +
> >  kernel/timer.c  |7 +--
> >  kernel/tsacct.c |4 
> >  7 files changed, 40 insertions(+), 4 deletions(-)
> > 
> > Index: linux-2.6-ozlabs/include/linux/kernel_stat.h
> > ===
> > --- linux-2.6-ozlabs.orig/include/linux/kernel_stat.h
> > +++ linux-2.6-ozlabs/include/linux/kernel_stat.h
> > @@ -52,7 +52,9 @@ static inline int kstat_irqs(int irq)
> >  }
> > 
> >  extern void account_user_time(struct task_struct *, cputime_t);
> > +extern void account_user_time_scaled(struct task_struct *, cputime_t);
> >  extern void account_system_time(struct task_struct *, int, cputime_t);
> > +extern void account_system_time_scaled(struct task_struct *, cputime_t);
> >  extern void account_steal_time(struct task_struct *, cputime_t);
> > 
> >  #endif /* _LINUX_KERNEL_STAT_H */
> > Index: linux-2.6-ozlabs/include/linux/sched.h
> > ===
> > --- linux-2.6-ozlabs.orig/include/linux/sched.h
> > +++ linux-2.6-ozlabs/include/linux/sched.h
> > @@ -1020,7 +1020,7 @@ struct task_struct {
> > int __user *clear_child_tid;/* CLONE_CHILD_CLEARTID */
> > 
> > unsigned int rt_priority;
> > -   cputime_t utime, stime;
> > +   cputime_t utime, stime, utimescaled, stimescaled;
> > unsigned long nvcsw, nivcsw; /* context switch counts */
> > struct timespec start_time; /* monotonic time */
> > struct timespec real_start_time;/* boot based time */
> > Index: linux-2.6-ozlabs/include/linux/taskstats.h
> > ===
> > --- linux-2.6-ozlabs.orig/include/linux/taskstats.h
> > +++ linux-2.6-ozlabs/include/linux/taskstats.h
> > @@ -31,7 +31,7 @@
> >   */
> > 
> > 
> > -#define TASKSTATS_VERSION  5
> > +#define TASKSTATS_VERSION  6
> >  #define TS_COMM_LEN32  /* should be >= TASK_COMM_LEN
> >  * in linux/sched.h */
> > 
> > @@ -142,6 +142,10 @@ struct taskstats {
> > __u64   write_char; /* bytes written */
> > __u64   read_syscalls;  /* read syscalls */
> > __u64   write_syscalls; /* write syscalls */
> > +
> > +   /* time accounting for SMT machines */
> > +   __u64   ac_utimescaled; /* utime scaled on frequency etc */
> > +   __u64   ac_stimescaled; /* stime scaled on frequency etc */
> > /* Extended accounting fields end */
> > 
> 
> I'd also request for you to add a cpu_scaled_run_real_total for use
> by delay accounting. cpu_scaled_run_real_total should be similar in
> functionality to cpu_run_real_total.

Will do.  Should I add cpu_scaled_run_real_total to the end of the
struct taskstat, or next to cpu_run_real_total?

> 
> >  #define TASKSTATS_HAS_IO_ACCOUNTING
> > Index: linux-2.6-ozlabs/kernel/fork.c
> > ===
> > --- linux-2.6-ozlabs.orig/kernel/fork.c
> > +++ linux-2.6-ozlabs/kernel/fork.c
> > @@ -1045,6 +1045,8 @@ static struct task_struct *copy_process(
> > 
> > p->utime = cputime_zero;
> > p->stime = cputime_zero;
> > +   p->utimescaled = cputime_zero;
> > +   p->stimescaled = cputime_zero;
> > 
> >  #ifdef CONFIG_TASK_XACCT
> > p->rchar = 0;   /* I/O counter: bytes read */
> > Index: linux-2.6-ozlabs/kernel/sched.c
> > ===
> > --- linux-2.6-ozlabs.orig/kernel/sched.c
> > +++ linux-2.6-ozlabs/kernel/sched.c
> > @@ -3249,6 +3249,16 @@ void account_user_time(struct task_struc
> >  }
> > 
> >  /*
> > + * Account scaled user cpu time to a process.
> > + * @p: the process that the cpu time gets accounted to
> > + * @cputime: the cpu time spent in user space since the last update
> > + */
> > +void account_user_time_scaled(struct task_struct *p, cputime_t cputime)
> > +{
> > +   p->utimescaled = cputime_add(p->utimescaled, cputime);
> > +}
> > +
> > +/*
> >   * Account system cpu time to a process.
> >   * @p: the process that the cpu time gets accounted to
> >   * @hardirq_offset: the offset to subtract from hardirq_count()
> > @@ -3280,6 +3290,17 @@ void account_system_time(struct 

Re: [PATCH 2/2] [POWERPC] Add scaled time accounting

2007-08-16 Thread Michael Neuling


In message <[EMAIL PROTECTED]> you wrote:
> Michael Neuling wrote:
> > This adds POWERPC specific hooks for scaled time accounting.
> > 
> > POWER6 includes a SPURR register.  The SPURR is based off the PURR
> > register but is scaled based on CPU frequency and issue rates.  This
> > gives a more accurate account of the instructions used per task.  The
> > PURR and timebase will be constant relative to the wall clock,
> > irrespective of the CPU frequency.  
> > 
> > This implementation reads the SPURR register in account_system_vtime
> > which is only call called on context witch and hard and soft irq entry
> > and exit.  The percentage of user and system time is then estimated
> > using the ratio of these accounted by the PURR.  If the SPURR is not
> > present, the PURR read.
> > 
> > An earlier implementation of this patch read the SPURR whenever the
> > PURR was read, which included the system call entry and exit path.
> > Unfortunately this showed a performance regression on lmbench runs, so
> > was re-implemented.
> > 
> > I've included the lmbench results here when run bare metal on POWER6.
> > 1st column is the unpatch results.  2nd column is the results using the
> > below patch and the 3rd is the % diff of these results from the base.
> > 4th and 5th columns are the results and % differnce from the base
> > using the older patch (SPURR read in syscall entry/exit path).
> > 
> >   BaseScaled-Acct SPURR-in-syscall 
> >  Result  Result  % diffResult % diff  
> > Simple syscall:  0.3086  0.3086  0.0.3452 11.8600 
> > Simple read: 0.4591  0.4671  1.74250.5044 9.86713 
> > Simple write:0.4364  0.4366  0.04580.4731 8.40971 
> > Simple stat: 2.0055  2.0295  1.19672.0669 3.06158 
> > Simple fstat:0.5962  0.5876  -1.4420.6368 6.80979 
> > Simple open/close:   3.1283  3.1009  -0.8753.2088 2.57328 
> > Select on 10 fd's:   0.8554  0.8457  -1.1330.8667 1.32101 
> > Select on 100 fd's:  3.5292  3.6329  2.93833.6664 3.88756 
> > Select on 250 fd's:  7.9097  8.1881  3.51978.2242 3.97613 
> > Select on 500 fd's:  15.2659 15.836  3.735715.873 3.97814 
> > Select on 10 tcp fd's:   0.9576  0.9416  -1.6700.9752 1.83792 
> > Select on 100 tcp fd's:  7.248   7.2254  -0.3117.2685 0.28283 
> > Select on 250 tcp fd's:  17.7742 17.707  -0.37517.749 -0.1406 
> > Select on 500 tcp fd's:  35.4258 35.25   -0.49635.286 -0.3929 
> > Signal handler installation: 0.6131  0.6075  -0.9130.647  5.52927 
> > Signal handler overhead: 2.0919  2.1078  0.76002.1831 4.35967 
> > Protection fault:0.7345  0.7478  1.81070.8031 9.33968 
> > Pipe latency:33.006  16.398  -50.3133.475 1.42368 
> > AF_UNIX sock stream latency: 14.5093 30.910  113.0330.715 111.692 
> > Process fork+exit:   219.8   222.8   1.3648229.37 4.35623 
> > Process fork+execve: 876.14  873.28  -0.32 868.66 -0.8533 
> > Process fork+/bin/sh -c: 28302876.5  1.64312958   4.52296 
> > File /var/tmp/XXX write bw:  1193497 1195536 0.1708118657 -0.5799 
> > Pagefaults on /var/tmp/XXX:  3.1272  3.2117  2.70203.2521 3.99398 
> > 
> > Also, kernel compile times show no difference with this patch applied.
> > 
> > Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
> > 
> > ---
> > 
> >  arch/powerpc/kernel/asm-offsets.c |1 +
> >  arch/powerpc/kernel/time.c|   32 ++--
> >  include/asm-powerpc/paca.h|3 +++
> >  3 files changed, 34 insertions(+), 2 deletions(-)
> > 
> > Index: linux-2.6-ozlabs/arch/powerpc/kernel/asm-offsets.c
> > ===
> > --- linux-2.6-ozlabs.orig/arch/powerpc/kernel/asm-offsets.c
> > +++ linux-2.6-ozlabs/arch/powerpc/kernel/asm-offsets.c
> > @@ -141,6 +141,7 @@ int main(void)
> > DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
> > DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
> > DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
> > +   DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
> > DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
> > DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
> > DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr))
;
> > Index: linux-2.6-ozlabs/arch/powerpc/kernel/time.c
> > ===
> > --- linux-2.6-ozlabs.orig/arch/powerpc/kernel/time.c
> > +++ linux-2.6-ozlabs/arch/powerpc/kernel/time.c
> > @@ -168,23 +168,44 @@ static u64 read_purr(void)
> >  }
> > 
> >  /*
> > + * Read

Re: [PATCH] [POWERPC] Invalid semicolon after if statement

2007-08-16 Thread Michael Ellerman
On Thu, 2007-08-16 at 18:40 +0200, Andreas Schwab wrote:
> Segher Boessenkool <[EMAIL PROTECTED]> writes:
> 
> >> Thanks to the frickin compiler for warning us, not.
> >
> > 4.3: "warning: suggest braces around empty body in an 'if' statement"
> >
> > 4.1: "warning: empty body in an if-statement"
> >
> > Your GCC is too old :-)
> 
> This warning is only enabled by -Wextra.  Only 4.3 has a separate option
> for it (-Wempty-body).

Oh good, so in 2011 we'll start getting a warning, sweet.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: 2.6.23-rc3 broken on G5

2007-08-16 Thread Andreas Schwab
Paul Mackerras <[EMAIL PROTECTED]> writes:

> Andreas Schwab writes:
>
>> This change:
>> 
>> commit edd0622bd2e8f755c960827e15aa6908c3c5aa94
>> Author: Paul Mackerras <[EMAIL PROTECTED]>
>> Date:   Fri Aug 10 21:04:07 2007 +1000
>> 
>> [POWERPC] Fix potential duplicate entry in SLB shadow buffer
>> 
>> is broken on PowerMac G5.  It crashes very early, before the bootx
>> console is set up.

I also tried PPC_EARLY_DEBUG, but that didn't show anything either.

> Hmmm.  It (current Linus git) works fine on my dual 2.0GHz G5.
>
> What sort of G5 do you have and what is your .config?

It's a dual 1.8GHz.  Config is attached.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.23-rc3
# Wed Aug 15 22:14:06 2007
#
CONFIG_PPC64=y

#
# Processor support
#
CONFIG_POWER4_ONLY=y
CONFIG_POWER4=y
CONFIG_PPC_FPU=y
CONFIG_ALTIVEC=y
CONFIG_PPC_STD_MMU=y
CONFIG_PPC_MM_SLICES=y
CONFIG_VIRT_CPU_ACCOUNTING=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2
CONFIG_64BIT=y
CONFIG_PPC_MERGE=y
CONFIG_MMU=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_IRQ_PER_CPU=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_ARCH_HAS_ILOG2_U64=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_ARCH_NO_VIRT_TO_BUS=y
CONFIG_PPC=y
CONFIG_EARLY_PRINTK=y
CONFIG_COMPAT=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_OF=y
CONFIG_OF=y
# CONFIG_PPC_UDBG_16550 is not set
CONFIG_GENERIC_TBSYNC=y
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_PPC64_SWSUSP=y
# CONFIG_PPC_DCR_NATIVE is not set
# CONFIG_PPC_DCR_MMIO is not set
# CONFIG_PPC_OF_PLATFORM_PCI is not set
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
CONFIG_USER_NS=y
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=19
CONFIG_CPUSETS=y
CONFIG_SYSFS_DEPRECATED=y
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
# CONFIG_EMBEDDED is not set
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
CONFIG_RT_MUTEXES=y
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_KMOD=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_BLK_DEV_IO_TRACE=y
CONFIG_BLK_DEV_BSG=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="cfq"

#
# Platform support
#
CONFIG_PPC_MULTIPLATFORM=y
# CONFIG_EMBEDDED6xx is not set
# CONFIG_PPC_82xx is not set
# CONFIG_PPC_83xx is not set
# CONFIG_PPC_86xx is not set
# CONFIG_PPC_PSERIES is not set
# CONFIG_PPC_ISERIES is not set
# CONFIG_PPC_MPC52xx is not set
# CONFIG_PPC_MPC5200 is not set
CONFIG_PPC_PMAC=y
CONFIG_PPC_PMAC64=y
# CONFIG_PPC_MAPLE is not set
# CONFIG_PPC_PASEMI is not set
# CONFIG_PPC_CELLEB is not set
# CONFIG_PPC_PS3 is not set
# CONFIG_PPC_CELL is not set
# CONFIG_PPC_CELL_NATIVE is not set
# CONFIG_PPC_IBM_CELL_BLADE is not set
# CONFIG_PQ2ADS is not set
CONFIG_PPC_NATIVE=y
CONFIG_MPIC=y
# CONFIG_MPIC_WEIRD is not set
# CONFIG_PPC_I8259 is not set
CONFIG_U3_DART=y
# CONFIG_PPC_RTAS is not set
# CONFIG_MMIO_NVRAM is not set
CONFIG_MPIC_U3_HT_IRQS=y
# CONFIG_PPC_MPC106 is not set
CONFIG_PPC_970_NAP=y
# CONFIG_PPC_INDIRECT_IO is not set
# CONFIG_GENERIC_IOMAP is not set
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
# CONFIG_CPU_FREQ_DEBUG is not set
CONFIG_CPU_FREQ_STAT=m
CONFIG_CPU_FREQ_STAT_DETAILS=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

#
# CPU Frequency drivers
#
CONFIG_CPU_FREQ_PM

[PATCH] powerpc: add setclrbits macros

2007-08-16 Thread Timur Tabi
This patch adds the setclrbits_xxx() macros, which are used to set and clear
multiple bits in a single read-modify-write operation.  Specify the bits
to set in the 'set' parameter and the bits to clear in the 'clear' parameter.
These macros can also be used to set a multiple-bit bit pattern using a mask,
by specifying the mask in the 'clear' parameter and the new bit pattern in the
'set' parameter.  There are big-endian and little-endian versions for 8, 16,
32, and 64 bits.

Signed-off-by: Timur Tabi <[EMAIL PROTECTED]>
---

Changed the macros from setmaskedbits_xxx to setclrbits_xxx and added a comment
indicating the expanded functionality.

 include/asm-powerpc/io.h |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index bb8d965..58c8b96 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -734,6 +734,33 @@ static inline void * bus_to_virt(unsigned long address)
 #define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) |  (_v))
 #define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
 
+/* Set and clear bits in one shot.  These macros can be used to clear and
+ * set multiple bits in a register using a single read-modify-write.  These
+ * macros can also be used to set a multiple-bit bit pattern using a mask,
+ * by specifying the mask in the 'clear' parameter and the new bit pattern
+ * in the 'set' parameter.
+ */
+
+#ifdef __powerpc64__
+#define setclrbits_be64(addr, set, clear) \
+   out_be64((addr), (in_be64(addr) & ~(clear)) | (set))
+#define setclrbits_le64(addr, set, clear) \
+   out_le64((addr), (in_le64(addr) & ~(clear)) | (set))
+#endif
+
+#define setclrbits_be32(addr, set, clear) \
+   out_be32((addr), (in_be32(addr) & ~(clear)) | (set))
+#define setclrbits_be16(addr, set, clear) \
+   out_be16((addr), (in_be16(addr) & ~(clear)) | (set))
+
+#define setclrbits_le32(addr, set, clear) \
+   out_le32((addr), (in_le32(addr) & ~(clear)) | (set))
+#define setclrbits_le16(addr, set, clear) \
+   out_le16((addr), (in_le16(addr) & ~(clear)) | (set))
+
+#define setclrbits_8(addr, set, clear) \
+   out_8((addr), (in_8(addr) & ~(clear)) | (set))
+
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_POWERPC_IO_H */
-- 
1.5.2.4

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


Re: 2.6.23-rc3 broken on G5

2007-08-16 Thread Paul Mackerras
Andreas Schwab writes:

> This change:
> 
> commit edd0622bd2e8f755c960827e15aa6908c3c5aa94
> Author: Paul Mackerras <[EMAIL PROTECTED]>
> Date:   Fri Aug 10 21:04:07 2007 +1000
> 
> [POWERPC] Fix potential duplicate entry in SLB shadow buffer
> 
> is broken on PowerMac G5.  It crashes very early, before the bootx
> console is set up.

Hmmm.  It (current Linus git) works fine on my dual 2.0GHz G5.

What sort of G5 do you have and what is your .config?

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


Re: [PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Paul Mackerras
Linas Vepstas writes:

> My gut impression (maybe wrong?) is that the scaled time is,
> in a certain sense, "more accurate" than the unscaled time.

The "unscaled" time is just time, as in "how many seconds did this
task spend on the CPU".  It's what all the tools (except a certain
proprietary workload manager) expect.  Top, ps, etc. get unhappy if
the times reported (user, system, hardirq, softirq, idle, stolen)
don't add up to elapsed wall-clock time.

The "scaled" time is really CPU cycles divided by some arbitrary
factor (the notional CPU frequency).  So yes it does give some
indication of how much progress the task should have made, in some
sense.

Both measures are useful.  Because the current user API is in terms of
real time rather than cycles, we have to continue reporting real time,
not scaled time, which is why the existing interfaces report unscaled
time, and the scaled time values are reported through a new extension
to the taskstats interface.

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


Machine automagically reboots with 2.6.23-rc2-mm2

2007-08-16 Thread Balbir Singh
Hi,

My machine reboots automatically after a few seconds of booting 2.6.23-rc2-mm2.
I've tried several ways to debug the problem, but I've had no success.
I am not sure if this problem has been reported already, a few simple searches
did not indicate that the problem had been reported

2.6.23-rc1-mm1 did not have this problem.


.config is attached with this email.

/proc/cpuinfo shows

processor   : 0
cpu : POWER5 (gr)
clock   : 1654.344000MHz
revision: 2.3 (pvr 003a 0203)

processor   : 1
cpu : POWER5 (gr)
clock   : 1654.344000MHz
revision: 2.3 (pvr 003a 0203)

processor   : 2
cpu : POWER5 (gr)
clock   : 1654.344000MHz
revision: 2.3 (pvr 003a 0203)

processor   : 3
cpu : POWER5 (gr)
clock   : 1654.344000MHz
revision: 2.3 (pvr 003a 0203)

timebase: 206998000
machine : CHRP IBM,9123-710

lspci shows

00:02.0 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
00:02.2 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
00:02.3 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
00:02.4 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
c0:01.0 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet 
Controller (Copper) (rev 01)
c0:01.1 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet 
Controller (Copper) (rev 01)
c8:01.0 USB Controller: NEC Corporation USB (rev 43)
c8:01.1 USB Controller: NEC Corporation USB (rev 43)
c8:01.2 USB Controller: NEC Corporation USB 2.0 (rev 04)
cc:01.0 Mass storage controller: Promise Technology, Inc. 20275 (rev 01)
d0:01.0 SCSI storage controller: Mylex Corporation AcceleRAID 
600/500/400/Sapphire support Device (rev 04)
0001:00:02.2 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
0001:00:02.4 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
0001:00:02.6 PCI bridge: IBM EADS-X PCI-X to PCI-X Bridge (rev 03)
0001:d0:01.0 Ethernet controller: Intel Corporation 82545GM Gigabit Ethernet 
Controller (rev 04)

Normal kernel boot (memory info)

EEH: PCI Enhanced I/O Error Handling Enabled
PPC64 nvram contains 7168 bytes
Using dedicated idle loop
Top of RAM: 0xe900, Total RAM: 0xe900
Memory hole size: 0MB
On node 0 totalpages: 954368
  DMA zone: 954368 pages, LIFO batch:31
  DMA32 zone: 0 pages, LIFO batch:0
  Normal zone: 0 pages, LIFO batch:0
  HighMem zone: 0 pages, LIFO batch:0
[boot]0015 Setup Done
Built 1 zonelists


-- 
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.23-rc2-mm2
# Thu Aug 16 15:02:55 2007
#
CONFIG_PPC64=y

#
# Processor support
#
# CONFIG_POWER4_ONLY is not set
CONFIG_POWER3=y
CONFIG_POWER4=y
CONFIG_PPC_FPU=y
CONFIG_ALTIVEC=y
CONFIG_PPC_STD_MMU=y
CONFIG_PPC_MM_SLICES=y
CONFIG_VIRT_CPU_ACCOUNTING=y
CONFIG_SMP=y
CONFIG_NR_CPUS=32
CONFIG_64BIT=y
CONFIG_PPC_MERGE=y
CONFIG_MMU=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_IRQ_PER_CPU=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_ARCH_HAS_ILOG2_U64=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_ARCH_NO_VIRT_TO_BUS=y
CONFIG_PPC=y
CONFIG_EARLY_PRINTK=y
CONFIG_COMPAT=y
CONFIG_SYSVIPC_COMPAT=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_OF=y
CONFIG_OF=y
CONFIG_PPC_UDBG_16550=y
CONFIG_GENERIC_TBSYNC=y
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_PPC64_SWSUSP=y
# CONFIG_PPC_DCR_NATIVE is not set
CONFIG_PPC_DCR_MMIO=y
CONFIG_PPC_DCR=y
CONFIG_PPC_OF_PLATFORM_PCI=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_SWAP=y
CONFIG_SWAP_PREFETCH=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_BSD_PROCESS_ACCT is not set
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y
# CONFIG_USER_NS is not set
# CONFIG_AUDIT is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=17
CONFIG_CONTAINERS=y
CONFIG_CONTAINER_DEBUG=y
# CONFIG_CONTAINER_NS is not set
CONFIG_CONTAINER_CPUACCT=y
CONFIG_CPUSETS=y
CONFIG_RESOURCE_COUNTERS=y
CONFIG_SYSFS_DEPRECATED=y
CONFIG_CONTAINER_MEM_CONT=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
# CONFIG_EMBEDDED is not set
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
CONFIG_PROC_PAGE_MONI

Re: [PATCH 1/1] libata: pata_pdc2027x PLL input clock fix

2007-08-16 Thread Alan Cox
> > Unfortunately this breaks pata_pdc2027x on my PowerMac G3:
> 
> Did this ever get resolved?

All went quiet so I assume its gone away ?
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/1] libata: pata_pdc2027x PLL input clock fix

2007-08-16 Thread Jeff Garzik
Mikael Pettersson wrote:
> (cc:ing linuxppc-dev)
> 
> On Tue, 26 Jun 2007 13:43:15 +0800, Albert Lee wrote:
>> Recently the PLL input clock of pata_pdc2027x is sometimes detected
>> higer than expected (e.g. 20.027 MHz compared to 16.714 MHz).
>> It seems sometimes the mdelay() function is not as precise as it
>> used to be. Per Alan's advice, HT or power management might affect
>> the precision of mdelay().
>>
>> This patch calls gettimeofday() to mesure the time elapsed and
>> calculate the PLL input clock accordingly.
> 
> Unfortunately this breaks pata_pdc2027x on my PowerMac G3:

Did this ever get resolved?

Jeff



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


Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Timur Tabi
Benjamin Herrenschmidt wrote:

>> The second example is actually a trick that lets me set some bits and clear 
>> others in one shot, so for the gumr_h register, all of the above values are 
>> single bits.  I guess that's not a good example.
> 
> Such tricks deserve at least a comment.

Would it be better if the function were called setclrbits_xxx(), and advertise 
that it can be used to set multi-bit fields *and* set and clear bits at the 
same time?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: adding Pegasus IDE quirk for pata_via

2007-08-16 Thread Olaf Hering
On Tue, Apr 10, Olaf Hering wrote:

> Where is the correct place for drivers/ata?

so, where is the place for via irq quirks in libata?
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: adding Pegasus IDE quirk for pata_via

2007-08-16 Thread Olaf Hering
On Mon, Apr 09, Matt Sealey wrote:

> + if (bridge) {
> + u8 iir, irqlist[4] = { 14, 15, 10, 
> 11 };
> +
> + pci_read_config_byte(bridge, 
> VIA_IDE_STEERING, &iir);

What value has VIA_IDE_STEERING?
Googles only reference is your own posting.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [ofa-general] [PATCH 7/7] IB/ehca: Prevent overwriting QP init attributes given by caller

2007-08-16 Thread Hoang-Nam Nguyen
[EMAIL PROTECTED] wrote on 16.08.2007 18:17:22:

> I don't understand this patch.   says this about
> ib_create_qp():
>
>  * @qp_init_attr: A list of initial attributes required to create the
>  *   QP.  If QP creation succeeds, then the attributes are updated to
>  *   the actual capabilities of the created QP.
>
> So it seems the current code is actually correct and your patch breaks
> it??
Yes. That's absolutely true. Please ignore it.
Thanks!
Nam

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


Re: [PATCH] [POWERPC] Invalid semicolon after if statement

2007-08-16 Thread Andreas Schwab
Segher Boessenkool <[EMAIL PROTECTED]> writes:

>> Thanks to the frickin compiler for warning us, not.
>
> 4.3: "warning: suggest braces around empty body in an 'if' statement"
>
> 4.1: "warning: empty body in an if-statement"
>
> Your GCC is too old :-)

This warning is only enabled by -Wextra.  Only 4.3 has a separate option
for it (-Wempty-body).

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Benjamin Herrenschmidt
On Thu, 2007-08-16 at 10:26 -0500, Timur Tabi wrote:
> Kumar Gala wrote:
> 
> >> setmaskedbits_be32(&uccp->gumr_l,
> >> UCC_SLOW_GUMR_L_MODE_QMC | UCC_SLOW_GUMR_L_TDCR_1 |
> >> UCC_SLOW_GUMR_L_RDCR_16,
> >> UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK |
> >> UCC_SLOW_GUMR_L_RDCR_MASK);
> >>
> >> setmaskedbits_be32(&uccp->gumr_h,
> >> UCC_SLOW_GUMR_H_SUART | UCC_SLOW_GUMR_H_TRX |
> >> UCC_SLOW_GUMR_H_TTX, UCC_SLOW_GUMR_H_RFW);
> > 
> > Can you also show what the UCC_SLOW* values look like.
> 
> The second example is actually a trick that lets me set some bits and clear 
> others in one shot, so for the gumr_h register, all of the above values are 
> single bits.  I guess that's not a good example.

Such tricks deserve at least a comment.

Ben.


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


Re: [PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Linas Vepstas
On Thu, Aug 16, 2007 at 05:09:22PM +1000, Michael Neuling wrote:
> This adds two items to the taststats struct to account for user and
> system time based on scaling the CPU frequency and instruction issue
> rates.
> 
> Adds account_(user|system)_time_scaled callbacks which architectures
> can use to account for time using this mechanism.

There's something simple here that I just don't understand.

>  /*
> + * Account scaled user cpu time to a process.
> + * @p: the process that the cpu time gets accounted to
> + * @cputime: the cpu time spent in user space since the last update
> + */
> +void account_user_time_scaled(struct task_struct *p, cputime_t cputime)
> +{
> + p->utimescaled = cputime_add(p->utimescaled, cputime);
> +}

My gut impression (maybe wrong?) is that the scaled time is,
in a certain sense, "more accurate" than the unscaled time.
In fact, the unscaled time gives me the impression of being
rather meaningless, as it has no particular significance
with respect to the wall-clock, and it also doesn't give
any accurate hint of how much cpu resource was actually
consumed.

If one has a cpu with frequency scaling, then when would
one ever be interested in the non-scaled time? If the answer
is "never", then why not just always use the scaled time,
instead of adding more stuff to the kernel structs?

--linas

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


Re: [ofa-general] [PATCH 7/7] IB/ehca: Prevent overwriting QP init attributes given by caller

2007-08-16 Thread Roland Dreier
I don't understand this patch.   says this about
ib_create_qp():

 * @qp_init_attr: A list of initial attributes required to create the
 *   QP.  If QP creation succeeds, then the attributes are updated to
 *   the actual capabilities of the created QP.

So it seems the current code is actually correct and your patch breaks
it??
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Timur Tabi
Michael Ellerman wrote:

> And if you're going to the trouble of making a macro, why not make it a
> bit more useful and have it check that the value and the mask match, ie:
> 
> (v & ~m == 0)

What should I do if it fails this check?

> Final random thought, you could make the size/endian an argument:
> 
> #define setmaskedbits(a, v, m, s)  out_##s((a), (in_##s(a) & ~(m) | (v))

Hmmm the only thing wrong with that is that it would allow be64 on a 
32-bit platform (i.e. no __power64__ protection).  But that's minor.

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Timur Tabi
Kumar Gala wrote:

>> setmaskedbits_be32(&uccp->gumr_l,
>> UCC_SLOW_GUMR_L_MODE_QMC | UCC_SLOW_GUMR_L_TDCR_1 |
>> UCC_SLOW_GUMR_L_RDCR_16,
>> UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK |
>> UCC_SLOW_GUMR_L_RDCR_MASK);
>>
>> setmaskedbits_be32(&uccp->gumr_h,
>> UCC_SLOW_GUMR_H_SUART | UCC_SLOW_GUMR_H_TRX |
>> UCC_SLOW_GUMR_H_TTX, UCC_SLOW_GUMR_H_RFW);
> 
> Can you also show what the UCC_SLOW* values look like.

The second example is actually a trick that lets me set some bits and clear 
others in one shot, so for the gumr_h register, all of the above values are 
single bits.  I guess that's not a good example.

For gumr_l, we have:

#define UCC_SLOW_GUMR_L_TDCR_MASK   0x0003
#define UCC_SLOW_GUMR_L_TDCR_32 0x0003
#define UCC_SLOW_GUMR_L_TDCR_16 0x0002
#define UCC_SLOW_GUMR_L_TDCR_8  0x0001
#define UCC_SLOW_GUMR_L_TDCR_1  0x
#define UCC_SLOW_GUMR_L_RDCR_MASK   0xc000
#define UCC_SLOW_GUMR_L_RDCR_32 0xc000
#define UCC_SLOW_GUMR_L_RDCR_16 0x8000
#define UCC_SLOW_GUMR_L_RDCR_8  0x4000
#define UCC_SLOW_GUMR_L_RDCR_1  0x
#define UCC_SLOW_GUMR_L_MODE_MASK   0x000F
#define UCC_SLOW_GUMR_L_MODE_BISYNC 0x0008
#define UCC_SLOW_GUMR_L_MODE_AHDLC  0x0006
#define UCC_SLOW_GUMR_L_MODE_UART   0x0004
#define UCC_SLOW_GUMR_L_MODE_QMC0x0002

So for example, I could not use setbits32 to set UCC_SLOW_GUMR_L_RDCR_16 (10) 
if it was currently UCC_SLOW_GUMR_L_RDCR_32 (11).


-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Kumar Gala

On Aug 16, 2007, at 10:18 AM, Timur Tabi wrote:

> Kumar Gala wrote:
>
>> Can you post a driver that uses this.  I'm interested in seeing  
>> what the readability is really like using these macros.
>
> I do not yet have any drivers ready, but I can give you an example:
>
>   setmaskedbits_be32(&uccp->gumr_l,
>   UCC_SLOW_GUMR_L_MODE_QMC | UCC_SLOW_GUMR_L_TDCR_1 |
>   UCC_SLOW_GUMR_L_RDCR_16,
> UCC_SLOW_GUMR_L_MODE_MASK |  
> UCC_SLOW_GUMR_L_TDCR_MASK |
>   UCC_SLOW_GUMR_L_RDCR_MASK);
>
>   setmaskedbits_be32(&uccp->gumr_h,
>   UCC_SLOW_GUMR_H_SUART | UCC_SLOW_GUMR_H_TRX |
>   UCC_SLOW_GUMR_H_TTX, UCC_SLOW_GUMR_H_RFW);

Can you also show what the UCC_SLOW* values look like.

> The alternative to using a macro like this is to do this:
>
>   reg = in_be32(p);
>   reg &= ~some-mask-bits;
>   reg |= some-other-bits;
>   out_be32(p, reg);
>
> -- 
> Timur Tabi
> Linux Kernel Developer @ Freescale

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


Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Timur Tabi
Kumar Gala wrote:

> Can you post a driver that uses this.  I'm interested in seeing what the 
> readability is really like using these macros.

I do not yet have any drivers ready, but I can give you an example:

setmaskedbits_be32(&uccp->gumr_l,
UCC_SLOW_GUMR_L_MODE_QMC | UCC_SLOW_GUMR_L_TDCR_1 |
UCC_SLOW_GUMR_L_RDCR_16,
 UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK |
UCC_SLOW_GUMR_L_RDCR_MASK);

setmaskedbits_be32(&uccp->gumr_h,
UCC_SLOW_GUMR_H_SUART | UCC_SLOW_GUMR_H_TRX |
UCC_SLOW_GUMR_H_TTX, UCC_SLOW_GUMR_H_RFW);

The alternative to using a macro like this is to do this:

reg = in_be32(p);
reg &= ~some-mask-bits;
reg |= some-other-bits;
out_be32(p, reg);

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Invalid semicolon after if statement

2007-08-16 Thread Segher Boessenkool
> Thanks to the frickin compiler for warning us, not.

4.3: "warning: suggest braces around empty body in an 'if' statement"

4.1: "warning: empty body in an if-statement"

Your GCC is too old :-)


Segher

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


[PATCH 2/6] powerpc: hash_preload fails to preload under CONFIG_PPC_MM_SLICES

2007-08-16 Thread Andy Whitcroft

Seems that a trailing ';' has slipped onto the end of the
get_slice_psize checks under CONFIG_PPC_MM_SLICES causing us to
return unconditionally and never preload.

Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
Cc: Paul Mackerras <[EMAIL PROTECTED]>
Cc: linuxppc-dev@ozlabs.org
---
 arch/powerpc/mm/hash_utils_64.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index f178957..a47151e 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -795,7 +795,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
 
 #ifdef CONFIG_PPC_MM_SLICES
/* We only prefault standard pages for now */
-   if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize));
+   if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize))
return;
 #endif
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] [POWERPC] Add scaled time accounting

2007-08-16 Thread Balbir Singh
Michael Neuling wrote:
> This adds POWERPC specific hooks for scaled time accounting.
> 
> POWER6 includes a SPURR register.  The SPURR is based off the PURR
> register but is scaled based on CPU frequency and issue rates.  This
> gives a more accurate account of the instructions used per task.  The
> PURR and timebase will be constant relative to the wall clock,
> irrespective of the CPU frequency.  
> 
> This implementation reads the SPURR register in account_system_vtime
> which is only call called on context witch and hard and soft irq entry
> and exit.  The percentage of user and system time is then estimated
> using the ratio of these accounted by the PURR.  If the SPURR is not
> present, the PURR read.
> 
> An earlier implementation of this patch read the SPURR whenever the
> PURR was read, which included the system call entry and exit path.
> Unfortunately this showed a performance regression on lmbench runs, so
> was re-implemented.
> 
> I've included the lmbench results here when run bare metal on POWER6.
> 1st column is the unpatch results.  2nd column is the results using the
> below patch and the 3rd is the % diff of these results from the base.
> 4th and 5th columns are the results and % differnce from the base
> using the older patch (SPURR read in syscall entry/exit path).
> 
>   BaseScaled-Acct SPURR-in-syscall 
>  Result  Result  % diffResult % diff  
> Simple syscall:  0.3086  0.3086  0.0.3452 11.8600 
> Simple read: 0.4591  0.4671  1.74250.5044 9.86713 
> Simple write:0.4364  0.4366  0.04580.4731 8.40971 
> Simple stat: 2.0055  2.0295  1.19672.0669 3.06158 
> Simple fstat:0.5962  0.5876  -1.4420.6368 6.80979 
> Simple open/close:   3.1283  3.1009  -0.8753.2088 2.57328 
> Select on 10 fd's:   0.8554  0.8457  -1.1330.8667 1.32101 
> Select on 100 fd's:  3.5292  3.6329  2.93833.6664 3.88756 
> Select on 250 fd's:  7.9097  8.1881  3.51978.2242 3.97613 
> Select on 500 fd's:  15.2659 15.836  3.735715.873 3.97814 
> Select on 10 tcp fd's:   0.9576  0.9416  -1.6700.9752 1.83792 
> Select on 100 tcp fd's:  7.248   7.2254  -0.3117.2685 0.28283 
> Select on 250 tcp fd's:  17.7742 17.707  -0.37517.749 -0.1406 
> Select on 500 tcp fd's:  35.4258 35.25   -0.49635.286 -0.3929 
> Signal handler installation: 0.6131  0.6075  -0.9130.647  5.52927 
> Signal handler overhead: 2.0919  2.1078  0.76002.1831 4.35967 
> Protection fault:0.7345  0.7478  1.81070.8031 9.33968 
> Pipe latency:33.006  16.398  -50.3133.475 1.42368 
> AF_UNIX sock stream latency: 14.5093 30.910  113.0330.715 111.692 
> Process fork+exit:   219.8   222.8   1.3648229.37 4.35623 
> Process fork+execve: 876.14  873.28  -0.32 868.66 -0.8533 
> Process fork+/bin/sh -c: 28302876.5  1.64312958   4.52296 
> File /var/tmp/XXX write bw:  1193497 1195536 0.1708118657 -0.5799 
> Pagefaults on /var/tmp/XXX:  3.1272  3.2117  2.70203.2521 3.99398 
> 
> Also, kernel compile times show no difference with this patch applied.
> 
> Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
> 
> ---
> 
>  arch/powerpc/kernel/asm-offsets.c |1 +
>  arch/powerpc/kernel/time.c|   32 ++--
>  include/asm-powerpc/paca.h|3 +++
>  3 files changed, 34 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6-ozlabs/arch/powerpc/kernel/asm-offsets.c
> ===
> --- linux-2.6-ozlabs.orig/arch/powerpc/kernel/asm-offsets.c
> +++ linux-2.6-ozlabs/arch/powerpc/kernel/asm-offsets.c
> @@ -141,6 +141,7 @@ int main(void)
>   DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
>   DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
>   DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
> + DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
>   DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
>   DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
>   DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
> Index: linux-2.6-ozlabs/arch/powerpc/kernel/time.c
> ===
> --- linux-2.6-ozlabs.orig/arch/powerpc/kernel/time.c
> +++ linux-2.6-ozlabs/arch/powerpc/kernel/time.c
> @@ -168,23 +168,44 @@ static u64 read_purr(void)
>  }
> 
>  /*
> + * Read the SPURR on systems that have it, otherwise the purr
> + */
> +static u64 read_spurr(void)
> +{
> + if (cpu_has_feature(CPU_FTR_SPURR))
> + return mfspr(SPRN_SPURR);
> + return re

Re: [PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Balbir Singh
Hi, Michael,

Thanks for doing this, this is really useful.

Michael Neuling wrote:
> This adds two items to the taststats struct to account for user and
> system time based on scaling the CPU frequency and instruction issue
> rates.
> 
> Adds account_(user|system)_time_scaled callbacks which architectures
> can use to account for time using this mechanism.
> 
> Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>
> 
> ---
> 
>  include/linux/kernel_stat.h |2 ++
>  include/linux/sched.h   |2 +-
>  include/linux/taskstats.h   |6 +-
>  kernel/fork.c   |2 ++
>  kernel/sched.c  |   21 +
>  kernel/timer.c  |7 +--
>  kernel/tsacct.c |4 
>  7 files changed, 40 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6-ozlabs/include/linux/kernel_stat.h
> ===
> --- linux-2.6-ozlabs.orig/include/linux/kernel_stat.h
> +++ linux-2.6-ozlabs/include/linux/kernel_stat.h
> @@ -52,7 +52,9 @@ static inline int kstat_irqs(int irq)
>  }
> 
>  extern void account_user_time(struct task_struct *, cputime_t);
> +extern void account_user_time_scaled(struct task_struct *, cputime_t);
>  extern void account_system_time(struct task_struct *, int, cputime_t);
> +extern void account_system_time_scaled(struct task_struct *, cputime_t);
>  extern void account_steal_time(struct task_struct *, cputime_t);
> 
>  #endif /* _LINUX_KERNEL_STAT_H */
> Index: linux-2.6-ozlabs/include/linux/sched.h
> ===
> --- linux-2.6-ozlabs.orig/include/linux/sched.h
> +++ linux-2.6-ozlabs/include/linux/sched.h
> @@ -1020,7 +1020,7 @@ struct task_struct {
>   int __user *clear_child_tid;/* CLONE_CHILD_CLEARTID */
> 
>   unsigned int rt_priority;
> - cputime_t utime, stime;
> + cputime_t utime, stime, utimescaled, stimescaled;
>   unsigned long nvcsw, nivcsw; /* context switch counts */
>   struct timespec start_time; /* monotonic time */
>   struct timespec real_start_time;/* boot based time */
> Index: linux-2.6-ozlabs/include/linux/taskstats.h
> ===
> --- linux-2.6-ozlabs.orig/include/linux/taskstats.h
> +++ linux-2.6-ozlabs/include/linux/taskstats.h
> @@ -31,7 +31,7 @@
>   */
> 
> 
> -#define TASKSTATS_VERSION5
> +#define TASKSTATS_VERSION6
>  #define TS_COMM_LEN  32  /* should be >= TASK_COMM_LEN
>* in linux/sched.h */
> 
> @@ -142,6 +142,10 @@ struct taskstats {
>   __u64   write_char; /* bytes written */
>   __u64   read_syscalls;  /* read syscalls */
>   __u64   write_syscalls; /* write syscalls */
> +
> + /* time accounting for SMT machines */
> + __u64   ac_utimescaled; /* utime scaled on frequency etc */
> + __u64   ac_stimescaled; /* stime scaled on frequency etc */
>   /* Extended accounting fields end */
> 

I'd also request for you to add a cpu_scaled_run_real_total for use
by delay accounting. cpu_scaled_run_real_total should be similar in
functionality to cpu_run_real_total.

>  #define TASKSTATS_HAS_IO_ACCOUNTING
> Index: linux-2.6-ozlabs/kernel/fork.c
> ===
> --- linux-2.6-ozlabs.orig/kernel/fork.c
> +++ linux-2.6-ozlabs/kernel/fork.c
> @@ -1045,6 +1045,8 @@ static struct task_struct *copy_process(
> 
>   p->utime = cputime_zero;
>   p->stime = cputime_zero;
> + p->utimescaled = cputime_zero;
> + p->stimescaled = cputime_zero;
> 
>  #ifdef CONFIG_TASK_XACCT
>   p->rchar = 0;   /* I/O counter: bytes read */
> Index: linux-2.6-ozlabs/kernel/sched.c
> ===
> --- linux-2.6-ozlabs.orig/kernel/sched.c
> +++ linux-2.6-ozlabs/kernel/sched.c
> @@ -3249,6 +3249,16 @@ void account_user_time(struct task_struc
>  }
> 
>  /*
> + * Account scaled user cpu time to a process.
> + * @p: the process that the cpu time gets accounted to
> + * @cputime: the cpu time spent in user space since the last update
> + */
> +void account_user_time_scaled(struct task_struct *p, cputime_t cputime)
> +{
> + p->utimescaled = cputime_add(p->utimescaled, cputime);
> +}
> +
> +/*
>   * Account system cpu time to a process.
>   * @p: the process that the cpu time gets accounted to
>   * @hardirq_offset: the offset to subtract from hardirq_count()
> @@ -3280,6 +3290,17 @@ void account_system_time(struct task_str
>  }
> 
>  /*
> + * Account scaled system cpu time to a process.
> + * @p: the process that the cpu time gets accounted to
> + * @hardirq_offset: the offset to subtract from hardirq_count()
> + * @cputime: the cpu time spent in kernel space since the last update
> + */
> +void account_system_time_scaled(struct task_struct *p, cputime_t cputim

Re: [PATCH] [POWERPC] Invalid semicolon after if statement

2007-08-16 Thread Michael Ellerman
On Thu, 2007-08-16 at 01:03 +0300, Ilpo Järvinen wrote:
> A similar fix to netfilter from Eric Dumazet inspired me to
> look around a bit by using some grep/sed stuff as looking for
> this kind of bugs seemed easy to automate. This is one of them
> I found where it looks like this semicolon is not valid.
> 
> Signed-off-by: Ilpo Järvinen <[EMAIL PROTECTED]>
> ---
> 
> ...Since I'm not familiar with these parts of the kernel, you might know 
> better than I do if this is stuff is valid...
> 
>  arch/powerpc/mm/hash_utils_64.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index f178957..a47151e 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -795,7 +795,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
>  
>  #ifdef CONFIG_PPC_MM_SLICES
>   /* We only prefault standard pages for now */
> - if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize));
> + if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize))
>   return;
>  #endif

Er yeah that's bad. On kernels with MM_SLICES set we never prefault
anything .. oops ..

And testing confirms that's what's happening, with the semicolon gone we
do prefault somethings.

Thanks to the frickin compiler for warning us, not.

This should probably go to stable for 22 IMHO.

Nice catch Ilpo, perhaps someone should hack sparse to check for that
sort of thing.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: PS3 improved video mode autodetection for HDMI/DVI

2007-08-16 Thread Stefan Assmann
Geert Uytterhoeven schrieb:
> If it fails, please add `#define DEBUG' to drivers/ps3/ps3av.c, send me the
> `Monitor Info' output in the kernel log (dmesg), and tell me which of the
> PS3 video modes (1-13) work and which don't. ps3av has a quirk database for
> monitors that advertise non-working modes, so it can probably be fixed.
> (BTW, even if autodetect works fine, I always welcome this information)
>   
Samsung SyncMaster 226BW

The autodetection leaves me with an unsupported resolution. I tried
adding the monitor to the quirk list. Works fine now. Using 720p as
default  resolution might be worth a thought. This should work on all HD
screen.

GOOD: 2,3,5,7,8,10,11,12,13
BAD: 1,4,6,9

Monitor Info: size 96
avport: 00
monitor_id:  4c 2d 7f 02 32 32 45 4d 0d 11
monitor_type: 02
monitor_name: SyncMaster
resolution_60: bits: 000d native: 
resolution_50: bits:  native: 
resolution_other: bits:  native: 
resolution_vesa: bits: 0001 native: 
color spacergb: 01
color space yuv444: 00
color space yuv422: 00
color info   red: X 0293 Y 0155
color info green: X 0125 Y 0269
color info  blue: X 009c Y 0051
color info white: X 0141 Y 0151
color info gamma:  00dc
supported_AI: 00
speaker_info: 00
num of audio: 00
ps3av_hdmi_get_id: Using supported mode 4


btw, I get the following message while booting:
PS3AV_CID_AV_VIDEO_DISABLE_SIG: failed 2 port 10

does this ring a bell? I'm using kernel 2.6.22 with ps3 patches

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


Re: [PATCH] [POWERPC] Invalid semicolon after if statement

2007-08-16 Thread Geert Uytterhoeven
On Thu, 16 Aug 2007, [ISO-8859-1] Ilpo J�rvinen wrote:
> A similar fix to netfilter from Eric Dumazet inspired me to
> look around a bit by using some grep/sed stuff as looking for
> this kind of bugs seemed easy to automate. This is one of them
> I found where it looks like this semicolon is not valid.
> 
> Signed-off-by: Ilpo J�rvinen <[EMAIL PROTECTED]>
> ---
> 
> ...Since I'm not familiar with these parts of the kernel, you might know 
> better than I do if this is stuff is valid...
> 
>  arch/powerpc/mm/hash_utils_64.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index f178957..a47151e 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -795,7 +795,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
>  
>  #ifdef CONFIG_PPC_MM_SLICES
>   /* We only prefault standard pages for now */
> - if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize));
> + if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize))
>   return;
>  #endif

Interestingly the test has `unlikely'. So the bug showed up in the `likely'
case...

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH v2] powerpc: add setmaskedbits macros

2007-08-16 Thread Geert Uytterhoeven
On Thu, 16 Aug 2007, Michael Ellerman wrote:
> Can you extract the masking logic, rather than repeating it 7 times:
> 
> #define maskbits(a, v, m) ((a) & ~(m) | (v))
> 
> And if you're going to the trouble of making a macro, why not make it a
> bit more useful and have it check that the value and the mask match, ie:
> 
> (v & ~m == 0)
> 
> Final random thought, you could make the size/endian an argument:
> 
> #define setmaskedbits(a, v, m, s)  out_##s((a), (in_##s(a) & ~(m) | (v))

For readability, you can change the parameter names `v' and `m' to e.g. `set'
and `clear' (or `clr'), so people don't have to look through the actual
definitions to know which one comes first?

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: System crash on boot_e500.S

2007-08-16 Thread Geert Uytterhoeven
On Wed, 15 Aug 2007, mike zheng wrote:
> On 8/15/07, Scott Wood <[EMAIL PROTECTED]> wrote:
> > mike zheng wrote:
> > > Unfortunately, all the applications are running on 2.4 kernel. I can not
> > > just throw the 2.4 kernel.
> >
> > And in what way does 2.6 break these applications?
> 
> All the device drivers are based on 2.4 kernel. We plan to upgrade to 2.6 in
 
derived from?

> the middle of next year.

> > Any suggest or comment is welcome, I am struggling with this issue for
> > > almost one week.. :-(
> >
> > How long would you have struggled with getting your applications running
> > on a more recent kernel instead?
> 
> 
> Don't know, maybe 16 weeks. That is out of my control. I only deal with the
> kernel.:-)

Ah, good, so the device drivers are in user space.
What in user space has changed completely between 2.4 and 2.6?

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 2/2] [POWERPC] Add scaled time accounting

2007-08-16 Thread Michael Neuling
This adds POWERPC specific hooks for scaled time accounting.

POWER6 includes a SPURR register.  The SPURR is based off the PURR
register but is scaled based on CPU frequency and issue rates.  This
gives a more accurate account of the instructions used per task.  The
PURR and timebase will be constant relative to the wall clock,
irrespective of the CPU frequency.  

This implementation reads the SPURR register in account_system_vtime
which is only call called on context witch and hard and soft irq entry
and exit.  The percentage of user and system time is then estimated
using the ratio of these accounted by the PURR.  If the SPURR is not
present, the PURR read.

An earlier implementation of this patch read the SPURR whenever the
PURR was read, which included the system call entry and exit path.
Unfortunately this showed a performance regression on lmbench runs, so
was re-implemented.

I've included the lmbench results here when run bare metal on POWER6.
1st column is the unpatch results.  2nd column is the results using the
below patch and the 3rd is the % diff of these results from the base.
4th and 5th columns are the results and % differnce from the base
using the older patch (SPURR read in syscall entry/exit path).

  BaseScaled-Acct SPURR-in-syscall 
 Result  Result  % diffResult % diff  
Simple syscall:  0.3086  0.3086  0.0.3452 11.8600 
Simple read: 0.4591  0.4671  1.74250.5044 9.86713 
Simple write:0.4364  0.4366  0.04580.4731 8.40971 
Simple stat: 2.0055  2.0295  1.19672.0669 3.06158 
Simple fstat:0.5962  0.5876  -1.4420.6368 6.80979 
Simple open/close:   3.1283  3.1009  -0.8753.2088 2.57328 
Select on 10 fd's:   0.8554  0.8457  -1.1330.8667 1.32101 
Select on 100 fd's:  3.5292  3.6329  2.93833.6664 3.88756 
Select on 250 fd's:  7.9097  8.1881  3.51978.2242 3.97613 
Select on 500 fd's:  15.2659 15.836  3.735715.873 3.97814 
Select on 10 tcp fd's:   0.9576  0.9416  -1.6700.9752 1.83792 
Select on 100 tcp fd's:  7.248   7.2254  -0.3117.2685 0.28283 
Select on 250 tcp fd's:  17.7742 17.707  -0.37517.749 -0.1406 
Select on 500 tcp fd's:  35.4258 35.25   -0.49635.286 -0.3929 
Signal handler installation: 0.6131  0.6075  -0.9130.647  5.52927 
Signal handler overhead: 2.0919  2.1078  0.76002.1831 4.35967 
Protection fault:0.7345  0.7478  1.81070.8031 9.33968 
Pipe latency:33.006  16.398  -50.3133.475 1.42368 
AF_UNIX sock stream latency: 14.5093 30.910  113.0330.715 111.692 
Process fork+exit:   219.8   222.8   1.3648229.37 4.35623 
Process fork+execve: 876.14  873.28  -0.32 868.66 -0.8533 
Process fork+/bin/sh -c: 28302876.5  1.64312958   4.52296 
File /var/tmp/XXX write bw:  1193497 1195536 0.1708118657 -0.5799 
Pagefaults on /var/tmp/XXX:  3.1272  3.2117  2.70203.2521 3.99398 

Also, kernel compile times show no difference with this patch applied.

Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>

---

 arch/powerpc/kernel/asm-offsets.c |1 +
 arch/powerpc/kernel/time.c|   32 ++--
 include/asm-powerpc/paca.h|3 +++
 3 files changed, 34 insertions(+), 2 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/asm-offsets.c
===
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/asm-offsets.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/asm-offsets.c
@@ -141,6 +141,7 @@ int main(void)
DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
+   DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
Index: linux-2.6-ozlabs/arch/powerpc/kernel/time.c
===
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/time.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/time.c
@@ -168,23 +168,44 @@ static u64 read_purr(void)
 }
 
 /*
+ * Read the SPURR on systems that have it, otherwise the purr
+ */
+static u64 read_spurr(void)
+{
+   if (cpu_has_feature(CPU_FTR_SPURR))
+   return mfspr(SPRN_SPURR);
+   return read_purr();
+}
+
+/*
  * Account time for a transition between system, hard irq
  * or soft irq state.
  */
 void account_system_vtime(struct task_struct *tsk)
 {
-   u64 now, del

[PATCH 1/2] Add scaled time to taskstats based process accounting

2007-08-16 Thread Michael Neuling
This adds two items to the taststats struct to account for user and
system time based on scaling the CPU frequency and instruction issue
rates.

Adds account_(user|system)_time_scaled callbacks which architectures
can use to account for time using this mechanism.

Signed-off-by: Michael Neuling <[EMAIL PROTECTED]>

---

 include/linux/kernel_stat.h |2 ++
 include/linux/sched.h   |2 +-
 include/linux/taskstats.h   |6 +-
 kernel/fork.c   |2 ++
 kernel/sched.c  |   21 +
 kernel/timer.c  |7 +--
 kernel/tsacct.c |4 
 7 files changed, 40 insertions(+), 4 deletions(-)

Index: linux-2.6-ozlabs/include/linux/kernel_stat.h
===
--- linux-2.6-ozlabs.orig/include/linux/kernel_stat.h
+++ linux-2.6-ozlabs/include/linux/kernel_stat.h
@@ -52,7 +52,9 @@ static inline int kstat_irqs(int irq)
 }
 
 extern void account_user_time(struct task_struct *, cputime_t);
+extern void account_user_time_scaled(struct task_struct *, cputime_t);
 extern void account_system_time(struct task_struct *, int, cputime_t);
+extern void account_system_time_scaled(struct task_struct *, cputime_t);
 extern void account_steal_time(struct task_struct *, cputime_t);
 
 #endif /* _LINUX_KERNEL_STAT_H */
Index: linux-2.6-ozlabs/include/linux/sched.h
===
--- linux-2.6-ozlabs.orig/include/linux/sched.h
+++ linux-2.6-ozlabs/include/linux/sched.h
@@ -1020,7 +1020,7 @@ struct task_struct {
int __user *clear_child_tid;/* CLONE_CHILD_CLEARTID */
 
unsigned int rt_priority;
-   cputime_t utime, stime;
+   cputime_t utime, stime, utimescaled, stimescaled;
unsigned long nvcsw, nivcsw; /* context switch counts */
struct timespec start_time; /* monotonic time */
struct timespec real_start_time;/* boot based time */
Index: linux-2.6-ozlabs/include/linux/taskstats.h
===
--- linux-2.6-ozlabs.orig/include/linux/taskstats.h
+++ linux-2.6-ozlabs/include/linux/taskstats.h
@@ -31,7 +31,7 @@
  */
 
 
-#define TASKSTATS_VERSION  5
+#define TASKSTATS_VERSION  6
 #define TS_COMM_LEN32  /* should be >= TASK_COMM_LEN
 * in linux/sched.h */
 
@@ -142,6 +142,10 @@ struct taskstats {
__u64   write_char; /* bytes written */
__u64   read_syscalls;  /* read syscalls */
__u64   write_syscalls; /* write syscalls */
+
+   /* time accounting for SMT machines */
+   __u64   ac_utimescaled; /* utime scaled on frequency etc */
+   __u64   ac_stimescaled; /* stime scaled on frequency etc */
/* Extended accounting fields end */
 
 #define TASKSTATS_HAS_IO_ACCOUNTING
Index: linux-2.6-ozlabs/kernel/fork.c
===
--- linux-2.6-ozlabs.orig/kernel/fork.c
+++ linux-2.6-ozlabs/kernel/fork.c
@@ -1045,6 +1045,8 @@ static struct task_struct *copy_process(
 
p->utime = cputime_zero;
p->stime = cputime_zero;
+   p->utimescaled = cputime_zero;
+   p->stimescaled = cputime_zero;
 
 #ifdef CONFIG_TASK_XACCT
p->rchar = 0;   /* I/O counter: bytes read */
Index: linux-2.6-ozlabs/kernel/sched.c
===
--- linux-2.6-ozlabs.orig/kernel/sched.c
+++ linux-2.6-ozlabs/kernel/sched.c
@@ -3249,6 +3249,16 @@ void account_user_time(struct task_struc
 }
 
 /*
+ * Account scaled user cpu time to a process.
+ * @p: the process that the cpu time gets accounted to
+ * @cputime: the cpu time spent in user space since the last update
+ */
+void account_user_time_scaled(struct task_struct *p, cputime_t cputime)
+{
+   p->utimescaled = cputime_add(p->utimescaled, cputime);
+}
+
+/*
  * Account system cpu time to a process.
  * @p: the process that the cpu time gets accounted to
  * @hardirq_offset: the offset to subtract from hardirq_count()
@@ -3280,6 +3290,17 @@ void account_system_time(struct task_str
 }
 
 /*
+ * Account scaled system cpu time to a process.
+ * @p: the process that the cpu time gets accounted to
+ * @hardirq_offset: the offset to subtract from hardirq_count()
+ * @cputime: the cpu time spent in kernel space since the last update
+ */
+void account_system_time_scaled(struct task_struct *p, cputime_t cputime)
+{
+   p->stimescaled = cputime_add(p->stimescaled, cputime);
+}
+
+/*
  * Account for involuntary wait time.
  * @p: the process from which the cpu time has been stolen
  * @steal: the cpu time spent in involuntary wait
Index: linux-2.6-ozlabs/kernel/timer.c
===
--- linux-2.6-ozlabs.orig/kernel/timer.c
+++ linux-2.6-ozlabs/kernel/timer.c
@@ -826,10 +826,13